Put the sound stuff in alpabetic order.
[unix-history] / usr.bin / getopt / getopt.c
CommitLineData
7a2ca3d7
NW
1#include <stdio.h>
2
3main(argc, argv)
4int argc;
5char *argv[];
6{
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])) != EOF)
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}