From: | Doug McNaught <doug(at)wireboard(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Does getopt() return "-1", or "EOF", at end? |
Date: | 2002-01-09 20:35:53 |
Message-ID: | m3r8oz6z4m.fsf@varsoon.denali.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> 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 don't know, but the Solaris getopt() manpage specifies it as
returning EOF rather than -1. I *think* POSIX mandates EOF == -1
anyhow but I'm certainly not sure of that (and we run on non-POSIX
systems too I guess).
-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863
From | Date | Subject | |
---|---|---|---|
Next Message | Dominic J. Eidson | 2002-01-09 20:44:49 | Re: Does getopt() return "-1", or "EOF", at end? |
Previous Message | Tom Lane | 2002-01-09 20:30:06 | Re: Some architectures need "signed char" declarations |