1 /* <@LICENSE>
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to you under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * </@LICENSE>
17  */
18 
19 #ifndef REPLACE_GETOPT_H
20 #define REPLACE_GETOPT_H
21 
22 extern char *spamc_optarg;
23 extern int spamc_optreset;
24 extern int spamc_optind;
25 extern int spamc_opterr;
26 extern int spamc_optopt;
27 int spamc_getopt(int argc, char* const *argv, const char *optstr);
28 
29 struct option {
30 #if (defined __STDC__ && __STDC__) || defined __cplusplus
31    const char *name;
32 #else
33    char *name;
34 #endif
35    int has_arg;
36    int *flag;
37    int val;
38 };
39 
40 int spamc_getopt_long(int argc, char* const argv[], const char *optstring,
41       struct option *longopts, int *longindex);
42 
43 int spamc_getopt_long_only(int argc, char* const *argv, const char *optstr,
44       const struct option *longoptions, int *longopt);
45 
46 #define no_argument (0)
47 #define required_argument (1)
48 #define optional_argument (2)
49 
50 #endif /* REPLACE_GETOPT_H */
51