[PATCH] Allow logging to specific file with -F option

Jouni Malinen j at w1.fi
Mon Dec 24 21:39:42 EST 2007

On Tue, Dec 25, 2007 at 12:20:57PM +1000, Kel Modderman wrote:

> > > (Re-sending this one, as it was not commented on in last patch frenzy.)

Sorry.. I'm still planning on getting this type of change in at some
point. I think I found some parts that I liked more in Dan's patch and
some other areas that I preferred from your change, so I was planning on
doing some kind of merge of the two.. I just don't remember the details
anymore ;-).

> > Since there hadn't been any releases with the -f flag, any reason why
> > you added a new flag for the debug file rather than just using -f?  It
> > seems a bit overkill to have two options; you could make it so that if
> > you specify -f without the path it'll log to the default location but
> > you can override it if you like.  That's the approach I'd rather see
> > here...  I think optarg will just be NULL if you don't specify a file,
> > in which case it'll just fall through to the default location because
> > params->wpa_debug_file will be NULL.

> afaik, getopt requires that a specified argument accepts an argument or does 
> not accept an argument (denoted by semi-colon after option letter), but there 
> is no middle ground.
> Ok, after reading `man 3 getopt`, two semi colons can allow an optional 
> argument, but that is a GNU specific extension, and as such, probably not as 
> portable as adding a definitive option.

I don't like that.. Both from the portability view point and from the
view point of being able to understand how the command line parsing is
supposed to work for some odd combinations like -fd (is it "-f -d" or -f
to a file named 'd')..

> Personally, I don't see the point in having the hardcoded fallback in /temp 
> (\\Temp), but maybe I missed something.

Some main*.c implementations do not have code for setting the path
(e.g., Windows service) and only use true/false to select whether
logging to file is enabled. These would need to be handled by moving the
hardcoded value somewhere else, but that should be okay. Forcing the
unix main() version to require full path name on the command line sounds

Jouni Malinen                                            PGP id EFC895FA

More information about the HostAP mailing list