Index: ossp-pkg/shtool/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v rcsdiff -q -kk '-r1.204' '-r1.205' -u '/v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v' 2>/dev/null --- ChangeLog 2004/06/07 15:13:20 1.204 +++ ChangeLog 2004/07/02 13:06:36 1.205 @@ -9,7 +9,14 @@ ChangeLog - Changes between 2.0b3 and 2.0b4 (08-May-2004 to xx-May-2004): + Changes between 2.0b4 and 2.0.0 (08-May-2004 to 02-Jul-2004): + + *) Add -w/--warning option to "shtool subst" command which + shows warnings on substitution operation resulting in no content + change on every file. The new default is now to show a warning on + substitution operations resulted in no content change on all files + only. + [Ralf S. Engelschall, Thomas Lotterer] *) Fix platform id generation under NetBSD. [Ralf S. Engelschall] Index: ossp-pkg/shtool/sh.subst RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.subst,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.subst,v' 2>/dev/null --- sh.subst 2004/05/08 19:09:58 1.13 +++ sh.subst 2004/07/02 13:06:36 1.14 @@ -19,14 +19,15 @@ ## str_tool="subst" -str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ] [-e|--exec ] [-f|--file ] [] [...]" +str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ] [-e|--exec ] [-f|--file ] [] [...]" gen_tmpfile=yes arg_spec="0+" -opt_spec="v.t.n.q.s.i.b:e+f:" -opt_alias="v:verbose,t:trace,n:nop,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file" +opt_spec="v.t.n.w.q.s.i.b:e+f:" +opt_alias="v:verbose,t:trace,n:nop,w:warning,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file" opt_v=no opt_t=no opt_n=no +opt_w=no opt_q=no opt_s=no opt_i=no @@ -38,6 +39,7 @@ # remember optional list of file(s) files="$*" +files_num="$#" # parameter consistency check if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then @@ -77,6 +79,7 @@ # apply sed(1) operation(s) if [ ".$files" != . ]; then # apply operation(s) to files + substdone=no for file in $files; do test ".$file" = . && continue if [ ! -f $file ]; then @@ -146,7 +149,11 @@ # optionally check whether any content change actually occurred if [ ".$opt_q" = .no ]; then if cmp $file$orig $file >/dev/null 2>&1; then - echo "$msgprefix:Warning: substitution operation results in no content change" 1>&2 + if [ ".$opt_w" = .yes ]; then + echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 + fi + else + substdone=yes fi fi @@ -160,6 +167,15 @@ fi fi done + if [ ".$opt_q" = .no ] && [ ".$opt_w" = .no ]; then + if [ ".$substdone" = .no ]; then + if [ ".$files_num" = .1 ]; then + echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 + else + echo "$msgprefix:Warning: substitution resulted in no content change on any file" 1>&2 + fi + fi + fi else # apply operation(s) to stdin/stdout if [ ".$opt_v" = .yes ]; then @@ -191,6 +207,7 @@ [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-n>|B<--nop>] +[B<-w>|B<--warning>] [B<-q>|B<--quiet>] [B<-s>|B<--stealth>] [B<-i>|B<--interactive>] @@ -223,6 +240,12 @@ No operation mode. Actual execution of the essential shell commands which would be executed is suppressed. +=item B<-w>, B<--warning> + +Show warning on substitution operation resulting in no content change +on I file. The default is to show a warning on substitution +operations resulted in no content change on I files. + =item B<-q>, B<--quiet> Suppress warning on substitution operation resulting in no content change.