648e0f2f5d2e1962077a040719c119c2c0a5e3fa
[platform/core/uifw/dali-adaptor.git] / dali-windows-backend / ExInclude / getopt.h
1 /* Declarations for getopt.\r
2    Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.\r
3 \r
4    This program is free software; you can redistribute it and/or modify it\r
5    under the terms of the GNU General Public License as published by the\r
6    Free Software Foundation; either version 2, or (at your option) any\r
7    later version.\r
8 \r
9    This program is distributed in the hope that it will be useful,\r
10    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
12    GNU General Public License for more details.\r
13 \r
14    You should have received a copy of the GNU General Public License\r
15    along with this program; if not, write to the Free Software\r
16    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */\r
17 \r
18 #ifndef _GETOPT_H\r
19 #define _GETOPT_H 1\r
20 \r
21 #ifdef  __cplusplus\r
22 extern "C" {\r
23 #endif\r
24 \r
25 /* For communication from `getopt' to the caller.\r
26    When `getopt' finds an option that takes an argument,\r
27    the argument value is returned here.\r
28    Also, when `ordering' is RETURN_IN_ORDER,\r
29    each non-option ARGV-element is returned here.  */\r
30 \r
31 extern char *optarg;\r
32 \r
33 /* Index in ARGV of the next element to be scanned.\r
34    This is used for communication to and from the caller\r
35    and for communication between successive calls to `getopt'.\r
36 \r
37    On entry to `getopt', zero means this is the first call; initialize.\r
38 \r
39    When `getopt' returns EOF, this is the index of the first of the\r
40    non-option elements that the caller should itself scan.\r
41 \r
42    Otherwise, `optind' communicates from one call to the next\r
43    how much of ARGV has been scanned so far.  */\r
44 \r
45 extern int optind;\r
46 \r
47 /* Callers store zero here to inhibit the error message `getopt' prints\r
48    for unrecognized options.  */\r
49 \r
50 extern int opterr;\r
51 \r
52 /* Set to an option character which was unrecognized.  */\r
53 \r
54 extern int optopt;\r
55 \r
56 /* Describe the long-named options requested by the application.\r
57    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector\r
58    of `struct option' terminated by an element containing a name which is\r
59    zero.\r
60 \r
61    The field `has_arg' is:\r
62    no_argument          (or 0) if the option does not take an argument,\r
63    required_argument    (or 1) if the option requires an argument,\r
64    optional_argument    (or 2) if the option takes an optional argument.\r
65 \r
66    If the field `flag' is not NULL, it points to a variable that is set\r
67    to the value given in the field `val' when the option is found, but\r
68    left unchanged if the option is not found.\r
69 \r
70    To have a long-named option do something other than set an `int' to\r
71    a compiled-in constant, such as set a value from `optarg', set the\r
72    option's `flag' field to zero and its `val' field to a nonzero\r
73    value (the equivalent single-letter option character, if there is\r
74    one).  For long options that have a zero `flag' field, `getopt'\r
75    returns the contents of the `val' field.  */\r
76 \r
77 struct option\r
78 {\r
79   const char *name;\r
80   /* has_arg can't be an enum because some compilers complain about\r
81      type mismatches in all the code that assumes it is an int.  */\r
82   int has_arg;\r
83   int *flag;\r
84   int val;\r
85 };\r
86 \r
87 /* Names for the values of the `has_arg' field of `struct option'.  */\r
88 \r
89 #define no_argument             0\r
90 #define required_argument       1\r
91 #define optional_argument       2\r
92 \r
93 //#if __STDC__ || defined(PROTO)\r
94 //#if defined(__GNU_LIBRARY__)\r
95 /* Many other libraries have conflicting prototypes for getopt, with\r
96    differences in the consts, in stdlib.h.  To avoid compilation\r
97    errors, only prototype getopt for the GNU C library.  */\r
98 extern int getopt (int argc, char *const *argv, const char *shortopts);\r
99 //#endif /* not __GNU_LIBRARY__ */\r
100 extern int getopt_long (int argc, char *const *argv, const char *shortopts,\r
101                         const struct option *longopts, int *longind);\r
102 extern int getopt_long_only (int argc, char *const *argv,\r
103                              const char *shortopts,\r
104                              const struct option *longopts, int *longind);\r
105 \r
106 /* Internal only.  Users should not call this directly.  */\r
107 /* extern int _getopt_internal (int argc, char *const *argv,\r
108                              const char *shortopts,\r
109                              const struct option *longopts, int *longind,\r
110                              int long_only); */\r
111 //#else /* not __STDC__ */\r
112 //extern int getopt ();\r
113 //extern int getopt_long ();\r
114 //extern int getopt_long_only ();\r
115 \r
116 //extern int _getopt_internal ();\r
117 //#endif /* not __STDC__ */\r
118 \r
119 #ifdef  __cplusplus\r
120 }\r
121 #endif\r
122 \r
123 #endif /* _GETOPT_H */\r
124 \r