| Aharon Robbins 2004-09-20, 3:56 pm |
| Hello. Given the recent discussion here about being able to pass
command line options (and thus arbitrary source code via --source) to
gawk in CGI scripts, here is a patch that adds mawk's -Wexec to gawk.
The difference between -f and -Wexec (or --exec) is that --exec ends all
option processing. Thanks to John DuBois and Don Stokes for their input.
This will make its way into 3.1.5.
Arnold
-------------------------- cut here ----------------------------------
--- ../gawk-3.1.4/main.c 2004-07-28 16:42:19.000000000 +0300
+++ main.c 2004-09-20 13:12:54.000000000 +0300
@@ -181,6 +186,7 @@
{ "version", no_argument, NULL, 'V' },
{ "usage", no_argument, NULL, 'u' },
{ "help", no_argument, NULL, 'u' },
+ { "exec", required_argument, NULL, 'S' },
#ifdef GAWKDEBUG
{ "parsedebug", no_argument, NULL, 'D' },
#endif
@@ -292,6 +299,7 @@
preassigns_add(PRE_ASSIGN_FS, optarg);
break;
+ case 'S':
case 'f':
/*
* a la MKS awk, allow multiple -f options.
@@ -436,6 +444,8 @@
let getopt print error message for us */
break;
}
+ if (c == 'S') /* --exec ends option processing */
+ break;
}
out:
@@ -636,6 +655,7 @@
fputs(_("\t-W copyleft\t\t--copyleft\n"), fp);
fputs(_("\t-W copyright\t\t--copyright\n"), fp);
fputs(_("\t-W dump-variables[=file]\t--dump-variables[=file]\n"), fp);
+ fputs(_("\t-W exec=file\t\t--exec=file\n"), fp);
fputs(_("\t-W gen-po\t\t--gen-po\n"), fp);
fputs(_("\t-W help\t\t\t--help\n"), fp);
fputs(_("\t-W lint[=fatal]\t\t--lint[=fatal]\n"), fp);
--
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd. arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381 Fax: +1 206 350 8765
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL
|