bug-a2ps
[Top][All Lists]
Advanced

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

[PATCH] Use `grep -E/-F` instead of `egrep` and `fgrep`


From: Ville Skyttä
Subject: [PATCH] Use `grep -E/-F` instead of `egrep` and `fgrep`
Date: Sat, 13 Nov 2021 12:24:29 +0200

`egrep` and `fgrep` have been deprecated in GNU grep since 2007, and in
current post 3.7 Git they have been made to emit obsolescence warnings:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
---
 configure.ac          | 8 ++++----
 contrib/fixps.in      | 4 ++--
 contrib/texi2dvi4a2ps | 6 +++---
 doc/a2ps.texi         | 2 +-
 etc/a2ps_cfg.in       | 2 +-
 tests/deleg-2.tst     | 4 ++--
 tests/inline.tst      | 6 +++---
 tests/po.tst          | 4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index c99d78e..72321f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,8 +217,8 @@ ad_CHECK_PROGS([netscape, html2ps])
 if test "x$COM_netscape" = x; then
   AC_CACHE_CHECK([whether netscape support remote-command], 
[my_cv_remote_com_netscape],
   [$netscape --help >conftest.help 2>&1
-  if fgrep -e -remote  conftest.help >/dev/null &&
-     fgrep -e -noraise conftest.help >/dev/null; then
+  if grep -Fe -remote  conftest.help >/dev/null &&
+     grep -Fe -noraise conftest.help >/dev/null; then
      my_cv_remote_com_netscape=yes
   else
      my_cv_remote_com_netscape=no
@@ -235,8 +235,8 @@ AC_SUBST(COM_acroread4)
 if test "x$COM_acroread" = x; then
   AC_CACHE_CHECK(whether acroread is acroread 4, a2_cv_com_acroread4,
   [$acroread -helpall >conftest.help
-  if fgrep -e -size   conftest.help >/dev/null &&
-     fgrep -e -shrink conftest.help >/dev/null; then
+  if grep -Fe -size   conftest.help >/dev/null &&
+     grep -Fe -shrink conftest.help >/dev/null; then
      a2_cv_com_acroread4=yes
   else
      a2_cv_com_acroread4=no
diff --git a/contrib/fixps.in b/contrib/fixps.in
index bd6244e..6b77c15 100644
--- a/contrib/fixps.in
+++ b/contrib/fixps.in
@@ -327,13 +327,13 @@ EOF
   fi
 
   # 7. Broken AppleDict procset
-  if echo $comments | fgrep 'AppleDict' > /dev/null; then
+  if echo $comments | grep -F 'AppleDict' > /dev/null; then
     $verbose "$program: fixing Macintosh broken prologue." >&2
     command="$command | fixmacps"
   fi
 
   # 8. Broken Frame Maker procset
-  if echo $comments | fgrep 'Frame' > /dev/null; then
+  if echo $comments | grep -F 'Frame' > /dev/null; then
     $verbose "$program: fixing Frame Maker broken prologue." >&2
     command="$command | fixfmps"
   fi
diff --git a/contrib/texi2dvi4a2ps b/contrib/texi2dvi4a2ps
index 77b27ab..a62b500 100755
--- a/contrib/texi2dvi4a2ps
+++ b/contrib/texi2dvi4a2ps
@@ -302,7 +302,7 @@ for command_line_filename in ${1+"$@"}; do
 
   # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
   # prepend `./' in order to avoid that the tools take it as an option.
-  echo "$command_line_filename" | egrep '^(/|[A-z]:/)' >/dev/null \
+  echo "$command_line_filename" | grep -E '^(/|[A-z]:/)' >/dev/null \
   || command_line_filename="./$command_line_filename"
 
   # See if the file exists.  If it doesn't we're in trouble since, even
@@ -358,7 +358,7 @@ for command_line_filename in ${1+"$@"}; do
   # Otherwise, guess from the file extension.
   if test -n "$set_language"; then
     language=$set_language
-  elif sed 1q "$command_line_filename" | fgrep 'input texinfo' >/dev/null; then
+  elif sed 1q "$command_line_filename" | grep -F 'input texinfo' >/dev/null; 
then
     language=texinfo
   else
     language=
@@ -537,7 +537,7 @@ for command_line_filename in ${1+"$@"}; do
     # subdirs, since texi2dvi does not try to compare xref files in
     # subdirs.  Performing xref files test is still good since LaTeX
     # does not report changes in xref files.
-    if fgrep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
+    if grep -F "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
       finished=
     fi
 
diff --git a/doc/a2ps.texi b/doc/a2ps.texi
index d6696b8..f82c613 100644
--- a/doc/a2ps.texi
+++ b/doc/a2ps.texi
@@ -3068,7 +3068,7 @@ is landscape by looking for the keyword @samp{landscape} 
in it, using
 @code{strings(1)}:
 @example
 Delegation: dvips dvi:ps\
- if strings $f | sed 3q | fgrep landscape > /dev/null 2>&1; then \
+ if strings $f | sed 3q | grep -F landscape > /dev/null 2>&1; then \
    #@{d.dvips@} -T#hpt,#wpt $f -o #f0 && #?o|cat|#@{d.psnup@} -r| #f0;\
  else \
    #@{d.dvips@} $f -o #f0 && #@{d.psnup@} #f0; \
diff --git a/etc/a2ps_cfg.in b/etc/a2ps_cfg.in
index 8f30643..63d73a6 100644
--- a/etc/a2ps_cfg.in
+++ b/etc/a2ps_cfg.in
@@ -249,7 +249,7 @@ $3p<-$3p> $4l# lines\n||
 #   instance) by looking for `landscape' in the first strings of
 #   the DVI file.
 @COM_PSUTILS@@COM_dvips@Delegation: dvips dvi:ps\
-@COM_PSUTILS@@COM_dvips@   if strings '$f' | sed 10q | fgrep landscape > 
/dev/null 2>&1; then \
+@COM_PSUTILS@@COM_dvips@   if strings '$f' | sed 10q | grep -F landscape > 
/dev/null 2>&1; then \
 @COM_PSUTILS@@COM_dvips@     #{del.dvips} -T#hpt,#wpt '$f' -o #f0 && 
#?o|cat|#{del.psnup} -r| #f0; \
 @COM_PSUTILS@@COM_dvips@   else \
 @COM_PSUTILS@@COM_dvips@     #{del.dvips} '$f' -o #f0 && #{del.psnup} #f0; \
diff --git a/tests/deleg-2.tst b/tests/deleg-2.tst
index d15ed93..6aada34 100755
--- a/tests/deleg-2.tst
+++ b/tests/deleg-2.tst
@@ -18,7 +18,7 @@ OUT_NAME=del.ps
 . $SRCDIR/defs || exit 1
 
 # a2ps should fail, saying it does not know the sheet test_delegation.ssh
-$CHK $OPT $TST_FILE -P void 2>&1 | fgrep 'cannot find style sheet' > /dev/null 
2>&1
+$CHK $OPT $TST_FILE -P void 2>&1 | grep -F 'cannot find style sheet' > 
/dev/null 2>&1
 
-# Return status of fgrep
+# Return status of grep
 exit $?
diff --git a/tests/inline.tst b/tests/inline.tst
index 6bf370a..97bbd9e 100755
--- a/tests/inline.tst
+++ b/tests/inline.tst
@@ -12,8 +12,8 @@
 # Get the guilty lines in *.c files
 # Omit strfime.c and confg.c, coz' their inlines are safe.
 # Exclude the word inlined.
-res=`(cd $top_srcdir && fgrep 'inline' src/*.c lib/*.c) |
-     egrep -v '__inline|static|inlined|lib/(confg|strftime)\.c' |
+res=`(cd $top_srcdir && grep -F 'inline' src/*.c lib/*.c) |
+     grep -Ev '__inline|static|inlined|lib/(confg|strftime)\.c' |
      sort -u`
 if test -n "$res"; then
   echo "The following files use non static inline:"
@@ -22,7 +22,7 @@ if test -n "$res"; then
 fi
 
 # No inline allowed in a header.
-res=`(cd $top_srcdir && fgrep 'inline' src/*.h lib/*.h) | sort -u`
+res=`(cd $top_srcdir && grep -F 'inline' src/*.h lib/*.h) | sort -u`
 if test -n "$res"; then
   echo "The following headers use inline:"
   echo "$res"
diff --git a/tests/po.tst b/tests/po.tst
index f0692cb..3a9660f 100755
--- a/tests/po.tst
+++ b/tests/po.tst
@@ -5,9 +5,9 @@
 # Set up other vars
 . $SRCDIR/defs || exit 1
 
-for file in `(cd $top_srcdir && fgrep -l '_(' lib/*.c src/*.c)`
+for file in `(cd $top_srcdir && grep -Fl '_(' lib/*.c src/*.c)`
 do
-  if fgrep "$file" $top_srcdir/po/POTFILES.in >/dev/null 2>&1; then :; else
+  if grep -F "$file" $top_srcdir/po/POTFILES.in >/dev/null 2>&1; then :; else
     echo "Did not see $file in POTFILES.in."
     failure=1
   fi
-- 
2.25.1




reply via email to

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