[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFS: anox



On Mon, Dec 12, 2011 at 08:36:18AM +0100, Sébastien Bertrand wrote:

> > From the UNIX point of view, they are not.
> 
> It seems that xinit behave this way, the following commands do not
> give the same result :
> xinit tremulous -- :1
> xinit tremulous --quiet -- :1
> xinit "tremulous --quiet" -- :1
> 
> The first just works, the second give an error "xterm:  bad command
> line option "tremulous"", and the third give an error "No absolute
> path found for shell: tremulous --quiet".
> 
> Is the "--" separator part of the UNIX convention ?

In the GNU world, -- is used to force the end of options and the start
of the list of files to act on. This is not used often, but comes in
handy if you have a file called ‘-foo’ somewhere.

xinit uses a different convention: the part before -- is the client part,
while the part following it is the server part.

The client part defaults to launching xterm, and if the first argument is
not an absolute path all arguments in the client part are passed directly
to xterm.

With this knowledge, we can understand what’s happening in each case:

  1. xinit tremulous -- :1

     ‘xterm tremulous’ is called. The last argument passed to xterm is
     the name of the shell to execute, so xterm spawns tremulous;

  2. xinit tremulous --quiet -- :1

     ‘xterm tremulous --quiet’ is called. xterm can’t recognize
     ‘tremulous’ as a command line option, so it reports an error;

  3. xinit "tremulous --quiet" -- :1

     xterm is called with a single argument, ‘tremulous --quiet’. Since
     it’s the last argument, it is taken to be the name of the shell to
     execute, but no program with that name is found on the system, so
     xterm exits reporting an error.

The last example very clearly shows why quoting makes a difference in the
UNIX world, and why you can’t just put everything inside double quotes
and call it a day.

What you probably want to do is to call something like

	xinit /usr/games/tremulous --quiet -- :1

so that the game is called directly instead of going through xterm.

-- 
Andrea Bolognani <eof@kiyuko.org>
Resistance is futile, you will be garbage collected.

Attachment: signature.asc
Description: Digital signature


Reply to: