Re: [PATCH 2/3] getopt: fixes to exit codes, free allocations at exit, progname and version output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 17, 2011 at 09:30:43PM +0100, Sami Kerola wrote:
> On Mon, Jan 3, 2011 at 22:45, Karel Zak <kzak@xxxxxxxxxx> wrote:
> [snip... here was helpful instructions]
> > Â ÂKarel
> 
> I made another two patches to getopt. Let's hope they are better. The
 
 Yeah, the patches look better, but...

> diff --git a/getopt/getopt.1 b/getopt/getopt.1
> index 2e6fbda..0b3ffb2 100644
> --- a/getopt/getopt.1
> +++ b/getopt/getopt.1
> @@ -407,20 +407,14 @@ and
>  characters in the short options string are ignored.
>  .SH RETURN CODES
>  .B getopt
> -returns error code
> +will return zero
>  .B 0
> -for successful parsing,
> -.B 1
> -if
> -.BR getopt (3)
> -returns errors,
> -.B 2
> -if it does not understand its own parameters,
> -.B 3
> -if an internal error occurs like out\-of\-memory, and
> -.B 4
> -if it is called with
> -.BR \-T .
> +for successful parsing, and non-zero valu in all other cases.

 ... I think we can't change return codes. The codes are very
 important in scripts to detect parsing problems.
 
 A small problem is that xalloc.h functions return 1 on error, but you
 can ignore this problem for now. I'll resolve this problem later.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux