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

Kel Modderman kel at otaku42.de
Mon Dec 24 21:20:57 EST 2007

On Tuesday 25 December 2007 11:03:33 Dan Williams wrote:
> On Mon, 2007-12-17 at 11:49 +1000, Kel Modderman wrote:
> > Hi,
> >
> > (Re-sending this one, as it was not commented on in last patch frenzy.)
> >
> > Logging to file was recently added, but the file path and name template
> > is hardcoded in wpa_debug_open_file(). This change adds an extra -F
> > command line option which allows specification of a specific output
> > filename to write debug output to.
> 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.
> Other than that, the patch looks OK to me.
> Dan

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.

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

Hope you have a good christmas btw ;-)

Thanks, Kel.

More information about the HostAP mailing list