blob: ebae4516c14aacc03eacea480360bdad98d2c4fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef GETOPT_H
#define GETOPT_H
/* None of these constants are referenced in the executable portion of */
/* the code ... their sole purpose is to initialize global variables. */
/* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */
#define BADCH (int)'@'
#define NEEDSEP (int)':'
#define MAYBESEP (int)'%'
#define ERRFD 2
#define EMSG ""
#define START "-"
/* Conditionally print out an error message and return (depends on the */
/* setting of 'opterr' and 'opterrfd'). Note that this version of */
/* TELL() doesn't require the existence of stdio.h. */
/* """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" */
#define TELL(S) \
{ \
if (eopterr && eopterrfd >= 0) \
{ \
char option = (char)eoptopt; \
if (write(eopterrfd, (S), strlen(S))) \
; \
if (write(eopterrfd, &option, 1)) \
; \
if (write(eopterrfd, "\n", 1)) \
; \
} \
}
int
egetopt(int nargc, char ** nargv, char * ostr);
#endif
|