Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] Re: (PR#1752) Command line option -d fails with Xaw client
Home

[Freeciv-Dev] Re: (PR#1752) Command line option -d fails with Xaw client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jason Short via RT <rt@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#1752) Command line option -d fails with Xaw client
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 08:08:45 +0100

On Tue, Nov 12, 2002 at 02:11:32PM -0800, Jason Short via RT wrote:
> 
> [rfalke - Tue Jul 16 14:00:12 2002]:
> 
> > 
> > The command line argument -d and --debug doesn't work with the Xaw client:
> > 
> > $ ./civ -d 0
> > Error: Can't open display: 0
> > $ ./civ --debug 0
> > Error: Can't open display:
> > 
> > Fix: remove the parsed options from argc/argv before they are passed
> > to ui_main.
> 
> The problem here is twofold.
> 
> If FreeCiv gets an argument it doesn't recognize it will print an error
> and exit.  So even if -d didn't conflict, there would be no way to use
> XAW's -d option.  Likewise, even though --display should work (under
> XAW) it doesn't.  This is a problem.
> 
> The second problem is the one you point out: right now options are
> handled by freeciv and _then_ passed in to ui_main, so in effect they
> have two meanings.
> 
> To fix just the second problem is easy: just don't pass any options to
> ui_main (set argc to 1, and probably argv[1] to NULL).  But if this
> becomes a permanent thing then we might as well just not pass these values.
> 
> To fix both problems is harder.  We could pull off the freeciv arguments
> (without giving an error on unrecognized arguments), and pass the
> remaining arguments to ui_main.  We are then counting on ui_main to give
> the error/warning if there are any unrecognized arguments.  And note
> that --help will only show the freeciv options, not the UI ones (this
> could be fixed by introducing a new UI function, ui_print_help() or
> similar).

> Or we could pass the arguments to a UI function to pull off any
> UI-specific ones before handling them ourselves.  This might be easier
> since most UIs will do this automatically.  It also lets us print out an
> error for any unrecognized options.  But it means the UI will get
> priority in taking the arguments, so -d would be interpreted by XAW and
> not by freeciv.

> A final idea would be to introduce a new argument, --gui.  Any options
> before this argument will be handled by FreeCiv.  Any options after it
> will be passed untouched to the GUI.  So you could do
>   ./civ -d 0 --gui -d :0
> to get both behaviors of -d.

Since the gui options aren't used this often I think we should use
this solution. The delimeter however should be changed to "--".

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "USENET is *not* the non-clickable part of WWW!"


[Prev in Thread] Current Thread [Next in Thread]