Mail Archives: djgpp/2002/12/12/22:00:04.1
[A. Sinan Unur wrote: something suggesting I clarify my question.]
On Thu, 12 Dec 2002, Arthur J. O'Dwyer wrote:
>
> % cat test.c
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> int i;
> for (i=0; i < argc; i++) {
> printf(":%s:\n", argv[i]);
> }
> return 0;
> }
This is the listing of a program written in C.
> % gcc -o test.exe test.c
This is the DOS command to compile the program using DJGPP.
> % test \
This is the invocation of the program with one argument.
> :\:
This is the output of the program with the invocation above.
> % test '\'
> :':
>
> % test '\\'
> :\':
>
> % test "\\"
> :\":
These are three more invocations and their outputs.
> %
This is the command prompt.
> So my question is: is this the correct behavior for the default
> "filename globbing" performed by DJGPP-compiled programs?
This is my question.
> If not,
> has it been reported before?
If this is not the correct behavior, then it is a bug and I should
report it to delorie.com.
> If so, why?
If this is the correct behavior, it looks to me like a design flaw.
> It looks like the '\' character escapes certain characters - quotes
> and double quotes, in particular - but does not escape itself.
This is my theory regarding what the globbing code is doing behind
the scenes. 'To escape' in this context means 'to strip of any special
meaning'.
> This
> is probably a bug, and almost certainly a design flaw.
Self-explanatory, I hope. This is a design flaw because it seems to
make the satisfaction of my request below ("The Request") impossible.
> If someone believes this is correct behavior, please tell me how to
> produce the output
>
> % test (something goes here)
> :*/:
> :hello:
>
> from the above program
This is "The Request".
> (assuming the program is called from a directory
> containing one or more subdirectories, of course).
If there are no subdirectories, it is trivial to satisfy The Request;
simply pass */ literally to the program, as: % test */
> -Arthur,
> who wants to write a tr
This is my signature. It explains that my reason for asking is because
I want to create a homemade version of the Unix utility 'tr'. This
is irrelevant to the question (I know GNU makes a 'tr' already, and I
don't care). That is why it is in my signature, as opposed to in the
message body.
- Raw text -