changeset 537:62cd970aea9c

Replace the use of "deprecated" egrep calls with "grep -E"
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 09 Sep 2024 14:28:55 +0200
parents b0148ccbc459
children 9f8f3e9b3d84
files sbin/bsmtp2dma sbin/ftjail sbin/fzfs share/local-bsdtools/common.subr
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/bsmtp2dma	Mon Sep 09 14:13:51 2024 +0200
+++ b/sbin/bsmtp2dma	Mon Sep 09 14:28:55 2024 +0200
@@ -93,12 +93,12 @@
     _addr="$1"
     test -n "${_addr}" || return 1
 
-    if printf "%s" "${_addr}" | grep -q -E -e '^[^<>]+<[^<>]+@[^<>]+>$'; then
+    if printf "%s" "${_addr}" | /usr/bin/grep -q -E -e '^[^<>]+<[^<>]+@[^<>]+>$'; then
         email_name=$(printf '%s' "${_addr}" | sed -E -e 's/[[:space:]]*<.+$//')
         email_addr=$(printf '%s' "${_addr}" | sed -E -e 's/^[^<>]+<//' | sed -E -e 's/>$//')
         return 0
     fi
-    if printf "%s" "${_addr}" | grep -q -E -e '^[^<>]+@[^<>]+$'; then
+    if printf "%s" "${_addr}" | /usr/bin/grep -q -E -e '^[^<>]+@[^<>]+$'; then
         email_name=""
         email_addr="${_addr}"
         return 0
--- a/sbin/ftjail	Mon Sep 09 14:13:51 2024 +0200
+++ b/sbin/ftjail	Mon Sep 09 14:28:55 2024 +0200
@@ -538,7 +538,7 @@
         { echo "ERROR: dataset not found" >&2; return 1; }
 
     /sbin/mount -t zfs -p \
-    | grep -E "^${_dsname}(/|\s)" \
+    | /usr/bin/grep -E "^${_dsname}(/|\s)" \
     | sort -n -r \
     | {
         while IFS=' '$'\t' read -r _name _mp _rest ; do
@@ -940,12 +940,12 @@
     # Note that procstat places extra whitespace at the end of lines sometimes.
     #
     #
-    if procstat -a file | egrep '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
+    if procstat -a file | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
         echo "ERROR: There are open files within the jail" >&2
         return 1
     fi
     # The same for memory mappings
-    if procstat -a vm | egrep '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
+    if procstat -a vm | /usr/bin/grep -E '['$'\t '']+'"${_directory}"'(/|(['$'\t '']*)$)' ; then
         echo "ERROR: There are open memory mappings within the jail" >&2
         return 1
     fi
--- a/sbin/fzfs	Mon Sep 09 14:13:51 2024 +0200
+++ b/sbin/fzfs	Mon Sep 09 14:28:55 2024 +0200
@@ -322,7 +322,7 @@
           done
     else
         /sbin/mount -t zfs -p \
-        | LC_ALL=C /usr/bin/egrep "^${_dsname}(/|\s)" \
+        | LC_ALL=C /usr/bin/grep -E "^${_dsname}(/|\s)" \
         | LC_ALL=C /usr/bin/sort -n -r \
         | while IFS=' '$'\t' read -r _name _mp _rest ; do
             if checkyes _opt_dry_run ; then
--- a/share/local-bsdtools/common.subr	Mon Sep 09 14:13:51 2024 +0200
+++ b/share/local-bsdtools/common.subr	Mon Sep 09 14:28:55 2024 +0200
@@ -442,10 +442,10 @@
     _strict="${2-}"
     if checkyes _strict; then
         # Oracle docs
-        printf "%s" "$1" | LC_ALL=C /usr/bin/egrep -q '^[A-Za-z][-A-Za-z0-9_.]*(/[A-Za-z0-9][-A-Za-z0-9:_.]*)*(@[A-Za-z0-9][-A-Za-z0-9:_.]*)?$'
+        printf "%s" "$1" | LC_ALL=C /usr/bin/grep -q -E '^[A-Za-z][-A-Za-z0-9_.]*(/[A-Za-z0-9][-A-Za-z0-9:_.]*)*(@[A-Za-z0-9][-A-Za-z0-9:_.]*)?$'
     else
         # OpenZFS
-        printf "%s" "$1" | LC_ALL=C /usr/bin/egrep -q '^[A-Za-z][-A-Za-z0-9:_. ]*(/[-A-Za-z0-9:_. ]+)*(@[-A-Za-z0-9:_. ]+)?$'
+        printf "%s" "$1" | LC_ALL=C /usr/bin/grep -q -E '^[A-Za-z][-A-Za-z0-9:_. ]*(/[-A-Za-z0-9:_. ]+)*(@[-A-Za-z0-9:_. ]+)?$'
     fi
 }