ReactOS 0.4.15-dev-7842-g558ab78
getopt_core.h
Go to the documentation of this file.
1/* Declarations for getopt (basic, portable features only).
2 Copyright (C) 1989-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library and is also part of gnulib.
4 Patches to this file should be submitted to both projects.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20#ifndef _GETOPT_CORE_H
21#define _GETOPT_CORE_H 1
22
23/* This header should not be used directly; include getopt.h or
24 unistd.h instead. Unlike most bits headers, it does not have
25 a protective #error, because the guard macro for getopt.h in
26 gnulib is not fixed. */
27
28/* For communication from 'getopt' to the caller.
29 When 'getopt' finds an option that takes an argument,
30 the argument value is returned here.
31 Also, when 'ordering' is RETURN_IN_ORDER,
32 each non-option ARGV-element is returned here. */
33
34extern char *optarg;
35
36/* Index in ARGV of the next element to be scanned.
37 This is used for communication to and from the caller
38 and for communication between successive calls to 'getopt'.
39
40 On entry to 'getopt', zero means this is the first call; initialize.
41
42 When 'getopt' returns -1, this is the index of the first of the
43 non-option elements that the caller should itself scan.
44
45 Otherwise, 'optind' communicates from one call to the next
46 how much of ARGV has been scanned so far. */
47
48extern int optind;
49
50/* Callers store zero here to inhibit the error message 'getopt' prints
51 for unrecognized options. */
52
53extern int opterr;
54
55/* Set to an option character which was unrecognized. */
56
57extern int optopt;
58
59/* Get definitions and prototypes for functions to process the
60 arguments in ARGV (ARGC of them, minus the program name) for
61 options given in OPTS.
62
63 Return the option character from OPTS just read. Return -1 when
64 there are no more options. For unrecognized options, or options
65 missing arguments, 'optopt' is set to the option letter, and '?' is
66 returned.
67
68 The OPTS string is a list of characters which are recognized option
69 letters, optionally followed by colons, specifying that that letter
70 takes an argument, to be placed in 'optarg'.
71
72 If a letter in OPTS is followed by two colons, its argument is
73 optional. This behavior is specific to the GNU 'getopt'.
74
75 The argument '--' causes premature termination of argument
76 scanning, explicitly telling 'getopt' that there are no more
77 options.
78
79 If OPTS begins with '-', then non-option arguments are treated as
80 arguments to the option '\1'. This behavior is specific to the GNU
81 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
82 the environment, then do not permute arguments.
83
84 For standards compliance, the 'argv' argument has the type
85 char *const *, but this is inaccurate; if argument permutation is
86 enabled, the argv array (not the strings it points to) must be
87 writable. */
88
89extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
90
91#endif /* getopt_core.h */
int optopt
Definition: getopt.c:48
int optind
Definition: getopt.c:47
char * optarg
Definition: getopt.c:49
int opterr
Definition: getopt.c:46
int getopt(int ___argc, char *const *___argv, const char *__shortopts)
Definition: getopt.c:55