Deleted Added
full compact
main.c (221533) main.c (224731)
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 9 unchanged lines hidden (view full) ---

18SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#include <sys/cdefs.h>
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 9 unchanged lines hidden (view full) ---

18SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
22THIS SOFTWARE.
23****************************************************************/
24
25#include <sys/cdefs.h>
26__FBSDID("$FreeBSD: head/contrib/one-true-awk/main.c 221533 2011-05-06 14:21:46Z ru $");
26__FBSDID("$FreeBSD: head/contrib/one-true-awk/main.c 224731 2011-08-09 12:54:43Z ru $");
27
27
28const char *version = "version 20110506 (FreeBSD)";
28const char *version = "version 20110807 (FreeBSD)";
29
30#define DEBUG
31#include <stdio.h>
32#include <ctype.h>
33#include <locale.h>
34#include <stdlib.h>
35#include <string.h>
36#include <signal.h>

--- 83 unchanged lines hidden (view full) ---

120 fs = "\t";
121 else if (argc > 1 && argv[1][0] != 0)
122 fs = &argv[1][0];
123 }
124 if (fs == NULL || *fs == '\0')
125 WARNING("field separator FS is empty");
126 break;
127 case 'v': /* -v a=1 to be done NOW. one -v for each */
29
30#define DEBUG
31#include <stdio.h>
32#include <ctype.h>
33#include <locale.h>
34#include <stdlib.h>
35#include <string.h>
36#include <signal.h>

--- 83 unchanged lines hidden (view full) ---

120 fs = "\t";
121 else if (argc > 1 && argv[1][0] != 0)
122 fs = &argv[1][0];
123 }
124 if (fs == NULL || *fs == '\0')
125 WARNING("field separator FS is empty");
126 break;
127 case 'v': /* -v a=1 to be done NOW. one -v for each */
128 if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1]))
129 setclvar(argv[1]);
130 else if (argv[1][2] != '\0')
131 setclvar(&argv[1][2]);
128 if (argv[1][2] != 0) { /* arg is -vsomething */
129 if (isclvar(&argv[1][2]))
130 setclvar(&argv[1][2]);
131 else
132 FATAL("invalid -v option argument: %s", &argv[1][2]);
133 } else { /* arg is -v something */
134 argc--; argv++;
135 if (argc <= 1)
136 FATAL("no variable name");
137 if (isclvar(argv[1]))
138 setclvar(argv[1]);
139 else
140 FATAL("invalid -v option argument: %s", argv[1]);
141 }
132 break;
133 case 'd':
134 dbg = atoi(&argv[1][2]);
135 if (dbg == 0)
136 dbg = 1;
137 printf("awk %s\n", version);
138 break;
139 default:

--- 69 unchanged lines hidden ---
142 break;
143 case 'd':
144 dbg = atoi(&argv[1][2]);
145 if (dbg == 0)
146 dbg = 1;
147 printf("awk %s\n", version);
148 break;
149 default:

--- 69 unchanged lines hidden ---