www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/12/21:00:17

From: "Arthur J. O'Dwyer" <ajo AT andrew DOT cmu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Bug in command-line globbing
Date: Thu, 12 Dec 2002 20:49:46 -0500 (EST)
Organization: Carnegie Mellon, Pittsburgh, PA
Lines: 50
Message-ID: <Pine.GSO.4.44L-027.0212122038250.21386-100000@unix14.andrew.cmu.edu>
NNTP-Posting-Host: smtp7.andrew.cmu.edu
Mime-Version: 1.0
X-Trace: bb3.andrew.cmu.edu 1039744186 26786 128.2.10.87 (13 Dec 2002 01:49:46 GMT)
X-Complaints-To: advisor AT andrew DOT cmu DOT edu
NNTP-Posting-Date: 13 Dec 2002 01:49:46 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

% 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;
}

% gcc -o test.exe test.c
% test \
:\:

% test '\'
:':

% test '\\'
:\':

% test "\\"
:\":

%

So my question is: is this the correct behavior for the default
"filename globbing" performed by DJGPP-compiled programs?  If not,
has it been reported before?  If so, why?

It looks like the '\' character escapes certain characters - quotes
and double quotes, in particular - but does not escape itself.  This
is probably a bug, and almost certainly a design flaw.

If someone believes this is correct behavior, please tell me how to
produce the output

% test (something goes here)
:*/:
:hello:

from the above program (assuming the program is called from a directory
containing one or more subdirectories, of course).

-Arthur,
who wants to write a tr


- Raw text -


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