From 3d54e3771d1778a8daa74610f8aac8b59fc26f73 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 26 Mar 2021 22:02:56 +0400 Subject: [PATCH] pff: bug origext --- pff | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pff b/pff index da87e0c..1674cc9 100755 --- a/pff +++ b/pff @@ -838,11 +838,12 @@ function new_cmd() { local fnsrc0="$workdir/nsrc0" fosrc0="$workdir/osrc0" >"$fnsrc0" >"$fosrc0" - find "$srcdir" -type f | awkrun ORIGEXTS[@] prefix="$srcdir/" fnsrc="$fnsrc0" fosrc="$fosrc0" '{ + find "$srcdir" -type f | awkrun -f ORIGEXTS[@] prefix="$srcdir/" fnsrc="$fnsrc0" fosrc="$fosrc0" '{ found = 0 for (i = 1; i <= ORIGEXTS_count; i++) { sub("^" prefix, "") - if ($0 ~ ORIGEXTS[i] "(/|$)") { + re_origext = qregexp(ORIGEXTS[i]) "(/|$)" + if ($0 ~ re_origext) { print >fosrc found = 1 break @@ -966,11 +967,12 @@ function new_cmd() { csort "$fosrc0" >"$fosrc" >"$flsrc" >"$flosrc" - awkrun <"$fosrc0" ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{ + <"$fosrc0" awkrun -f ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{ for (i = 1; i <= ORIGEXTS_count; i++) { - if ($0 ~ ORIGEXTS[i] "(/|$)") { + re_origext = qregexp(ORIGEXTS[i]) "(/|$)" + if ($0 ~ re_origext) { orig = $0 - local = gensub(ORIGEXTS[i] "(/|$)", "\\1", 1, $0) + local = gensub(re_origext, "\\1", 1, $0) print local ":" orig >flosrc print local >flsrc break