From 4da3ae45ac708347d0c5a375d1ab51095934c971 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Tue, 21 Oct 2003 11:33:11 +0000 Subject: Add fork command --- scripts/patchfns.in | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'scripts/patchfns.in') diff --git a/scripts/patchfns.in b/scripts/patchfns.in index f16ad4e..1aab136 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -217,6 +217,28 @@ remove_from_series() fi } +rename_in_series() +{ + local from=$1 to=$2 + + tmpfile=$(gen_tempfile) || return 1 + /usr/bin/gawk ' + /^'"$(quote_re $from)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \ + { sub(/'"$(quote_re $from)(|\.patch|\.diff?)(|\.gz|\.bz2)"'/, + "'"${to//\"/\\\"}"'") + print + good=1 } + END { exit(! good) } + ' $SERIES > $tmpfile + if [ $? -eq 0 ] + then + mv -f $tmpfile $SERIES + else + rm -f $tmpfile + return 1 + fi +} + pc_file_name() { while [ $# -gt 0 ] @@ -465,6 +487,27 @@ remove_from_db() fi } +rename_in_db() +{ + local from=$1 to=$2 + local tmpfile + tmpfile=$(gen_tempfile) || return 1 + /usr/bin/gawk ' + /^'"$(quote_re $from)"'$/ \ + { sub(/'"$(quote_re $from)"'/, "'"${to//\"/\\\"}"'") + print + good=1 } + END { exit(! good) } + ' $DB > $tmpfile + if [ $? -eq 0 ] + then + mv -f $tmpfile $DB + else + rm -f $tmpfile + return 1 + fi +} + stripit() { if [ -n "$1" ] -- cgit