Re: Does getopt() return "-1", or "EOF", at end? - Mailing list pgsql-hackers

From David Terrell
Subject Re: Does getopt() return "-1", or "EOF", at end?
Date
Msg-id 20020109132949.A8808@pianosa.catch22.org
Whole thread Raw
In response to Does getopt() return "-1", or "EOF", at end?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Does getopt() return "-1", or "EOF", at end?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Jan 09, 2002 at 12:58:45PM -0500, Tom Lane wrote:
> I notice that in some places we compare the result of getopt(3) to
> "EOF", and in some other places we compare it to "-1".  I think we
> should standardize on one or the other; anyone have an opinion
> which it should be?
> 
> The man pages I have here (HPUX and Linux) both describe the
> end-of-switches return value as being "-1".  The glibc sources also
> use "-1".  Replacing this by EOF seems more readable but perhaps is
> not strictly correct.
> 
> Are there any platforms that define EOF as something other than -1?

OpenBSD's getopt(3):    The getopt() function was once specified to return EOF instead of -1.    This was changed by
IEEEStd1003.2-1992 (``POSIX.2'') to decouple    getopt() from <stdio.h>.
 

-- 
David Terrell            | "If NNTP had a protocol extension for
dbt@meat.net             | administering a spanking (long overdue if
Nebcorp Prime Minister   | you ask me), you'd be yelping right now."
http://wwn.nebcorp.com/  |  - Miguel Cruz


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Does getopt() return "-1", or "EOF", at end?
Next
From: "Greg Sabino Mullane"
Date:
Subject: Bzip2 postgres tarballs