summaryrefslogtreecommitdiff
path: root/usr.bin/awk/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/awk/main.c')
-rw-r--r--usr.bin/awk/main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c
index b0c86c5fc78..d4e52329b43 100644
--- a/usr.bin/awk/main.c
+++ b/usr.bin/awk/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.14 2007/01/29 19:40:06 jmc Exp $ */
+/* $OpenBSD: main.c,v 1.15 2008/10/06 20:38:33 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20041222";
+const char *version = "version 20071023";
#define DEBUG
#include <stdio.h>
@@ -35,8 +35,6 @@ const char *version = "version 20041222";
#include "awk.h"
#include "ytab.h"
-#define MAX_PFILE 20
-
extern char **environ;
extern int nfields;
extern char *__progname;
@@ -49,6 +47,8 @@ extern int errorflag; /* non-zero if any syntax errors; set by yyerror */
int compile_time = 2; /* for error printing: */
/* 2 = cmdline, 1 = compile, 0 = running */
+#define MAX_PFILE 20 /* max number of -f's */
+
char *pfile[MAX_PFILE]; /* program filenames from -f's */
int npfile = 0; /* number of filenames */
int curpfile = 0; /* current filename */
@@ -89,6 +89,8 @@ int main(int argc, char *argv[])
FATAL("too many -f options");
if (argc <= 1)
FATAL("no program filename");
+ if (npfile >= MAX_PFILE - 1)
+ FATAL("too many -f options");
pfile[npfile++] = argv[1];
break;
case 'F': /* set field separator */
@@ -111,10 +113,6 @@ int main(int argc, char *argv[])
if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1]))
setclvar(argv[1]);
break;
- case 'm': /* more memory: -mr=record, -mf=fields */
- /* no longer supported */
- WARNING("obsolete option %s ignored", argv[1]);
- break;
case 'd':
dbg = atoi(&argv[1][2]);
if (dbg == 0)