www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/07/28/02:20:25

Date: Sun, 28 Jul 1996 09:15:07 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: `system' and wildcard expansion
Message-Id: <Pine.SUN.3.91.960728085010.23430G-100000@is>
Mime-Version: 1.0

There is a design flaw (my fault) in the version of `system' currently in
the alpha release: there is no way to call a DJGPP program and prevent it
from expanding a certain command-line argument, because `system' removes
all quoting characters (it cannot remove some of them without parsing the
arguments and knowing too much about the program it is about to invoke). 
That is, if the child program was linked with the stock 2.0 version of
src/libc/crt0/c1args.c; if you link it with the alpha version of c1args,
*no* arguments are ever expanded, because command lines passed via !proxy
aren't globbed anymore (to make `spawnXX' POSIX-compliant). 

There is a way out of this mess: let `system' itself expand wildcards
(unless they are quoted) and pass the expanded list to the child.  This
works (I have a working version of `system' that I'm testing now which
works this way), but it has these two problems: 

	* Programs linked against previous versions of library (v1.x and
v2.0) cannot be called in a way that prevents wildcard expansion by the
child.  The revised `system' removes the quotes and doesn't expand the
wildcards, but the child will glob it; and you cannot escape-protect the
quotes, because !proxy command lines aren't run on the child side through
the code that handles quotes and backslash-escapes.  A workaround is to
call such programs (they are rare, btw, `find' is the only example I know
of) via "command /c". 

	* If the child doesn't glob the arguments (either setting the stub
info in v1.x or overloading `__crt0_glob_function' in v2), it will get the
expanded arguments anyway. 

I think that we can live with the above problems, but if there are any 
comments and/or suggestions to deal with these problems, please tell me.
The revised `system' gets linked now into Emacs and Less (the two 
programs I use most frequently) and if no show-stopper emerges, will be 
emailed in a few days.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019