| 1 | /* declarations for getopt |
| 2 | Copyright (C) 1989 Free Software Foundation, Inc. |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation; either version 1, or (at your option) |
| 7 | any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
| 17 | |
| 18 | /* For communication from `getopt' to the caller. |
| 19 | When `getopt' finds an option that takes an argument, |
| 20 | the argument value is returned here. |
| 21 | Also, when `ordering' is RETURN_IN_ORDER, |
| 22 | each non-option ARGV-element is returned here. */ |
| 23 | |
| 24 | extern char *optarg; |
| 25 | |
| 26 | /* Index in ARGV of the next element to be scanned. |
| 27 | This is used for communication to and from the caller |
| 28 | and for communication between successive calls to `getopt'. |
| 29 | |
| 30 | On entry to `getopt', zero means this is the first call; initialize. |
| 31 | |
| 32 | When `getopt' returns EOF, this is the index of the first of the |
| 33 | non-option elements that the caller should itself scan. |
| 34 | |
| 35 | Otherwise, `optind' communicates from one call to the next |
| 36 | how much of ARGV has been scanned so far. */ |
| 37 | |
| 38 | extern int optind; |
| 39 | |
| 40 | /* Callers store zero here to inhibit the error message `getopt' prints |
| 41 | for unrecognized options. */ |
| 42 | |
| 43 | extern int opterr; |
| 44 | |
| 45 | /* Describe the long-named options requested by the application. |
| 46 | _GETOPT_LONG_OPTIONS is a vector of `struct option' terminated by an |
| 47 | element containing a name which is zero. |
| 48 | The field `has_arg' is: |
| 49 | 0 if the option does not take an argument, |
| 50 | 1 if the option requires an argument, |
| 51 | 2 if the option takes an optional argument. |
| 52 | If the field `flag' is nonzero, it points to a variable that is set to |
| 53 | the value given in the field `val' when the option is found, but |
| 54 | left unchanged if the option is not found. */ |
| 55 | |
| 56 | struct option |
| 57 | { |
| 58 | char *name; |
| 59 | int has_arg; |
| 60 | int *flag; |
| 61 | int val; |
| 62 | }; |
| 63 | |
| 64 | extern struct option *_getopt_long_options; |
| 65 | |
| 66 | /* Name of long-named option actually found. |
| 67 | Only changed when a long-named option is found. */ |
| 68 | |
| 69 | extern char *_getopt_option_name; |
| 70 | |
| 71 | /* The index in GETOPT_LONG_OPTIONS of the long-named option found. |
| 72 | Only valid when a long-named option has been found by the most |
| 73 | recent call to `getopt'. */ |
| 74 | |
| 75 | extern int option_index; |
| 76 | |