List Archive

Thread

Thread Index

Message

From: Thomas Klausner <tk%giga.or.at@localhost>
To: Remi Collet <remi%fedoraproject.org@localhost>
Subject: Re: libzip-1.1 released
Date: Thu, 28 Jan 2016 14:20:53 +0100

On Thu, Jan 28, 2016 at 02:17:01PM +0100, Remi Collet wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Le 28/01/2016 14:06, Thomas Klausner a écrit :
> > 
> > On Thu, Jan 28, 2016 at 01:42:41PM +0100, Remi Collet wrote:
> >> Build is broken
> >> 
> >> ziptool.c: In function 'main': ziptool.c:1013:61: error: 'optopt'
> >> undeclared (first use in this functio n) snprintf(reason,
> >> sizeof(reason), "invalid option -%c", optopt);
> > 
> > Does adding
> > 
> > extern int optopt;
> > 
> > at the top of the file fix this for you?
> 
> Yes...

Great, then please use that patch locally, I'll commit to the
repository soon.

> but this look a bit strange...

Look at the getopt(3) man page on Linux, it's documented this way. On
NetBSD, I don't need this manual declaration, I find that better too.

> switch (c) {
> ...
> default:
>     snprintf(reason, sizeof(reason), "invalid option -%c", optopt);
> 
> "c" seems a valid fix... the char being checked (the switch)...

No, that will always print '?' and not the actual character, because
the option string only allows a subset of characters and returns '?'
for all the others.
 Thomas

Made by MHonArc.