expr.patch

josepht, 01/20/2009 04:32 AM

Download (810 Bytes)

View differences:

bin/expr/expr.y
18 18
#include <errno.h>
19 19
#include <regex.h>
20 20
#include <limits.h>
21
#include <unistd.h>
21 22
  
22 23
enum valtype {
23 24
	integer, numeric_string, string
......
244 245
	/* NOTREACHED */
245 246
}
246 247

  
248
static void
249
usage(void)
250
{
251
        fprintf(stderr,
252
                "usage: expr <expression>\n");
253
        exit(EXIT_FAILURE);
254
}
255

  
247 256
int
248
main (int argc __unused, char **argv)
257
main (int argc, char **argv)
249 258
{
259
	int ch;
250 260
	setlocale (LC_ALL, "");
251 261

  
252
	av = argv + 1;
262
	while ((ch = getopt(argc, argv, "-")) != -1) {
263
		switch (ch) {
264
		default:
265
			usage();
266
			/* NOTREACED */
267
		}
268
	}
269
	argc -= optind;
270
	argv += optind;
271

  
272
	av = argv;
253 273

  
254 274
	yyparse ();
255 275