PostgreSQL Source Code: src/port/getopt.c Source File (original) (raw)
Go to the documentation of this file.
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#include "c.h"
33
35
36#if defined(LIBC_SCCS) && !defined(lint)
37static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
38#endif
39
40
41
42
43
44
45
46
47
48#ifndef HAVE_INT_OPTERR
49
54
55#endif
56
57#define BADCH (int)'?'
58#define BADARG (int)':'
59#define EMSG ""
60
61
62
63
64
65
66
67
68
69
70
71int
73{
75 const char *oli;
76
78 {
80 {
82 return -1;
83 }
85 {
88 return -1;
89 }
90 }
91 if ((optopt = (int) *place++) == (int) ':' ||
93 {
94
95
96
97 if (optopt == (int) '-')
98 {
100 return -1;
101 }
106 "illegal option -- %c\n", optopt);
108 }
109 if (*++oli != ':')
110 {
114 }
115 else
116 {
117 if (*place)
120 {
122 if (*ostr == ':')
126 "option requires an argument -- %c\n",
129 }
130 else
131
135 }
136 return optopt;
137}
#define fprintf(file, fmt, msg)
int getopt(int nargc, char *const *nargv, const char *ostr)