pff: bug origext

This commit is contained in:
Jephté Clain 2021-03-26 22:02:56 +04:00
parent 4607f0f3c2
commit 3d54e3771d
1 changed files with 7 additions and 5 deletions

12
pff
View File

@ -838,11 +838,12 @@ function new_cmd() {
local fnsrc0="$workdir/nsrc0" fosrc0="$workdir/osrc0" local fnsrc0="$workdir/nsrc0" fosrc0="$workdir/osrc0"
>"$fnsrc0" >"$fnsrc0"
>"$fosrc0" >"$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 found = 0
for (i = 1; i <= ORIGEXTS_count; i++) { for (i = 1; i <= ORIGEXTS_count; i++) {
sub("^" prefix, "") sub("^" prefix, "")
if ($0 ~ ORIGEXTS[i] "(/|$)") { re_origext = qregexp(ORIGEXTS[i]) "(/|$)"
if ($0 ~ re_origext) {
print >fosrc print >fosrc
found = 1 found = 1
break break
@ -966,11 +967,12 @@ function new_cmd() {
csort "$fosrc0" >"$fosrc" csort "$fosrc0" >"$fosrc"
>"$flsrc" >"$flsrc"
>"$flosrc" >"$flosrc"
awkrun <"$fosrc0" ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{ <"$fosrc0" awkrun -f ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{
for (i = 1; i <= ORIGEXTS_count; i++) { for (i = 1; i <= ORIGEXTS_count; i++) {
if ($0 ~ ORIGEXTS[i] "(/|$)") { re_origext = qregexp(ORIGEXTS[i]) "(/|$)"
if ($0 ~ re_origext) {
orig = $0 orig = $0
local = gensub(ORIGEXTS[i] "(/|$)", "\\1", 1, $0) local = gensub(re_origext, "\\1", 1, $0)
print local ":" orig >flosrc print local ":" orig >flosrc
print local >flsrc print local >flsrc
break break