aboutsummaryrefslogtreecommitdiffstats
path: root/awklib
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-05-31 12:57:02 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-05-31 12:57:02 +0300
commitf006165d77037b99e205496d8b79cb80e9f280c0 (patch)
tree401b27c8f6e7adedb327efab040c93581016bea5 /awklib
parent17453df8b1ba435161b29ca7e8cf266d0fbaf4ac (diff)
downloadegawk-f006165d77037b99e205496d8b79cb80e9f280c0.tar.gz
egawk-f006165d77037b99e205496d8b79cb80e9f280c0.tar.bz2
egawk-f006165d77037b99e205496d8b79cb80e9f280c0.zip
Further fixes to extract.awk.
Diffstat (limited to 'awklib')
-rw-r--r--awklib/eg/prog/extract.awk7
-rw-r--r--awklib/extract.awk7
2 files changed, 8 insertions, 6 deletions
diff --git a/awklib/eg/prog/extract.awk b/awklib/eg/prog/extract.awk
index ff598e8e..0e9bcca3 100644
--- a/awklib/eg/prog/extract.awk
+++ b/awklib/eg/prog/extract.awk
@@ -30,7 +30,7 @@ BEGIN { IGNORECASE = 1 }
}
if ($3 != curfile) {
if (curfile != "")
- filelist[curfile]++ # save to close later
+ filelist[curfile] = 1 # save to close later
curfile = $3
}
@@ -61,8 +61,9 @@ BEGIN { IGNORECASE = 1 }
}
}
END {
- for (f in filelist)
- close(filelist[f])
+ close(curfile) # close the last one
+ for (f in filelist) # close all the rest
+ close(f)
}
function unexpected_eof()
{
diff --git a/awklib/extract.awk b/awklib/extract.awk
index 96fc9498..0c20e299 100644
--- a/awklib/extract.awk
+++ b/awklib/extract.awk
@@ -30,7 +30,7 @@ BEGIN { IGNORECASE = 1 }
}
if ($3 != curfile) {
if (curfile != "")
- filelist[curfile]++ # save to close later
+ filelist[curfile] = 1 # save to close later
curfile = $3
}
@@ -61,8 +61,9 @@ BEGIN { IGNORECASE = 1 }
}
}
END {
- for (f in filelist)
- close(filelist[f])
+ close(curfile) # close the last one
+ for (f in filelist) # close all the rest
+ close(f)
}
function unexpected_eof()
{