Subject: Re: lib/22733: Few typos in getopt.3
To: None <netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 09/10/2003 00:39:11
> >Synopsis: Few typos in getopt.3
> .Bd -literal -offset indent
> int length;
> -char *p;
> +char *p,c;
>
> while ((c = getopt(argc, argv, "0123456789")) != -1) {
> switch (c) {
> case '0': case '1': case '2': case '3': case '4':
> case '5': case '6': case '7': case '8': case '9':
> p = argv[optind - 1];
> - if (p[0] == '-' \*[Am]\*[Am] p[1] == ch \*[Am]\*[Am] !p[2])
> + if (p[0] == '-' \*[Am]\*[Am] p[1] == c \*[Am]\*[Am] !p[2])
> length = atoi(++p);
> else
> length = atoi(argv[optind] + 1);
Well variable 'c' has to be 'int', and this example ought to be shot.
David
--
David Laight: david@l8s.co.uk