aboutsummaryrefslogtreecommitdiff
path: root/contrib/one-true-awk
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2011-08-11 10:29:10 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2011-08-11 10:29:10 +0000
commitaa0da2e494780a0d64f823ed789c2fa207070144 (patch)
treea20eea0c5240ad883ee6167ee612a5e57b625a9e /contrib/one-true-awk
parent223eb00dd0f32465483e33a012797bad963e971b (diff)
parentb0f5e94e3f34717e78a265dc61c6c45406a258d0 (diff)
downloadsrc-aa0da2e494780a0d64f823ed789c2fa207070144.tar.gz
src-aa0da2e494780a0d64f823ed789c2fa207070144.zip
Notes
Diffstat (limited to 'contrib/one-true-awk')
-rw-r--r--contrib/one-true-awk/FIXES4
-rw-r--r--contrib/one-true-awk/lib.c9
-rw-r--r--contrib/one-true-awk/main.c2
3 files changed, 12 insertions, 3 deletions
diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES
index a802ad418783..a708027461ce 100644
--- a/contrib/one-true-awk/FIXES
+++ b/contrib/one-true-awk/FIXES
@@ -25,6 +25,10 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+Aug 10, 2011:
+ another fix to avoid core dump with delete(ARGV); again, many thanks
+ to ruslan ermilov.
+
Aug 7, 2011:
split(s, a, //) now behaves the same as split(s, a, "")
diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c
index 5da601aa8e7e..5eeb53d4679d 100644
--- a/contrib/one-true-awk/lib.c
+++ b/contrib/one-true-awk/lib.c
@@ -89,8 +89,13 @@ void initgetrec(void)
char *p;
for (i = 1; i < *ARGC; i++) {
- if (!isclvar(p = getargv(i))) { /* find 1st real filename */
- setsval(lookup("FILENAME", symtab), getargv(i));
+ p = getargv(i); /* find 1st real filename */
+ if (p == NULL || *p == '\0') { /* deleted or zapped */
+ argno++;
+ continue;
+ }
+ if (!isclvar(p)) {
+ setsval(lookup("FILENAME", symtab), p);
return;
}
setclvar(p); /* a commandline assignment before filename */
diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c
index 61063b13c9c4..8cc70573afd7 100644
--- a/contrib/one-true-awk/main.c
+++ b/contrib/one-true-awk/main.c
@@ -25,7 +25,7 @@ THIS SOFTWARE.
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-const char *version = "version 20110807 (FreeBSD)";
+const char *version = "version 20110810 (FreeBSD)";
#define DEBUG
#include <stdio.h>