GNOME Bugzilla – Bug 168008
gtk_init() strips "-" from parameters list
Last modified: 2011-02-18 16:14:05 UTC
Version details: 2.6.2 Distribution/Version: Mandrake 10.1 any "-" (by itself, i.e. not "-something") in argv[] sent to gtk_init() is stripped, with corresponding change to argc. Makes life difficult for apps. wanting input from stdin.
Does it work with -- ?
Embedded "--" is ignored, trailing "--" is stripped. As contrasted with "-", which is removed from anywhere.
Before GTK 2.6, gtk_init did not remove "-" from argv. Letting gtk_init (etc.) silently remove "-" from argv (for no obvious reason and without documentation) limits how well new GTK applications can clone older X applications. (E.g., my gxmessage app can't clone xmessage decently, if the "-file -" option isn't going to work without me implementing a kludge. :) Is there a reason for gtk_init to remove "-" from argv?
What does "xmessage --display :0" give you :-) If you want to clone Xt command line processing, you are going to have to call gtk_init(NULL, NULL);
Moving to GLib, since this is a GOption issue.
*** Bug 303166 has been marked as a duplicate of this bug. ***
*** Bug 301534 has been marked as a duplicate of this bug. ***
2005-05-06 Matthias Clasen <mclasen@redhat.com> * tests/option-test.c: Add a testcase. * glib/goption.c (g_option_context_parse): Treat '-' on its own as a non-option argument. (#168008, Tim Musson, Thomas Leonard and others)