inpcb: Use netisr_ncpus for listing inpcbs.
[dragonfly.git] / usr.bin / getopt / getopt.c
blob0d40e7c21d6f528ceb87c550b6372a502c507d65
1 /* $FreeBSD: src/usr.bin/getopt/getopt.c,v 1.4.2.2 2001/07/30 10:16:38 dd Exp $ */
2 /* $DragonFly: src/usr.bin/getopt/getopt.c,v 1.4 2004/10/23 13:33:36 eirikn Exp $ */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <unistd.h>
8 int
9 main(int argc, char **argv)
11 int c;
12 int status = 0;
14 optind = 2; /* Past the program name and the option letters. */
15 while ((c = getopt(argc, argv, argv[1])) != -1)
16 switch (c) {
17 case '?':
18 status = 1; /* getopt routine gave message */
19 break;
20 default:
21 if (optarg != NULL)
22 printf(" -%c %s", c, optarg);
23 else
24 printf(" -%c", c);
25 break;
27 printf(" --");
28 for (; optind < argc; optind++)
29 printf(" %s", argv[optind]);
30 printf("\n");
31 return(status);