PR/43981: Aleksey Cheusov: awk too small limit on number -f options
remove the limit should we pullup to 5.x?
This commit is contained in:
parent
5c3f6e3eb4
commit
7aa51b5177
17
external/historical/nawk/dist/main.c
vendored
17
external/historical/nawk/dist/main.c
vendored
@ -51,9 +51,10 @@ int compile_time = 2; /* for error printing: */
|
||||
|
||||
#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 */
|
||||
static char **pfile = NULL; /* program filenames from -f's */
|
||||
static size_t maxpfile = 0; /* max program filenames */
|
||||
static size_t npfile = 0; /* number of filenames */
|
||||
static size_t curpfile = 0; /* current filename */
|
||||
|
||||
int safe = 0; /* 1 => "safe" mode */
|
||||
|
||||
@ -146,8 +147,14 @@ int main(int argc, char *argv[])
|
||||
argv++;
|
||||
if (argc <= 1)
|
||||
FATAL("no program filename");
|
||||
if (npfile >= MAX_PFILE - 1)
|
||||
FATAL("too many -f options");
|
||||
if (npfile >= maxpfile) {
|
||||
maxpfile += 20;
|
||||
pfile = realloc(pfile,
|
||||
maxpfile * sizeof(*pfile));
|
||||
if (pfile == NULL)
|
||||
FATAL("error allocating space for "
|
||||
"-f options");
|
||||
}
|
||||
pfile[npfile++] = argv[1];
|
||||
break;
|
||||
case 'F': /* set field separator */
|
||||
|
Loading…
Reference in New Issue
Block a user