Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / builtins / getopt.h
1 /* Declarations for getopt.
2    Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify it
5    under the terms of the GNU General Public License as published by the
6    Free Software Foundation; either version 2, or (at your option) any
7    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, 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18 /* XXX THIS HAS BEEN MODIFIED FOR INCORPORATION INTO BASH XXX */
19
20 #ifndef _GETOPT_H
21 #define _GETOPT_H 1
22
23 /* For communication from `getopt' to the caller.
24    When `getopt' finds an option that takes an argument,
25    the argument value is returned here.
26    Also, when `ordering' is RETURN_IN_ORDER,
27    each non-option ARGV-element is returned here.  */
28
29 extern char *sh_optarg;
30
31 /* Index in ARGV of the next element to be scanned.
32    This is used for communication to and from the caller
33    and for communication between successive calls to `getopt'.
34
35    On entry to `getopt', zero means this is the first call; initialize.
36
37    When `getopt' returns EOF, this is the index of the first of the
38    non-option elements that the caller should itself scan.
39
40    Otherwise, `sh_optind' communicates from one call to the next
41    how much of ARGV has been scanned so far.  */
42
43 extern int sh_optind;
44
45 /* Callers store zero here to inhibit the error message `getopt' prints
46    for unrecognized options.  */
47
48 extern int sh_opterr;
49
50 /* Set to an option character which was unrecognized.  */
51
52 extern int sh_optopt;
53
54 /* Set to 1 when an unrecognized option is encountered. */
55 extern int sh_badopt;
56
57 extern int sh_getopt ();
58 extern void sh_getopt_restore_state ();
59
60 #endif /* _GETOPT_H */