version 1.14, 2007/01/29 19:40:06 |
version 1.15, 2008/10/06 20:38:33 |
|
|
THIS SOFTWARE. |
THIS SOFTWARE. |
****************************************************************/ |
****************************************************************/ |
|
|
const char *version = "version 20041222"; |
const char *version = "version 20071023"; |
|
|
#define DEBUG |
#define DEBUG |
#include <stdio.h> |
#include <stdio.h> |
|
|
#include "awk.h" |
#include "awk.h" |
#include "ytab.h" |
#include "ytab.h" |
|
|
#define MAX_PFILE 20 |
|
|
|
extern char **environ; |
extern char **environ; |
extern int nfields; |
extern int nfields; |
extern char *__progname; |
extern char *__progname; |
|
|
int compile_time = 2; /* for error printing: */ |
int compile_time = 2; /* for error printing: */ |
/* 2 = cmdline, 1 = compile, 0 = running */ |
/* 2 = cmdline, 1 = compile, 0 = running */ |
|
|
|
#define MAX_PFILE 20 /* max number of -f's */ |
|
|
char *pfile[MAX_PFILE]; /* program filenames from -f's */ |
char *pfile[MAX_PFILE]; /* program filenames from -f's */ |
int npfile = 0; /* number of filenames */ |
int npfile = 0; /* number of filenames */ |
int curpfile = 0; /* current filename */ |
int curpfile = 0; /* current filename */ |
|
|
FATAL("too many -f options"); |
FATAL("too many -f options"); |
if (argc <= 1) |
if (argc <= 1) |
FATAL("no program filename"); |
FATAL("no program filename"); |
|
if (npfile >= MAX_PFILE - 1) |
|
FATAL("too many -f options"); |
pfile[npfile++] = argv[1]; |
pfile[npfile++] = argv[1]; |
break; |
break; |
case 'F': /* set field separator */ |
case 'F': /* set field separator */ |
|
|
case 'v': /* -v a=1 to be done NOW. one -v for each */ |
case 'v': /* -v a=1 to be done NOW. one -v for each */ |
if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1])) |
if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1])) |
setclvar(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; |
break; |
case 'd': |
case 'd': |
dbg = atoi(&argv[1][2]); |
dbg = atoi(&argv[1][2]); |