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

From Bruce Momjian
Subject Re: Does getopt() return "-1", or "EOF", at end?
Date
Msg-id 200201092110.g09LAFT10967@candle.pha.pa.us
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?  (Richard Kuhns <rjk@grauel.com>)
List pgsql-hackers
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?

I think -1 is the only way to go.  EOF just doesn't seem right for a
non-file access function.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Does getopt() return "-1", or "EOF", at end?
Next
From: Tom Lane
Date:
Subject: Re: Does getopt() return "-1", or "EOF", at end?