X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2Fedit_cfg.sh;h=f7f1795654f24fd3a2b2f8471f0ab61f333653cb;hp=8d64fee18013b37137f1c2b157790d064286b206;hb=HEAD;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/include/edit_cfg.sh b/include/edit_cfg.sh index 8d64fee1..559b1575 100755 --- a/include/edit_cfg.sh +++ b/include/edit_cfg.sh @@ -1,7 +1,8 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.12 2001/12/23 00:52:40 tom Exp $ +# $Id: edit_cfg.sh,v 1.16 2022/07/16 18:02:32 tom Exp $ ############################################################################## -# Copyright (c) 1998,2000,2001 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 5 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