bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

other texinfo 4.4 incompatibilities with POSIX 1003.1-2001


From: Paul Eggert
Subject: other texinfo 4.4 incompatibilities with POSIX 1003.1-2001
Date: Fri, 31 Jan 2003 22:59:35 -0800 (PST)

Here are some other incompatibilities of texinfo 4.4 with POSIX
1003.1-2001.  These are less important than the "diff -u0" problem,
since I don't know of any texinfo porting target that will reject
these uses now.  However, it's easy enough to port this code to strict
POSIX 1003.1-2001 hosts, while maintaining compatibility with
traditional hosts that lack grep -E and grep -F, so here is a patch to
do that.

2003-01-31  Paul Eggert  <address@hidden>

        Port to POSIX 1003.1-2001 hosts, which have these restrictions:

        "test FOO -a BAR" is less portable than "test FOO && test BAR".
        Likewise for "test FOO -o BAR" and "test FOO || test BAR".
        "egrep" is no longer required: "grep -E" is required instead.
        Likewise for "fgrep" and "grep -F".

diff -ru ./makeinfo/tests/cond /tmp/texinfo/makeinfo/tests/cond
--- ./makeinfo/tests/cond       2000-12-22 07:02:32.000000000 -0800
+++ /tmp/texinfo/makeinfo/tests/cond    2003-01-31 22:43:10.157972986 -0800
@@ -3,30 +3,36 @@
 
 : ${srcdir=.}
 
+if echo a | (grep -E '(a|b)') >/dev/null 2>&1; then
+  EGREP='grep -E'
+else
+  EGREP='egrep'
+fi
+
 # Default Info output.
 ../makeinfo -o cond.out $srcdir/cond.txi || exit 1
-egrep 'This is (ifnothtml|ifinfo|ifnottex) text' cond.out >/dev/null \
+$EGREP 'This is (ifnothtml|ifinfo|ifnottex) text' cond.out >/dev/null \
   || exit 2
-test `fgrep ' text.' cond.out | wc -l` -eq 3 || exit 3
+test `grep ' text\.' cond.out | wc -l` -eq 3 || exit 3
 
 # Default HTML output.
 ../makeinfo --no-split --html -o cond.out $srcdir/cond.txi || exit 1
-egrep 'This is (html|ifhtml|ifnotinfo|ifnottex) text' cond.out >/dev/null \
+$EGREP 'This is (html|ifhtml|ifnotinfo|ifnottex) text' cond.out >/dev/null \
  || exit 2
-test `fgrep ' text.' cond.out | wc -l` -eq 4 || exit 3
+test `grep ' text\.' cond.out | wc -l` -eq 4 || exit 3
 
 # --ifhtml off, --ifinfo off, --iftex off.
 ../makeinfo --no-ifhtml --no-ifinfo --no-iftex -o cond.out $srcdir/cond.txi || 
exit 1
-egrep 'This is ifnot(html|info|tex) text' cond.out >/dev/null \
+$EGREP 'This is ifnot(html|info|tex) text' cond.out >/dev/null \
  || exit 2
-test `fgrep ' text.' cond.out | wc -l` -eq 3 || exit 3
+test `grep ' text\.' cond.out | wc -l` -eq 3 || exit 3
 
 # Do we really need to test all the other permutations?
 
 # --ifhtml on, --ifinfo on, --iftex on.
 ../makeinfo --ifhtml --ifinfo --iftex -o cond.out $srcdir/cond.txi || exit 1
-egrep 'This is (html|ifhtml|ifinfo|tex|iftex) text' cond.out >/dev/null \
+$EGREP 'This is (html|ifhtml|ifinfo|tex|iftex) text' cond.out >/dev/null \
  || exit 2
-test `fgrep ' text.' cond.out | wc -l` -eq 5 || exit 3
+test `grep ' text\.' cond.out | wc -l` -eq 5 || exit 3
 
 rm -f cond.out cond.info
diff -ru ./util/fix-info-dir /tmp/texinfo/util/fix-info-dir
--- ./util/fix-info-dir 1999-01-24 14:53:45.000000000 -0800
+++ /tmp/texinfo/util/fix-info-dir      2003-01-31 22:49:26.496719494 -0800
@@ -118,7 +118,7 @@
                else
                        SKELETON="$ORIGINAL_DIR/$1"
                fi
-               if test ! -r "$SKELETON" -a -f "$SKELETON"; then
+               if test ! -r "$SKELETON" && test -f "$SKELETON"; then
                        echo "$0:$LINENO: $SKELETON is not readable">&2
                        exit 2
                fi
diff -ru ./util/gen-dir-node /tmp/texinfo/util/gen-dir-node
--- ./util/gen-dir-node 2002-08-25 16:38:39.000000000 -0700
+++ /tmp/texinfo/util/gen-dir-node      2003-01-31 22:49:26.496719494 -0800
@@ -79,7 +79,12 @@
 ### then generate entries for those in the same way, putting the info for 
 ### those at the end....
 
-infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*$' | egrep -v 
'^dir$|^dir\.info$|^dir\.orig$')`
+infofiles=`(cd ${INFODIR}; /bin/ls | sed '
+    /\-[0-9]*$/d
+    /^dir$/d
+    /^dir\.info$/d
+    /^dir\.orig$/d
+')`
 
 # echoing gets clobbered by backquotes; we do it the hard way...
 lines=`wc $SKELETON | awk '{print $1}'`
@@ -107,7 +112,7 @@
 
     fname=
 
-    if [ -z "$echoline" -a ! -z "$file" ] ; then
+    if [ -z "$echoline" ] && [ ! -z "$file" ] ; then
 
       # Find the file to operate upon.  Check both possible names.
       infoname=`echo $file | sed 's/\.info$//'`
@@ -121,10 +126,10 @@
       fi
 
       # If it exists with both names take what was said in the file.
-      if [ ! -z "$ext" -a ! -z "$noext" ]; then
+      if [ ! -z "$ext" ] && [ ! -z "$noext" ]; then
         fname=$file
         warn="### Warning: $ext and $noext both exist!  Using ${file}. ###"
-      elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
+      elif [ ! -z "${noext}${ext}" ]; then
         # just take the name if it exists only once
         fname=${noext}${ext}
       fi
@@ -167,8 +172,8 @@
 
 # Sort remaining files by INFO-DIR-SECTION.
 prevsect=
-filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
-             fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
+filesectdata=`(cd ${INFODIR}; grep INFO-DIR-SECTION /dev/null ${infofiles} | \
+             grep -v 'INFO-DIR-SECTION Miscellaneous' | \
              sort -t: -k2 -k1 | tr ' ' '_')`
 for sectdata in ${filesectdata}; do
   file=`echo ${sectdata} | cut -d: -f1`
diff -ru ./util/install-info-html /tmp/texinfo/util/install-info-html
--- ./util/install-info-html    2002-08-25 16:38:39.000000000 -0700
+++ /tmp/texinfo/util/install-info-html 2003-01-31 22:49:26.496719494 -0800
@@ -109,13 +109,13 @@
 #
 # Input file name
 #
-if [ -z "$all" -a -z "$1" ]; then
+if [ -z "$all" ] && [ -z "$1" ]; then
        help
        echo "$name: No HTML documents given"
        exit 2
 fi
 
-if [ -n "$all" -a -n "$1" ]; then
+if [ -n "$all" ] && [ -n "$1" ]; then
        echo "$name: --all specified, ignoring DIRECTORY-DIRs"
 fi
 
diff -ru ./util/tex3patch /tmp/texinfo/util/tex3patch
--- ./util/tex3patch    1993-03-26 10:59:07.000000000 -0800
+++ /tmp/texinfo/util/tex3patch 2003-01-31 22:49:26.496719494 -0800
@@ -17,8 +17,7 @@
   dir='.'
 fi
 
-if [ \( 2 -lt $# \) -o \
-     \( ! -f $dir/texinfo.tex \)   ]; then
+if [ 2 -lt $# ] || [ ! -f "$dir/texinfo.tex" ]; then
   echo "To patch texinfo.tex for peaceful coexistence with Unix TeX 3.0,"
   echo "run    $0"
   echo "with no arguments in the same directory as texinfo.tex; or run"
@@ -36,7 +35,7 @@
 ( cd $TMPDIR; tex '\relax \batchmode \font\foo=dummy \bye' )
 
 grep -s '3.0' $TMPDIR/texput.log
-if [ 1 = "$?" -a "$ANYVERSION" != "yes" ]; then
+if [ 1 = "$?" ] && [ "$ANYVERSION" != "yes" ]; then
        echo "You probably do not need this patch,"
         echo "since your TeX does not seem to be version 3.0."
        echo "If you insist on applying the patch, run $0"
diff -ru ./util/texi2dvi /tmp/texinfo/util/texi2dvi
--- ./util/texi2dvi     2003-01-31 08:59:45.000000000 -0800
+++ /tmp/texinfo/util/texi2dvi  2003-01-31 22:52:18.426476247 -0800
@@ -109,7 +109,11 @@
 CDPATH=${ZSH_VERSION+.}$path_sep
 
 # In case someone crazy insists on using grep -E.
-: ${EGREP=egrep}
+if echo a | (grep -E '(a|b)') >/dev/null 2>&1; then
+  EGREP='grep -E'
+else
+  EGREP='egrep'
+fi
 
 # Save this so we can construct a new TEXINPUTS path for each file.
 TEXINPUTS_orig="$TEXINPUTS"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]