~bratsche/vlc/vlc-notify-add-actions-with-server-support

« back to all changes in this revision

Viewing changes to src/extras/getopt.h

  • Committer: Bazaar Package Importer
  • Date: 2008-11-28 09:41:28 UTC
  • Revision ID: jamesw@ubuntu.com-20081128094128-qc1zhxqwlf2ov8cl
Tags: upstream-ubuntu-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#ifndef _GETOPT_H
23
23
#define _GETOPT_H 1
24
24
 
25
 
#ifdef  __cplusplus
 
25
#ifdef    __cplusplus
26
26
extern "C"
27
27
{
28
28
#endif
33
33
   Also, when `ordering' is RETURN_IN_ORDER,
34
34
   each non-option ARGV-element is returned here.  */
35
35
 
36
 
        extern char *optarg;
 
36
    extern char *optarg;
37
37
 
38
38
/* Index in ARGV of the next element to be scanned.
39
39
   This is used for communication to and from the caller
47
47
   Otherwise, `optind' communicates from one call to the next
48
48
   how much of ARGV has been scanned so far.  */
49
49
 
50
 
        extern int optind;
 
50
    extern int optind;
51
51
 
52
52
/* Callers store zero here to inhibit the error message `getopt' prints
53
53
   for unrecognized options.  */
54
54
 
55
 
        extern int opterr;
 
55
    extern int opterr;
56
56
 
57
57
/* Set to an option character which was unrecognized.  */
58
58
 
59
 
        extern int optopt;
 
59
    extern int optopt;
60
60
 
61
61
/* Describe the long-named options requested by the application.
62
62
   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
79
79
   one).  For long options that have a zero `flag' field, `getopt'
80
80
   returns the contents of the `val' field.  */
81
81
 
82
 
        struct option
83
 
        {
 
82
    struct option
 
83
    {
84
84
#if defined (__STDC__) && __STDC__
85
 
                const char *name;
 
85
        const char *name;
86
86
#else
87
 
                char *name;
 
87
        char *name;
88
88
#endif
89
 
                /* has_arg can't be an enum because some compilers complain about
90
 
                   type mismatches in all the code that assumes it is an int.  */
91
 
                int has_arg;
92
 
                int *flag;
93
 
                int val;
94
 
        };
 
89
        /* has_arg can't be an enum because some compilers complain about
 
90
           type mismatches in all the code that assumes it is an int.  */
 
91
        int has_arg;
 
92
        int *flag;
 
93
        int val;
 
94
    };
95
95
 
96
96
/* Names for the values of the `has_arg' field of `struct option'.  */
97
97
 
98
 
#define no_argument             0
99
 
#define required_argument       1
100
 
#define optional_argument       2
 
98
#define    no_argument        0
 
99
#define required_argument    1
 
100
#define optional_argument    2
101
101
 
102
102
#if defined (__STDC__) && __STDC__
103
103
#ifdef __GNU_LIBRARY__
104
104
/* Many other libraries have conflicting prototypes for getopt, with
105
105
   differences in the consts, in stdlib.h.  To avoid compilation
106
106
   errors, only prototype getopt for the GNU C library.  */
107
 
        extern int getopt(int argc, char *const *argv, const char *shortopts);
108
 
#else                           /* not __GNU_LIBRARY__ */
109
 
        extern int getopt();
110
 
#endif                          /* __GNU_LIBRARY__ */
111
 
        extern int getopt_long(int argc, char *const *argv, const char *shortopts,
112
 
                               const struct option *longopts, int *longind);
113
 
        extern int getopt_long_only(int argc, char *const *argv,
114
 
                                    const char *shortopts,
115
 
                               const struct option *longopts, int *longind);
 
107
    extern int getopt(int argc, char *const *argv, const char *shortopts);
 
108
#else                /* not __GNU_LIBRARY__ */
 
109
    extern int getopt();
 
110
#endif                /* __GNU_LIBRARY__ */
 
111
    extern int getopt_long(int argc, char *const *argv, const char *shortopts,
 
112
                   const struct option *longopts, int *longind);
 
113
    extern int getopt_long_only(int argc, char *const *argv,
 
114
                    const char *shortopts,
 
115
                   const struct option *longopts, int *longind);
116
116
 
117
117
/* Internal only.  Users should not call this directly.  */
118
 
        extern int _getopt_internal(int argc, char *const *argv,
119
 
                                    const char *shortopts,
120
 
                                const struct option *longopts, int *longind,
121
 
                                    int long_only);
122
 
#else                           /* not __STDC__ */
123
 
        extern int getopt();
124
 
        extern int getopt_long();
125
 
        extern int getopt_long_only();
126
 
 
127
 
        extern int _getopt_internal();
128
 
#endif                          /* __STDC__ */
129
 
 
130
 
#ifdef  __cplusplus
 
118
    extern int _getopt_internal(int argc, char *const *argv,
 
119
                    const char *shortopts,
 
120
                const struct option *longopts, int *longind,
 
121
                    int long_only);
 
122
#else                /* not __STDC__ */
 
123
    extern int getopt();
 
124
    extern int getopt_long();
 
125
    extern int getopt_long_only();
 
126
 
 
127
    extern int _getopt_internal();
 
128
#endif                /* __STDC__ */
 
129
 
 
130
#ifdef    __cplusplus
131
131
}
132
132
#endif
133
133
 
134
 
#endif                          /* _GETOPT_H */
 
134
#endif                /* _GETOPT_H */