From 2aba20681a832c367bf358a4bca2d4d0c1f3f70d Mon Sep 17 00:00:00 2001 From: Sebastian Zagrodzki Date: Wed, 2 Aug 2000 18:17:06 +0000 Subject: [PATCH] - fixed problem with regexp special characters in substituted filenames Changed files: pldnotify.awk -> 1.19 --- pldnotify.awk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pldnotify.awk b/pldnotify.awk index 700a935..2757ee1 100644 --- a/pldnotify.awk +++ b/pldnotify.awk @@ -1,5 +1,12 @@ #!/bin/awk -f # $Revision$, $Date$ +function fixedsub(s1,s2,t, ind) { +# substitutes fixed strings (not regexps) + if (ind = index(t,s1)) { + t = substr(t, 1, ind-1) s2 substr(t, ind+length(s1)) + } + return t +} function compare_ver(v1,v2) { # compares version numbers @@ -168,8 +175,8 @@ function process_source(number,lurl,name,version) { match(addr,filenameexp) newfilename=substr(addr,RSTART,RLENGTH) if (DEBUG) print "Hipotetyczny nowy: " newfilename - sub(prever,"",newfilename) - sub(postver,"",newfilename) + newfilename=fixedsub(prever,"",newfilename) + newfilename=fixedsub(postver,"",newfilename) if (DEBUG) print "Wersja: " newfilename if ( compare_ver(version, newfilename)==1 ) { if (DEBUG) print "Tak, jest nowa" -- 2.44.0