Disable background bitmap writes. They appear to cause at least two race
[dragonfly.git] / usr.bin / getopt / getopt.c
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.3 2003/10/04 20:36:45 hmp Exp $ */
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <unistd.h>
7
8 main(int argc, char **argv)
9 {
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 }