]> ncurses.scripts.mit.edu Git - ncurses.git/blob - include/edit_cfg.sh
ncurses 4.1
[ncurses.git] / include / edit_cfg.sh
1 #!/bin/sh
2 # $Id: edit_cfg.sh,v 1.6 1997/04/06 01:54:44 tom Exp $
3 ################################################################################
4 # Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net>                   #
5 # All Rights Reserved.                                                         #
6 #                                                                              #
7 # Permission to use, copy, modify, and distribute this software and its        #
8 # documentation for any purpose and without fee is hereby granted, provided    #
9 # that the above copyright notice appear in all copies and that both that      #
10 # copyright notice and this permission notice appear in supporting             #
11 # documentation, and that the name of the above listed copyright holder(s) not #
12 # be used in advertising or publicity pertaining to distribution of the        #
13 # software without specific, written prior permission. THE ABOVE LISTED        #
14 # COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
15 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
16 # SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
17 # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
18 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
19 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
20 # PERFORMANCE OF THIS SOFTWARE.                                                #
21 ################################################################################
22 # Edit the default value of the term.h file based on the autoconf-generated
23 # values:
24 #
25 #       $1 = ncurses_cfg.h
26 #       $2 = term.h
27 #
28 for name in \
29         HAVE_TCGETATTR \
30         HAVE_TERMIOS_H \
31         HAVE_TERMIO_H \
32         BROKEN_LINKER
33 do
34         mv $2 $2.bak
35         if ( grep "[    ]$name[         ]" $1 2>&1 >/dev/null )
36         then
37                 sed -e 's/define '$name'.*$/define '$name' 1/' $2.bak >$2
38         else
39                 sed -e 's/define '$name'.*$/define '$name' 0/' $2.bak >$2
40         fi
41         if (cmp -s $2 $2.bak)
42         then
43                 echo '** same: '$name
44                 mv $2.bak $2
45         else
46                 echo '** edit: '$name
47                 rm -f $2.bak
48         fi
49 done