Wireshark-bugs: [Wireshark-bugs] [Bug 2473] New: Using GOptions instead of getopt
Date: Thu, 17 Apr 2008 04:23:23 -0700 (PDT)
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2473

           Summary: Using GOptions instead of getopt
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Low
         Component: Extras
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: acferen@xxxxxxxxx



Andrew Feren <acferen@xxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1705|                            |review_for_checkin?
               Flag|                            |


Created an attachment (id=1705)
 --> (http://bugs.wireshark.org/bugzilla/attachment.cgi?id=1705)
sample implementation using GOptions instead of getopt for capinfos

Build Information:
wireshark 1.0.99 (SVN Rev 25095)

Copyright 1998-2008 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GTK+ 2.12.0, with GLib 2.14.1, with libpcap 0.9.7, with libz
1.2.3.3, without POSIX capabilities, without libpcre, without SMI, without
ADNS,
without Lua, without GnuTLS, without Gcrypt, without Kerberos, without
PortAudio, without AirPcap.
NOTE: this build doesn't support the "matches" operator for Wireshark filter
syntax.

Running on Linux 2.6.22-14-generic, with libpcap version 0.9.7.

Built using gcc 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2).

--
This is a place holder for addressing Guy's email response to a comment in one
of my bug reports.

-Andrew

bugzilla-daemon@xxxxxxxxxxxxx wrote:

> --- Comment #1 from Andrew Feren <acferen@xxxxxxxxx>  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
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev


-- 
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.