Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Oct 1999 16:19:47 -0700 (PDT)
From:      bde@FreeBSD.ORG (Bruce Evans)
To:        asmodai@wxs.nl, hackers@freebsd.org
Cc:        bde@freebsd.org, billf@freebsd.org
Subject:   Re: getopt.h
Message-ID:  <19991020231947.6A4D414BE0@hub.freebsd.org>
In-Reply-To: <19991020221007.A90211@daemon.ninth-circle.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> In unistd.h we have definitions for getopt, optarg, optind, opterr, and
> optopt.

These are the standard POSIX (.2?) declarations.

> The things I propose to add to unistd.h are the following:

> struct option
> {
> 	char	*name;
> 	int	has_arg;
> 	int	*flag;
> 	int	val;
> };

> #define no_argument		0
> #define required_argument	1
> #define optional_argument	2

> extern int getopt_long (int, char *const [], const char *,
> 		        const struct option *, int *);
> extern int getopt_long_only (int, char *const [], const char *,
> 		             const struct option *, int *);
> extern int _getopt_internal (int, char *const [], const char *,
> 		             const struct option *, int *, int );

> This should enable us to compile programs which require getopt.h by
> simply including unistd.h.

These are gnu extensions which we don't even support in libc, so they
shouldn't be declared anywhere in /usr/include.  I think ports that
use the gnu extensions handle this problem by duplication the gnu
sources.  Not ideal, but the getopt sources are small.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991020231947.6A4D414BE0>