Wireshark-dev: Re: [Wireshark-dev] Switching to getopt_long() - or to g_option?
From: Ulf Lamping <[email protected]>
Date: Tue, 15 Apr 2008 04:36:57 +0200
Guy Harris schrieb:
[email protected] wrote:

--- Comment #1 from Andrew Feren <[email protected]>  2008-04-14 11:35:31 GMT ---
The choice of -x for the commandline argument was arbitrary.  I didn't see any
particular reasoning for the other switch choices so I started at z and worked
backwards until I found an unused letter.
Should we switch from using getopt() to using getopt_long()?  It's 
available in most Linux distributions (as it's in glibc), newer versions 
of most if not all *BSDs as well as Mac OS X, and newer versions of 
Solaris, and we could supply the glibc version on platforms that lack it 
(we're already supplying the glibc version of getopt() on Windows, which 
is probably the only platform we run on that lacks getopt()).
That would let us have multi-character strings for options, and still 
support single-character aliases for the options we already support (and 
add single-character aliases for options we think would be frequently used).
  
Sounds reasonable.
Or, alternatively, now that we've dropped support for GLib 1.2[.x], we could just use the GOptions command-line parser in GLib, although that would also require that we drop support for GLib 2.x prior to GLib 2.6. For Wireshark, that *might* let us use gtk_init_with_args() rather than gtk_init(), if we do the main argument parsing at the time we're calling gtk_init(), although we still have to do the "pre-parse" before calling gtk_init_with_args()
Wouldn't be a problem for the Windows builds, as they are usually using almost recent GLib versions.
But what about the various Unix/Linux builds? I don't know if all of 
them will support GLib 2.6?
Maybe using getopt_long() is the way to go? - I don't know which would 
be the best way.

Anyway, don't forget to update the various user documents after you've done the changes ;-)
Regards, ULFL