X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;ds=sidebyside;f=include%2Fedit_cfg.sh;h=559b1575443faf2b2cd5169eeaa7a26ceadbf1f9;hb=a09e8b13568e210a03ca4ad64e8552c0edea07c5;hp=5b2e4fba734dec87e000e30752bf4f73ac587516;hpb=a20e6eb464be80b9cd8cae7ce925d27fe9c209ed;p=ncurses.git diff --git a/include/edit_cfg.sh b/include/edit_cfg.sh index 5b2e4fba..559b1575 100755 --- a/include/edit_cfg.sh +++ b/include/edit_cfg.sh @@ -1,7 +1,8 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.13 2017/08/12 12:22:06 tom Exp $ +# $Id: edit_cfg.sh,v 1.16 2022/07/16 18:02:32 tom Exp $ ############################################################################## -# Copyright (c) 2000,2001,2017 Free Software Foundation, Inc. # +# Copyright 2020,2022 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"), # @@ -38,15 +39,16 @@ # BAK=save$$ TMP=edit$$ -trap "rm -f $BAK $TMP" 0 1 2 3 15 +trap "rm -f $BAK $TMP; exit 1" 1 2 3 15 +trap "rm -f $BAK $TMP" 0 for name in \ HAVE_TCGETATTR \ HAVE_TERMIOS_H \ HAVE_TERMIO_H \ BROKEN_LINKER do - mv $2 $BAK - if ( grep "[ ]$name[ ]" $1 2>&1 >$TMP ) + mv "$2" "$BAK" + if ( grep "[ ]${name}[ ]" "$1" >$TMP 2>&1 ) then value=1 else @@ -57,11 +59,11 @@ do -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) + "$BAK" >"$2" + if (cmp -s "$2" "$BAK") then - mv $BAK $2 + mv "$BAK" "$2" else - rm -f $BAK + rm -f "$BAK" fi done