source: trunk/diffutils/lib/getopt.h@ 2603

Last change on this file since 2603 was 2556, checked in by bird, 20 years ago

diffutils 2.8.1

File size: 6.2 KB
Line 
1/* Declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
19#ifndef _GETOPT_H
20
21#ifndef __need_getopt
22# define _GETOPT_H 1
23#endif
24
25/* If __GNU_LIBRARY__ is not already defined, either we are being used
26 standalone, or this is the first header included in the source file.
27 If we are being used with glibc, we need to include <features.h>, but
28 that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
29 not defined, include <ctype.h>, which will pull in <features.h> for us
30 if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
31 doesn't flood the namespace with stuff the way some other headers do.) */
32#if !defined __GNU_LIBRARY__
33# include <ctype.h>
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* For communication from `getopt' to the caller.
41 When `getopt' finds an option that takes an argument,
42 the argument value is returned here.
43 Also, when `ordering' is RETURN_IN_ORDER,
44 each non-option ARGV-element is returned here. */
45
46extern char *optarg;
47
48/* Index in ARGV of the next element to be scanned.
49 This is used for communication to and from the caller
50 and for communication between successive calls to `getopt'.
51
52 On entry to `getopt', zero means this is the first call; initialize.
53
54 When `getopt' returns -1, this is the index of the first of the
55 non-option elements that the caller should itself scan.
56
57 Otherwise, `optind' communicates from one call to the next
58 how much of ARGV has been scanned so far. */
59
60extern int optind;
61
62/* Callers store zero here to inhibit the error message `getopt' prints
63 for unrecognized options. */
64
65extern int opterr;
66
67/* Set to an option character which was unrecognized. */
68