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: Thu, 17 Nov 2005 01:50:35 -0800
Ulf Lamping wrote:

Hmmm, so both ways don't work well :-(

Fortunately, by setting "opterr" to 0 before the pre-scan, and setting it back to 1 before the real scan, you can suppress the extra error messages. I checked in a change to do that.

That's ugly, right. But having *no* output at all on Win32 is even much worse. That's the reason I've changed it that way, it was simply a quick fix.

I added a routine cmdarg_err(), which takes printf-style arguments, without a command name, and reports an error in command-line arguments. The Tethereal version just prints to stderr, and adds "tethereal: " to the message; the Ethereal version creates a console if necessary, and adds "ethereal: " to the message. (That also means arg parsing helper routines no longer need the command name as an argument, as they now use cmdarg_err().) I also added cmdarg_err_cont(), which is similar, except that it doesn't add the command name; it's for continuing error messages on subsequent lines.

I changed the g_warning() calls to cmdarg_err() and cmdarg_err_cont() calls, and changed some fprintf(stderr, ...) calls to cmdarg_err() calls in common subroutines.