Ethereal-dev: Re: [Ethereal-dev] Not possible to capture packets on win32 on latest svn build

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Guy Harris" <gharris@xxxxxxxxx>
Date: Wed, 16 Nov 2005 14:28:56 -0800 (PST)
Ulf Lamping wrote:
> In 16443, Guy has added a feature to exit Ethereal when the parameter
> check of the pre-scan of the command line parameters failed.
>
> This is a bad idea for two reasons:

Not exiting before *re*-scanning the command line parameters is *also* a
bad idea, as one error message is better than two, and getopt() will print
error messages for at least some command-line problems.

(Using g_warning() for command-line errors is also a bit of a bad idea, as
it makes the error messages *REALLY* ugly:

    $ ethereal -tq
    14:19:21          Warn ethereal: Invalid time stamp type "q"
    14:19:21          Warn It must be "r" for relative, "a" for absolute,
    14:19:21          Warn "ad" for absolute with date, or "d" for delta.

The time stamp and "Warn" serve no purpose and just clutter the output,
making it harder to read.)

> 1. The capture child uses a slightly different command line pattern,
> which might trigger this error even when it's used as intended.

If there's a case where getopt() returns '?' in the capture child, that's
an error.  If the command-line arguments are different, the option string
should be different, too.

> 2. If someone uses a bad command line parameter, Ethereal will exit
> without any message. Previously, Ethereal printed the parameter usage.
> Didn't fixed this, don't have much time :-(

The fix is to print a usage message in that case.  I'm compiling that fix
now, although I have to take off for a medical appointment and won't be
back for a while, so I'll check it in later.