[sane-devel] [PATCH v3 1/2] use getopt

Olaf Meeuwissen paddy-hack at member.fsf.org
Sun Sep 20 12:29:04 UTC 2015


Hi Matteo,

The PNG/JPEG support for scanimage will be part of 1.0.25.  The saned
changes will not.  That doesn't they won't get into 1.0.26, of course.
I just thought that "shoving" that into 1.0.25 was a bit too risky at
this point.

Let's take a step back and split changes up in slightly smaller bits.  I
mentioned that I liked the way you refactored the passing of arguments
to run_standalone() and run_inetd().  Keeping argv processing contained
to main() is a Good Thing.  Let's make that refactoring a commit of its
own.  Or even two, one for run_standalone() and one for run_inetd().

The handling of the command-line arguments of your v3 is closer to the
original saned parsing but still not exactly the same.  I don't really
want to hold onto that parsing, per se.  Your comments about combining
some of the effects of options make sense.  Silently ignoring extra
arguments as the current implementation does, does not make sense.  At
the very least, I'd expect a warning.  Combining the effects of options
does, however, require further changes to the implementation so that it
actually behaves as expected.  That shouldn't be too hard but would need
to be done when allowing combined options.

WRT to the space wrecking havoc on the parsing of optional option
arguments with getopt(), please have look at using getopt_long() as I
suggested earlier.

When using getopt_long() we can introduce more descriptive long options
as well.

Once that is done, we can add your bind-address option.

And when that is done, maybe we can even take a look at #314768[1].

  [1] https://alioth.debian.org/tracker/index.php?func=detail&aid=314768&group_id=30186&atid=410366

How does that sound?  Are you willing to rework this?

Matteo Croce writes:

> Implement command line parsing using getopt,
> replace the help string with a nicer one.
> [snip]

Hope this helps,
-- 
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
Support Free Software               Support the Free Software Foundation
https://my.fsf.org/donate                        https://my.fsf.org/join



More information about the sane-devel mailing list