Mercurial > hg > xemacs-beta
comparison lib-src/getopt.h @ 155:43dd3413c7c7 r20-3b4
Import from CVS: tag r20-3b4
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:39:39 +0200 |
parents | 376386a54a3c |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
154:94141801dd7e | 155:43dd3413c7c7 |
---|---|
1 /* Declarations for getopt. | 1 /* Declarations for getopt. |
2 Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. | 2 Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. |
3 | 3 |
4 This program is free software; you can redistribute it and/or modify it | 4 NOTE: The canonical source of this file is maintained with the GNU C Library. |
5 under the terms of the GNU General Public License as published by the | 5 Bugs can be reported to bug-glibc@prep.ai.mit.edu. |
6 Free Software Foundation; either version 2, or (at your option) any | |
7 later version. | |
8 | 6 |
9 This program is distributed in the hope that it will be useful, | 7 This program is free software; you can redistribute it and/or modify it |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 under the terms of the GNU General Public License as published by the |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 Free Software Foundation; either version 2, or (at your option) any |
12 GNU General Public License for more details. | 10 later version. |
13 | 11 |
14 You should have received a copy of the GNU General Public License | 12 This program is distributed in the hope that it will be useful, |
15 along with this program; see the file COPYING. If not, write to | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 Boston, MA 02111-1307, USA. */ | 15 GNU General Public License for more details. |
18 | 16 |
19 /* Synched up with: FSF 19.29. */ | 17 You should have received a copy of the GNU General Public License |
18 along with this program; if not, write to the Free Software | |
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
20 USA. */ | |
20 | 21 |
21 #ifndef _GETOPT_H | 22 #ifndef _GETOPT_H |
22 #define _GETOPT_H 1 | 23 #define _GETOPT_H 1 |
23 | 24 |
24 #ifdef __cplusplus | 25 #ifdef __cplusplus |
37 This is used for communication to and from the caller | 38 This is used for communication to and from the caller |
38 and for communication between successive calls to `getopt'. | 39 and for communication between successive calls to `getopt'. |
39 | 40 |
40 On entry to `getopt', zero means this is the first call; initialize. | 41 On entry to `getopt', zero means this is the first call; initialize. |
41 | 42 |
42 When `getopt' returns EOF, this is the index of the first of the | 43 When `getopt' returns -1, this is the index of the first of the |
43 non-option elements that the caller should itself scan. | 44 non-option elements that the caller should itself scan. |
44 | 45 |
45 Otherwise, `optind' communicates from one call to the next | 46 Otherwise, `optind' communicates from one call to the next |
46 how much of ARGV has been scanned so far. */ | 47 how much of ARGV has been scanned so far. */ |
47 | 48 |
77 one). For long options that have a zero `flag' field, `getopt' | 78 one). For long options that have a zero `flag' field, `getopt' |
78 returns the contents of the `val' field. */ | 79 returns the contents of the `val' field. */ |
79 | 80 |
80 struct option | 81 struct option |
81 { | 82 { |
82 #if defined (__STDC__) && __STDC__ || defined (STDC_HEADERS) | 83 #if defined (__STDC__) && __STDC__ |
83 const char *name; | 84 const char *name; |
84 #else | 85 #else |
85 char *name; | 86 char *name; |
86 #endif | 87 #endif |
87 /* has_arg can't be an enum because some compilers complain about | 88 /* has_arg can't be an enum because some compilers complain about |
95 | 96 |
96 #define no_argument 0 | 97 #define no_argument 0 |
97 #define required_argument 1 | 98 #define required_argument 1 |
98 #define optional_argument 2 | 99 #define optional_argument 2 |
99 | 100 |
100 #if defined (__STDC__) && __STDC__ || defined (STDC_HEADERS) | 101 #if defined (__STDC__) && __STDC__ |
101 #ifdef __GNU_LIBRARY__ | 102 #ifdef __GNU_LIBRARY__ |
102 /* Many other libraries have conflicting prototypes for getopt, with | 103 /* Many other libraries have conflicting prototypes for getopt, with |
103 differences in the consts, in stdlib.h. To avoid compilation | 104 differences in the consts, in stdlib.h. To avoid compilation |
104 errors, only prototype getopt for the GNU C library. */ | 105 errors, only prototype getopt for the GNU C library. */ |
105 extern int getopt (int argc, char *const *argv, const char *shortopts); | 106 extern int getopt (int argc, char *const *argv, const char *shortopts); |