HuntnGather – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /************************************************************************* |
2 | * getopt.h: Header file for using getopt(). |
||
3 | * Author: Daniel J. Barrett, barrett@cs.umass.edu |
||
4 | * Status: Public domain. |
||
5 | *************************************************************************/ |
||
6 | |||
7 | |||
8 | #ifndef _GETOPT_H /* Insure we #include me only once. */ |
||
9 | #define _GETOPT_H 1 |
||
10 | |||
11 | |||
12 | /************************************************************************* |
||
13 | * optarg |
||
14 | * This variable is READ-ONLY! Do not set its value yourself! |
||
15 | * |
||
16 | * If an option must be followed by a string, then optarg is a pointer |
||
17 | * to that string. |
||
18 | * |
||
19 | * If an option should NOT be followed by an string, then optarg is |
||
20 | * NOT DEFINED. It is an error to reference optarg if no argument is |
||
21 | * expected. |
||
22 | *************************************************************************/ |
||
23 | |||
24 | extern char *optarg; |
||
25 | |||
26 | /************************************************************************* |
||
27 | * optind |
||
28 | * This variable is READ-ONLY! Do not set its value yourself! |
||
29 | * |
||
30 | * After getopt() returns EOF, this variable contains the index of the |
||
31 | * next unprocessed command-line argument. |
||
32 | * |
||
33 | * That is, argv[optind] is the first argument AFTER the options. |
||
34 | * |
||
35 | * If optind == argc-1, then there are no arguments after the options. |
||
36 | *************************************************************************/ |
||
37 | |||
38 | extern int optind; |
||
39 | |||
40 | /************************************************************************* |
||
41 | * optopt |
||
42 | * This variable is READ-ONLY! Do not set its value yourself! |
||
43 | * |
||
44 | * After each call of getopt(), this variable contains the option character |
||
45 | * which was found on this call. |
||
46 | * |
||
47 | * Normally, you do not need to examine this variable because getopt() |
||
48 | * returns the value of the character it read. |
||
49 | * However, when getopt() discovers an illegal option, it returns the |
||
50 | * character '?'. You now examine optopt to find the actual character |
||
51 | * which getopt() read. |
||
52 | *************************************************************************/ |
||
53 | |||
54 | extern int optopt; |
||
55 | |||
56 | /************************************************************************* |
||
57 | * opterr |
||
58 | * This variable is READ/WRITE. You may set its value yourself. |
||
59 | * |
||
60 | * If opterr != 0, then getopt() will print its own error messages |
||
61 | * on standard error (stderr). Error messages are of the form: |
||
62 | * |
||
63 | * -x: Illegal option. |
||
64 | * -x: An argument is required, but missing. |
||
65 | * |
||
66 | * assuming that the illegal option "-x" was read by getopt(). |
||
67 | * |
||
68 | * If opterr == 0, these error messages are suppressed. |
||
69 | * |
||
70 | * By default, opterr == 1, meaning that error messages are printed. |
||
71 | *************************************************************************/ |
||
72 | |||
73 | extern int opterr; |
||
74 | |||
75 | /************************************************************************* |
||
76 | * getopt() |
||
77 | * The function prototype. |
||
78 | *************************************************************************/ |
||
79 | |||
80 | |||
81 | #ifdef __STDC__ |
||
82 | int getopt(int argc, char *argv[], char *optionString); |
||
83 | #else |
||
84 | int getopt(); |
||
85 | #endif /* __STDC__ */ |
||
86 | |||
87 | |||
88 | #endif /* _GETOPT_H */ |