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.
This commit is contained in:
christos 2000-04-02 06:32:41 +00:00
parent cbfdcd8cc0
commit 2effe6c79a
2 changed files with 19 additions and 25 deletions

View File

@ -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 <sys/cdefs.h>
/*
* 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

View File

@ -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 <sys/types.h>
#include <sys/unistd.h>
#include <getopt.h>
/*
* 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