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