Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 1 | /* getopt.h - declarations for getopt. */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 2 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 3 | /* Copyright (C) 1989, 1990, 1991, 1992, 1993, 2008,2009 Free Software Foundation, Inc. |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 4 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 5 | This file is part of GNU Bash, the Bourne Again SHell. |
| 6 | |
| 7 | Bash is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | Bash is distributed in the hope that it will be useful, |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 20 | |
| 21 | /* XXX THIS HAS BEEN MODIFIED FOR INCORPORATION INTO BASH XXX */ |
| 22 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 23 | #ifndef _SH_GETOPT_H |
| 24 | #define _SH_GETOPT_H 1 |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 25 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 26 | #include "stdc.h" |
| 27 | |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 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 | |
| 34 | extern char *sh_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 EOF, this is the index of the first of the |
| 43 | non-option elements that the caller should itself scan. |
| 44 | |
| 45 | Otherwise, `sh_optind' communicates from one call to the next |
| 46 | how much of ARGV has been scanned so far. */ |
| 47 | |
| 48 | extern int sh_optind; |
| 49 | |
| 50 | /* Callers store zero here to inhibit the error message `getopt' prints |
| 51 | for unrecognized options. */ |
| 52 | |
| 53 | extern int sh_opterr; |
| 54 | |
| 55 | /* Set to an option character which was unrecognized. */ |
| 56 | |
| 57 | extern int sh_optopt; |
| 58 | |
Jari Aalto | ccc6cda | 1996-12-23 17:02:34 +0000 | [diff] [blame] | 59 | /* Set to 1 when an unrecognized option is encountered. */ |
| 60 | extern int sh_badopt; |
| 61 | |
Jari Aalto | f73dda0 | 2001-11-13 17:56:06 +0000 | [diff] [blame] | 62 | extern int sh_getopt __P((int, char *const *, const char *)); |
| 63 | extern void sh_getopt_restore_state __P((char **)); |
Jari Aalto | 726f638 | 1996-08-26 18:22:31 +0000 | [diff] [blame] | 64 | |
Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 65 | #endif /* _SH_GETOPT_H */ |