X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=c%2B%2B%2Fedit_cfg.sh;h=928f7fdfb7dd5ae1b3e3e5c6b10a4f7adf6a99e8;hp=e108074adf4e5706b9c135c3ac46c8dafcfa5943;hb=HEAD;hpb=0eb88fc5281804773e2a0c7a488a4452463535ce diff --git a/c++/edit_cfg.sh b/c++/edit_cfg.sh index e108074a..928f7fdf 100755 --- a/c++/edit_cfg.sh +++ b/c++/edit_cfg.sh @@ -1,7 +1,8 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.7 1999/09/12 02:00:14 tom Exp $ +# $Id: edit_cfg.sh,v 1.19 2022/07/16 18:00:59 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright 2020,2022 Thomas E. Dickey # +# Copyright 1998-2007,2008 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 1997 +# Author: Thomas E. Dickey 1997-on # # Edit the default value of the etip.h file based on the autoconf-generated # values: @@ -36,29 +37,36 @@ # $1 = ncurses_cfg.h # $2 = etip.h # +echo "substituting autoconf'd values from $1 into $2" for name in \ CPP_HAS_PARAM_INIT \ + CPP_HAS_STATIC_CAST \ ETIP_NEEDS_MATH_EXCEPTION \ ETIP_NEEDS_MATH_H \ HAVE_BUILTIN_H \ - HAVE_GXX_BUILTIN_H \ HAVE_GPP_BUILTIN_H \ + HAVE_GXX_BUILTIN_H \ + HAVE_IOSTREAM \ HAVE_TYPEINFO \ - HAVE_VALUES_H + HAVE_VALUES_H \ + IOSTREAM_NAMESPACE do - mv $2 $2.bak - if ( grep "[ ]$name[ ]1" $1 2>&1 >/dev/null) + rm -f "$2".bak + mv "$2" "$2".bak + if ( grep "[ ]${name}[ ]1" "$1" >/dev/null 2>&1) then - sed -e 's/define '$name'.*$/ define '$name' 1/' $2.bak >$2 + value=1 + sed -e 's/define '"$name"'.*$/define '"$name"' 1/' "$2".bak >"$2" else - sed -e 's/define '$name'.*$/ define '$name' 0/' $2.bak >$2 + value=0 + sed -e 's/define '"$name"'.*$/define '"$name"' 0/' "$2".bak >"$2" fi - if (cmp -s $2 $2.bak) + if (cmp -s "$2" "$2".bak) then - echo '** same: '$name - mv $2.bak $2 + echo '... '$name $value + mv "$2".bak "$2" else - echo '** edit: '$name - rm -f $2.bak + echo '... '$name $value + rm -f "$2".bak fi done