[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] srclist-update port to pedantic POSIX 1003.1-2001 hosts
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] srclist-update port to pedantic POSIX 1003.1-2001 hosts |
Date: |
08 Jul 2003 16:36:49 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I occasionally run in a more pedantic POSIX environment (e.g.,
_POSIX2_VERSION=200112 in my environment with GNU coreutils and
diffutils) so I ran afoul of some GNU extensions in srclist-update,
and then audited it looking for other GNU extensions. Hope it's OK if
I install the following change to srclist-update to make it conform to
POSIX. I also took the liberty of changing "src=`eval echo $src`" to
the shorter and sweeter "eval src=$src".
2003-07-08 Paul Eggert <address@hidden>
* srclist-update: Port to POSIX 1003.1-2001 hosts by avoiding the
use of GNU extensions. Change "x=`eval echo $x`" to the shorter
and sweeter "eval x=$x".
--- srclist-update.~1.5.~ Tue Nov 26 14:58:57 2002
+++ srclist-update Tue Jul 8 14:53:40 2003
@@ -51,22 +51,24 @@ fixlicense() \
#
fixfile() \
{
- if echo "$options" | grep -w gpl >/dev/null; then
- fixlicense $1
- else
- cat $1
- fi \
- | fgrep -v '$'"Id:" >$2
+ case " $options " in
+ *' gpl '*)
+ fixlicense $1;;
+ *)
+ cat $1;;
+ esac \
+ | grep -v '\$Id:.*\$' >$2
}
#
cat | while read src dst options; do
- test -z "$dst" && continue # skip lines without second element
- echo "$src $dst" | sed 's/#.*$//' | egrep '^\s*$' >/dev/null \
- && continue # skip whitespace and comment-only lines
+ case $src:$dst in
+ *: ) continue;; # skip lines without second element
+ '#'* ) continue;; # skip comment-only lines
+ esac
- src=`eval echo $src`
+ eval src=$src
if test ! -r $src; then
echo "$0: cannot read $src" >&2
continue
@@ -75,7 +77,7 @@ cat | while read src dst options; do
# Ignore subdirs in src dir. E.g., if input spec is
# src/subdir/foo.c dst
# write destination file dst/foo.c.
- dst=`eval echo $dst`
+ eval dst=$dst
test -d $dst && dst=$dst/`basename $src`
# Make changes for sake of comparison.
@@ -94,7 +96,7 @@ cat | while read src dst options; do
$verbose && echo "## $gplsrc $dst # unchanged"
else
echo "## $gplsrc $dst # changes"
- diff -c2 $dst $gplsrc
+ diff -C 2 $dst $gplsrc
fi
done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gnulib] srclist-update port to pedantic POSIX 1003.1-2001 hosts,
Paul Eggert <=