diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/awk/main.c.diff | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/usr.bin/awk/main.c.diff b/usr.bin/awk/main.c.diff index a9d2326..e69a42d 100644 --- a/usr.bin/awk/main.c.diff +++ b/usr.bin/awk/main.c.diff @@ -6,7 +6,7 @@ RCS file: /home/ncvs/src/contrib/one-true-awk/main.c,v retrieving revision 1.1.1.10 diff -u -p -r1.1.1.10 main.c --- main.c 16 May 2005 19:11:31 -0000 1.1.1.10 -+++ main.c 17 May 2005 14:41:20 -0000 ++++ main.c 15 Sep 2006 13:21:30 -0000 @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE THIS SOFTWARE. ****************************************************************/ @@ -24,3 +24,46 @@ diff -u -p -r1.1.1.10 main.c setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ cmdname = argv[0]; if (argc == 1) { +@@ -79,13 +80,18 @@ int main(int argc, char *argv[]) + safe = 1; + break; + case 'f': /* next argument is program filename */ +- argc--; +- argv++; +- if (argc <= 1) +- FATAL("no program filename"); +- if (npfile >= MAX_PFILE - 1) +- FATAL("too many -f options"); +- pfile[npfile++] = argv[1]; ++ if (argv[1][2] != 0) { /* arg is -fsomething */ ++ if (npfile >= MAX_PFILE - 1) ++ FATAL("too many -f options"); ++ pfile[npfile++] = &argv[1][2]; ++ } else { /* arg is -f something */ ++ argc--; argv++; ++ 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 */ + if (argv[1][2] != 0) { /* arg is -Fsomething */ +@@ -104,8 +110,14 @@ int main(int argc, char *argv[]) + WARNING("field separator FS is empty"); + break; + case 'v': /* -v a=1 to be done NOW. one -v for each */ +- if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1])) +- setclvar(argv[1]); ++ if (argv[1][2] != 0) { /* arg is -vsomething */ ++ if (argv[1][2] != 0) ++ setclvar(&argv[1][2]); ++ } else { /* arg is -v something */ ++ argc--; argv++; ++ if (argc > 1 && isclvar(argv[1])) ++ setclvar(argv[1]); ++ } + break; + case 'm': /* more memory: -mr=record, -mf=fields */ + /* no longer supported */ |