Wireshark-dev: Re: [Wireshark-dev] Switching to getopt_long() - or to g_option?
From: Andrew Feren <[email protected]>
Date: Thu, 17 Apr 2008 04:40:43 -0700 (PDT)
I started playing with GOptions.  

GOptions has a lot of flexibility.  If we are going through the trouble of
changing from getopt it might be worthwhile to have more flexible commandline
options.

Some thoughts I had for capinfos while working on this patch:
1) specify units separately 
Instead of data rate/bytes and data rate/bits.
There could be just data rate with an other option to decide what units to use for display.
2) I'd like it if capinfos had an option to display easily to parse fields like tshark
3) When I added the groups with GOption it seemed it might be useful have a
switch to display everything in each group.

I submitted an initial patch if anyone has additional thoughts or comments I'd be interested to hear them.

http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2473
 
-Andrew Feren
 [email protected]

----- Original Message ----
> From: Guy Harris <[email protected]>
> To: [email protected]
> Sent: Monday, April 14, 2008 4:26:05 PM
> Subject: [Wireshark-dev] Switching to getopt_long() - or to g_option?
> 
> [email protected] wrote:
> 
> > --- Comment #1 from Andrew Feren   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).
> 
> 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().
> _______________________________________________
> Wireshark-dev mailing list
> [email protected]
> http://www.wireshark.org/mailman/listinfo/wireshark-dev
>