From b01a73783d9e1e2592d3a4c5d95a377ec13d8339 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 9 Sep 2022 10:10:37 +0200 Subject: patchfns: Rename quote_re() to quote_awk_re() Now that quote_bre() has been split into quote_re_grep() and quote_re_sed(), rename quote_re() to quote_awk_re() for consistency. Signed-off-by: Jean Delvare --- quilt/scripts/patchfns.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index 1bd7233..1fbf0d8 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -90,8 +90,8 @@ quote_sed_re() echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g' } -# Quote a string for use in an extended regular expression. -quote_re() +# Quote a string for use in a regular expression for an awk pattern. +quote_awk_re() { echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g' } @@ -184,7 +184,7 @@ change_db_strip_level() $nr=value } - /^'"$(quote_re $patch)"'([ \t]|$)/ \ + /^'"$(quote_awk_re $patch)"'([ \t]|$)/ \ { p_printed=0 for (i=2; i<=NF && $i !~ /^#/; i++) { if ($i ~ /^-p/) { @@ -250,7 +250,7 @@ insert_in_series() if [ -n "$before" ] then awk ' - /^'"$(quote_re $before)"'([ \t]|$)/ \ + /^'"$(quote_awk_re $before)"'([ \t]|$)/ \ { print "'"$patch$patch_args"'" } { print } ' "$SERIES" > $tmpfile @@ -280,7 +280,7 @@ remove_from_series() tmpfile=$(gen_tempfile) || return 1 awk ' - ! /^'"$(quote_re $patch)"'([ \t]|$)/ \ + ! /^'"$(quote_awk_re $patch)"'([ \t]|$)/ \ { print } ' "$SERIES" > $tmpfile if [ $? -ne 0 ] @@ -298,8 +298,8 @@ rename_in_series() tmpfile=$(gen_tempfile) || return 1 awk ' - /^'"$(quote_re $from)"'([ \t]|$)/ \ - { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'") + /^'"$(quote_awk_re $from)"'([ \t]|$)/ \ + { sub(/'"$(quote_awk_re $from)"'/, "'"${to//\"/\\\"}"'") good=1 } { print } END { exit(! good) } @@ -319,8 +319,8 @@ rename_in_db() local tmpfile tmpfile=$(gen_tempfile) || return 1 awk ' - /^'"$(quote_re $from)"'$/ \ - { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'") + /^'"$(quote_awk_re $from)"'$/ \ + { sub(/'"$(quote_awk_re $from)"'/, "'"${to//\"/\\\"}"'") good=1 } { print } END { exit(! good) } -- cgit