Deleted Added
full compact
getopt.c (45279) getopt.c (65428)
1/* $FreeBSD: head/usr.bin/getopt/getopt.c 65428 2000-09-04 06:09:54Z imp $ */
2
1#include <stdio.h>
3#include <stdio.h>
4#include <unistd.h>
2
3main(argc, argv)
4int argc;
5char *argv[];
6{
5
6main(argc, argv)
7int argc;
8char *argv[];
9{
7 extern int optind;
8 extern char *optarg;
9 int c;
10 int status = 0;
11
12 optind = 2; /* Past the program name and the option letters. */
13 while ((c = getopt(argc, argv, argv[1])) != -1)
14 switch (c) {
15 case '?':
16 status = 1; /* getopt routine gave message */
17 break;
18 default:
19 if (optarg != NULL)
20 printf(" -%c %s", c, optarg);
21 else
22 printf(" -%c", c);
23 break;
24 }
25 printf(" --");
26 for (; optind < argc; optind++)
27 printf(" %s", argv[optind]);
28 printf("\n");
29 exit(status);
30}
10 int c;
11 int status = 0;
12
13 optind = 2; /* Past the program name and the option letters. */
14 while ((c = getopt(argc, argv, argv[1])) != -1)
15 switch (c) {
16 case '?':
17 status = 1; /* getopt routine gave message */
18 break;
19 default:
20 if (optarg != NULL)
21 printf(" -%c %s", c, optarg);
22 else
23 printf(" -%c", c);
24 break;
25 }
26 printf(" --");
27 for (; optind < argc; optind++)
28 printf(" %s", argv[optind]);
29 printf("\n");
30 exit(status);
31}