From 2effe6c79ab2e01d8fcb471c1a68ea18184a8fc8 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 2 Apr 2000 06:32:41 +0000 Subject: [PATCH] backout previous. the definition of struct option caused too many namespace collisions. Instead, define getopt_long in getopt.h and getopt in unistd.h where it belongs. --- include/getopt.h | 23 +---------------------- include/unistd.h | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/include/getopt.h b/include/getopt.h index bf24069e3b8b..930d00727dbb 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -1,4 +1,4 @@ -/* $NetBSD: getopt.h,v 1.1 2000/04/01 22:37:15 christos Exp $ */ +/* $NetBSD: getopt.h,v 1.2 2000/04/02 06:32:41 christos Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -38,23 +38,6 @@ #ifndef _GETOPT_H_ #define _GETOPT_H_ -#include - -/* - * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later - */ -#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \ - (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 4 -__BEGIN_DECLS -extern int opterr; /* if error messages should be printed */ -extern int optind; /* index into parent argv vector */ -extern int optopt; /* last invalid option letter */ -extern char *optarg; /* argument associated with option */ - -int getopt __P((int, char * const *, const char *)); -__END_DECLS -#endif - /* * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions */ @@ -80,10 +63,6 @@ struct option { __BEGIN_DECLS int getopt_long __P((int, char * const *, const char *, const struct option *, int *)); - -extern int optreset; /* reset getopt */ -extern char *suboptarg; /* getsubopt(3) external variable */ -int getsubopt __P((char **, char * const *, char **)); __END_DECLS #endif diff --git a/include/unistd.h b/include/unistd.h index 044d19873181..547f854de8e8 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.82 2000/04/01 22:37:15 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.83 2000/04/02 06:32:41 christos Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -80,8 +80,6 @@ #include #include -#include - /* * IEEE Std 1003.1-90 @@ -146,6 +144,20 @@ int unlink __P((const char *)); ssize_t write __P((int, const void *, size_t)); +/* + * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later + */ +#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \ + (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 4 +int getopt __P((int, char * const [], const char *)); + +extern char *optarg; /* getopt(3) external variables */ +extern int opterr; +extern int optind; +extern int optopt; +#endif + + /* * IEEE Std 1003.1b-93, * also found in X/Open Portability Guide >= Issue 4 Verion 2 @@ -286,6 +298,7 @@ int fchroot __P((int)); int getdomainname __P((char *, size_t)); int getgrouplist __P((const char *, gid_t, gid_t *, int *)); mode_t getmode __P((const void *, mode_t)); +int getsubopt __P((char **, char * const *, char **)); __aconst char *getusershell __P((void)); int initgroups __P((const char *, gid_t)); int iruserok __P((u_int32_t, int, const char *, const char *)); @@ -325,6 +338,8 @@ int iruserok_sa __P((const void *, int, int, const char *, const char *)); #endif extern __const char *__const *sys_siglist __RENAME(__sys_siglist14); +extern int optreset; /* getopt(3) external variable */ +extern char *suboptarg; /* getsubopt(3) external variable */ #endif __END_DECLS