1 /* -*- buffer-read-only: t -*- vi: set ro: */ 2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3 /* Internal declarations for getopt. 4 Copyright (C) 1989-2019 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 General Public 10 License as published by the Free Software Foundation; either 11 version 3 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 General Public License for more details. 17 18 You should have received a copy of the GNU General Public 19 License along with the GNU C Library; if not, see 20 <https://www.gnu.org/licenses/>. */ 21 22 #ifndef _GETOPT_INT_H 23 #define _GETOPT_INT_H 1 24 25 #include <getopt.h> 26 27 extern int _getopt_internal (int ___argc, char **___argv, 28 const char *__shortopts, 29 const struct option *__longopts, int *__longind, 30 int __long_only, int __posixly_correct); 31 32 33 /* Reentrant versions which can handle parsing multiple argument 34 vectors at the same time. */ 35 36 /* Describe how to deal with options that follow non-option ARGV-elements. 37 38 REQUIRE_ORDER means don't recognize them as options; stop option 39 processing when the first non-option is seen. This is what POSIX 40 specifies should happen. 41 42 PERMUTE means permute the contents of ARGV as we scan, so that 43 eventually all the non-options are at the end. This allows options 44 to be given in any order, even with programs that were not written 45 to expect this. 46 47 RETURN_IN_ORDER is an option available to programs that were 48 written to expect options and other ARGV-elements in any order 49 and that care about the ordering of the two. We describe each 50 non-option ARGV-element as if it were the argument of an option 51 with character code 1. 52 53 The special argument '--' forces an end of option-scanning regardless 54 of the value of 'ordering'. In the case of RETURN_IN_ORDER, only 55 '--' can cause 'getopt' to return -1 with 'optind' != ARGC. */ 56 57 enum __ord 58 { 59 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER 60 }; 61 62 /* Data type for reentrant functions. */ 63 struct _getopt_data 64 { 65 /* These have exactly the same meaning as the corresponding global 66 variables, except that they are used for the reentrant 67 versions of getopt. */ 68 int optind; 69 int opterr; 70 int optopt; 71 char *optarg; 72 73 /* Internal members. */ 74 75 /* True if the internal members have been initialized. */ 76 int __initialized; 77 78 /* The next char to be scanned in the option-element 79 in which the last option character we returned was found. 80 This allows us to pick up the scan where we left off. 81 82 If this is zero, or a null string, it means resume the scan 83 by advancing to the next ARGV-element. */ 84 char *__nextchar; 85 86 /* See __ord above. */ 87 enum __ord __ordering; 88 89 /* Handle permutation of arguments. */ 90 91 /* Describe the part of ARGV that contains non-options that have 92 been skipped. 'first_nonopt' is the index in ARGV of the first 93 of them; 'last_nonopt' is the index after the last of them. */ 94 95 int __first_nonopt; 96 int __last_nonopt; 97 }; 98 99 /* The initializer is necessary to set OPTIND and OPTERR to their 100 default values and to clear the initialization flag. */ 101 #define _GETOPT_DATA_INITIALIZER { 1, 1 } 102 103 extern int _getopt_internal_r (int ___argc, char **___argv, 104 const char *__shortopts, 105 const struct option *__longopts, int *__longind, 106 int __long_only, struct _getopt_data *__data, 107 int __posixly_correct); 108 109 extern int _getopt_long_r (int ___argc, char **___argv, 110 const char *__shortopts, 111 const struct option *__longopts, int *__longind, 112 struct _getopt_data *__data); 113 114 extern int _getopt_long_only_r (int ___argc, char **___argv, 115 const char *__shortopts, 116 const struct option *__longopts, 117 int *__longind, 118 struct _getopt_data *__data); 119 120 #endif /* getopt_int.h */ 121