~ubuntu-branches/ubuntu/maverick/gettext/maverick

« back to all changes in this revision

Viewing changes to gettext-runtime/gnulib-lib/getopt_int.h

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Internal declarations for getopt.
2
 
   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
3
 
   Free Software Foundation, Inc.
 
2
   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2010 Free Software
 
3
   Foundation, Inc.
4
4
   This file is part of the GNU C Library.
5
5
 
6
6
   This program is free software: you can redistribute it and/or modify
17
17
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
18
 
19
19
#ifndef _GETOPT_INT_H
20
 
#define _GETOPT_INT_H   1
 
20
#define _GETOPT_INT_H   1
 
21
 
 
22
#include <getopt.h>
21
23
 
22
24
extern int _getopt_internal (int ___argc, char **___argv,
23
 
                             const char *__shortopts,
24
 
                             const struct option *__longopts, int *__longind,
25
 
                             int __long_only, int __posixly_correct);
 
25
                             const char *__shortopts,
 
26
                             const struct option *__longopts, int *__longind,
 
27
                             int __long_only, int __posixly_correct);
26
28
 
27
29
 
28
30
/* Reentrant versions which can handle parsing multiple argument
29
31
   vectors at the same time.  */
30
32
 
 
33
/* Describe how to deal with options that follow non-option ARGV-elements.
 
34
 
 
35
   If the caller did not specify anything,
 
36
   the default is REQUIRE_ORDER if the environment variable
 
37
   POSIXLY_CORRECT is defined, PERMUTE otherwise.
 
38
 
 
39
   REQUIRE_ORDER means don't recognize them as options;
 
40
   stop option processing when the first non-option is seen.
 
41
   This is what Unix does.
 
42
   This mode of operation is selected by either setting the environment
 
43
   variable POSIXLY_CORRECT, or using `+' as the first character
 
44
   of the list of option characters, or by calling getopt.
 
45
 
 
46
   PERMUTE is the default.  We permute the contents of ARGV as we
 
47
   scan, so that eventually all the non-options are at the end.
 
48
   This allows options to be given in any order, even with programs
 
49
   that were not written to expect this.
 
50
 
 
51
   RETURN_IN_ORDER is an option available to programs that were
 
52
   written to expect options and other ARGV-elements in any order
 
53
   and that care about the ordering of the two.  We describe each
 
54
   non-option ARGV-element as if it were the argument of an option
 
55
   with character code 1.  Using `-' as the first character of the
 
56
   list of option characters selects this mode of operation.
 
57
 
 
58
   The special argument `--' forces an end of option-scanning regardless
 
59
   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
 
60
   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
 
61
 
 
62
enum __ord
 
63
  {
 
64
    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
 
65
  };
 
66
 
31
67
/* Data type for reentrant functions.  */
32
68
struct _getopt_data
33
69
{
52
88
     by advancing to the next ARGV-element.  */
53
89
  char *__nextchar;
54
90
 
55
 
  /* Describe how to deal with options that follow non-option ARGV-elements.
56
 
 
57
 
     If the caller did not specify anything,
58
 
     the default is REQUIRE_ORDER if the environment variable
59
 
     POSIXLY_CORRECT is defined, PERMUTE otherwise.
60
 
 
61
 
     REQUIRE_ORDER means don't recognize them as options;
62
 
     stop option processing when the first non-option is seen.
63
 
     This is what Unix does.
64
 
     This mode of operation is selected by either setting the environment
65
 
     variable POSIXLY_CORRECT, or using `+' as the first character
66
 
     of the list of option characters, or by calling getopt.
67
 
 
68
 
     PERMUTE is the default.  We permute the contents of ARGV as we
69
 
     scan, so that eventually all the non-options are at the end.
70
 
     This allows options to be given in any order, even with programs
71
 
     that were not written to expect this.
72
 
 
73
 
     RETURN_IN_ORDER is an option available to programs that were
74
 
     written to expect options and other ARGV-elements in any order
75
 
     and that care about the ordering of the two.  We describe each
76
 
     non-option ARGV-element as if it were the argument of an option
77
 
     with character code 1.  Using `-' as the first character of the
78
 
     list of option characters selects this mode of operation.
79
 
 
80
 
     The special argument `--' forces an end of option-scanning regardless
81
 
     of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
82
 
     `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
83
 
 
84
 
  enum
85
 
    {
86
 
      REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
87
 
    } __ordering;
 
91
  /* See __ord above.  */
 
92
  enum __ord __ordering;
88
93
 
89
94
  /* If the POSIXLY_CORRECT environment variable is set
90
95
     or getopt was called.  */
108
113
 
109
114
/* The initializer is necessary to set OPTIND and OPTERR to their
110
115
   default values and to clear the initialization flag.  */
111
 
#define _GETOPT_DATA_INITIALIZER        { 1, 1 }
 
116
#define _GETOPT_DATA_INITIALIZER        { 1, 1 }
112
117
 
113
118
extern int _getopt_internal_r (int ___argc, char **___argv,
114
 
                               const char *__shortopts,
115
 
                               const struct option *__longopts, int *__longind,
116
 
                               int __long_only, int __posixly_correct,
117
 
                               struct _getopt_data *__data);
 
119
                               const char *__shortopts,
 
120
                               const struct option *__longopts, int *__longind,
 
121
                               int __long_only, struct _getopt_data *__data,
 
122
                               int __posixly_correct);
118
123
 
119
124
extern int _getopt_long_r (int ___argc, char **___argv,
120
 
                           const char *__shortopts,
121
 
                           const struct option *__longopts, int *__longind,
122
 
                           struct _getopt_data *__data);
 
125
                           const char *__shortopts,
 
126
                           const struct option *__longopts, int *__longind,
 
127
                           struct _getopt_data *__data);
123
128
 
124
129
extern int _getopt_long_only_r (int ___argc, char **___argv,
125
 
                                const char *__shortopts,
126
 
                                const struct option *__longopts,
127
 
                                int *__longind,
128
 
                                struct _getopt_data *__data);
 
130
                                const char *__shortopts,
 
131
                                const struct option *__longopts,
 
132
                                int *__longind,
 
133
                                struct _getopt_data *__data);
129
134
 
130
135
#endif /* getopt_int.h */