X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2Fedit_cfg.sh;h=f7f1795654f24fd3a2b2f8471f0ab61f333653cb;hp=baa31f687d1e17b365bb366a7149d547a0bdb06e;hb=d6c65d287166c3105ece4a5e3f3ec7af5a5f26a3;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/include/edit_cfg.sh b/include/edit_cfg.sh index baa31f68..f7f17956 100755 --- a/include/edit_cfg.sh +++ b/include/edit_cfg.sh @@ -1,7 +1,8 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.9 1998/02/11 12:13:46 tom Exp $ +# $Id: edit_cfg.sh,v 1.14 2020/02/02 23:34:34 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright 2020 Thomas E. Dickey # +# Copyright 1998-2001,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,7 +29,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1996,1997 +# Author: Thomas E. Dickey 1996,1997,2000 # # Edit the default value of the term.h file based on the autoconf-generated # values: @@ -38,29 +39,30 @@ # BAK=save$$ TMP=edit$$ -trap "rm -f $BAK $TMP" 0 1 2 5 15 +trap "rm -f $BAK $TMP" 0 1 2 3 15 for name in \ HAVE_TCGETATTR \ HAVE_TERMIOS_H \ HAVE_TERMIO_H \ - NCURSES_CONST \ BROKEN_LINKER do mv $2 $BAK if ( grep "[ ]$name[ ]" $1 2>&1 >$TMP ) then - sed -e 's@#define '$name'.*$@'"`cat $TMP`@" $BAK >$2 - elif test "$name" = "NCURSES_CONST" ; then - sed -e 's/define '$name'.*$/define '$name' \/\*nothing\*\//' $BAK >$2 + value=1 else - sed -e 's/define '$name'.*$/define '$name' 0/' $BAK >$2 + value=0 fi + echo '** edit: '$name $value + sed \ + -e "s@#define ${name}.*\$@#define $name $value@" \ + -e "s@#if $name\$@#if $value /* $name */@" \ + -e "s@#if !$name\$@#if $value /* !$name */@" \ + $BAK >$2 if (cmp -s $2 $BAK) then - echo '** same: '$name mv $BAK $2 else - echo '** edit: '$name rm -f $BAK fi done