4 ===================================================================
5 RCS file: /home/ncvs/src/contrib/one-true-awk/main.c,v
6 retrieving revision 1.1.1.10
7 diff -u -p -r1.1.1.10 main.c
8 --- main.c 16 May 2005 19:11:31 -0000 1.1.1.10
9 +++ main.c 15 Sep 2006 13:21:30 -0000
10 @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE
12 ****************************************************************/
14 -const char *version = "version 20050424";
15 +const char *version = "version 20050424 (FreeBSD)";
19 @@ -58,6 +58,7 @@ int main(int argc, char *argv[])
20 const char *fs = NULL;
22 setlocale(LC_CTYPE, "");
23 + setlocale(LC_COLLATE, "");
24 setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
27 @@ -79,13 +80,18 @@ int main(int argc, char *argv[])
30 case 'f': /* next argument is program filename */
34 - FATAL("no program filename");
35 - if (npfile >= MAX_PFILE - 1)
36 - FATAL("too many -f options");
37 - pfile[npfile++] = argv[1];
38 + if (argv[1][2] != 0) { /* arg is -fsomething */
39 + if (npfile >= MAX_PFILE - 1)
40 + FATAL("too many -f options");
41 + pfile[npfile++] = &argv[1][2];
42 + } else { /* arg is -f something */
45 + FATAL("no program filename");
46 + if (npfile >= MAX_PFILE - 1)
47 + FATAL("too many -f options");
48 + pfile[npfile++] = argv[1];
51 case 'F': /* set field separator */
52 if (argv[1][2] != 0) { /* arg is -Fsomething */
53 @@ -104,8 +110,14 @@ int main(int argc, char *argv[])
54 WARNING("field separator FS is empty");
56 case 'v': /* -v a=1 to be done NOW. one -v for each */
57 - if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1]))
59 + if (argv[1][2] != 0) { /* arg is -vsomething */
60 + if (argv[1][2] != 0)
61 + setclvar(&argv[1][2]);
62 + } else { /* arg is -v something */
64 + if (argc > 1 && isclvar(argv[1]))
68 case 'm': /* more memory: -mr=record, -mf=fields */
69 /* no longer supported */