aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman2002-12-04 11:08:06 +0000
committerRichard M. Stallman2002-12-04 11:08:06 +0000
commite1e86c97c5c263835e7245ef9c221519ec234128 (patch)
treeb302131ad63f515f1097d55d744c3c1eca4b7739 /lib-src
parent062b24bf7876f8b955a51713938e3aa9f13c260e (diff)
downloademacs-e1e86c97c5c263835e7245ef9c221519ec234128.tar.gz
emacs-e1e86c97c5c263835e7245ef9c221519ec234128.zip
Maybe include ctype.h.
Treat __cplusplus like __STDC__. (decls): Use __ in arg names.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/getopt.h45
1 files changed, 28 insertions, 17 deletions
diff --git a/lib-src/getopt.h b/lib-src/getopt.h
index ba24c14ba44..4d6adeea0d6 100644
--- a/lib-src/getopt.h
+++ b/lib-src/getopt.h
@@ -1,21 +1,20 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. 2 Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
3 NOTE: The canonical source of this file is maintained with the GNU C Library. 3 This file is part of the GNU C Library.
4 Bugs can be reported to bug-glibc@gnu.org. 4
5 This program is free software; you can redistribute it and/or modify it 5 This program is free software; you can redistribute it and/or modify
6 under the terms of the GNU General Public License as published by the 6 it under the terms of the GNU General Public License as published by
7 Free Software Foundation; either version 2, or (at your option) any 7 the Free Software Foundation; either version 2, or (at your option)
8 later version. 8 any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License along
16 along with this program; if not, write to the Free Software 16 with this program; if not, write to the Free Software Foundation,
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 USA. */
19 18
20#ifndef _GETOPT_H 19#ifndef _GETOPT_H
21 20
@@ -23,6 +22,17 @@
23# define _GETOPT_H 1 22# define _GETOPT_H 1
24#endif 23#endif
25 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
26#ifdef __cplusplus 36#ifdef __cplusplus
27extern "C" { 37extern "C" {
28#endif 38#endif
@@ -82,7 +92,7 @@ extern int optopt;
82 92
83struct option 93struct option
84{ 94{
85# if defined __STDC__ && __STDC__ 95# if (defined __STDC__ && __STDC__) || defined __cplusplus
86 const char *name; 96 const char *name;
87# else 97# else
88 char *name; 98 char *name;
@@ -126,25 +136,26 @@ struct option
126 arguments to the option '\0'. This behavior is specific to the GNU 136 arguments to the option '\0'. This behavior is specific to the GNU
127 `getopt'. */ 137 `getopt'. */
128 138
129#if defined __STDC__ && __STDC__ 139#if (defined __STDC__ && __STDC__) || defined __cplusplus
130# ifdef __GNU_LIBRARY__ 140# ifdef __GNU_LIBRARY__
131/* Many other libraries have conflicting prototypes for getopt, with 141/* Many other libraries have conflicting prototypes for getopt, with
132 differences in the consts, in stdlib.h. To avoid compilation 142 differences in the consts, in stdlib.h. To avoid compilation
133 errors, only prototype getopt for the GNU C library. */ 143 errors, only prototype getopt for the GNU C library. */
134extern int getopt (int __argc, char *const *__argv, const char *__shortopts); 144extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
135# else /* not __GNU_LIBRARY__ */ 145# else /* not __GNU_LIBRARY__ */
136extern int getopt (); 146extern int getopt ();
137# endif /* __GNU_LIBRARY__ */ 147# endif /* __GNU_LIBRARY__ */
138 148
139# ifndef __need_getopt 149# ifndef __need_getopt
140extern int getopt_long (int argc, char *const *argv, const char *__shortopts, 150extern int getopt_long (int ___argc, char *const *___argv,
151 const char *__shortopts,
141 const struct option *__longopts, int *__longind); 152 const struct option *__longopts, int *__longind);
142extern int getopt_long_only (int argc, char *const *argv, 153extern int getopt_long_only (int ___argc, char *const *___argv,
143 const char *__shortopts, 154 const char *__shortopts,
144 const struct option *__longopts, int *__longind); 155 const struct option *__longopts, int *__longind);
145 156
146/* Internal only. Users should not call this directly. */ 157/* Internal only. Users should not call this directly. */
147extern int _getopt_internal (int argc, char *const *argv, 158extern int _getopt_internal (int ___argc, char *const *___argv,
148 const char *__shortopts, 159 const char *__shortopts,
149 const struct option *__longopts, int *__longind, 160 const struct option *__longopts, int *__longind,
150 int __long_only); 161 int __long_only);