Date: Fri, 13 Dec 2002 11:12:35 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: "Arthur J. O'Dwyer" Message-Id: <4331-Fri13Dec2002111235+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: (ajo@andrew.cmu.edu) Subject: Re: Bug in command-line globbing References: Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Arthur J. O'Dwyer" > Newsgroups: comp.os.msdos.djgpp > Date: Thu, 12 Dec 2002 23:12:57 -0500 (EST) > > > > C:\Dload\misc>test "*\\" hello > > > > you get the output > > > > :*\" hello: > > > > instead of the intended > > > > :*\: > > :hello: > > > > That indeed looks like a bug in that one expects \\ to mean \. > > Mm-hm. I think it's a bug in the globbing code. It's not a bug, it's a deliberately programmed feature. We cannot have \\ expand into a single \ because we don't want to break Windows UNC file names (\\SERVER\SHARE\DIRECTORY\FILE). In general, due to the backslashes being used as directory separators in file names, the DJGPP globbing code must limit its use of a backslash as an escape character to the absolute minimum. This might have some surprising effects in interactive usage, but in practice it works very well, both in DOS and Unix Makefiles and on the command line. > > I don't know if one of > > > > C:\Dload\misc>test "*\ " hello > > :*\ : > > :hello: > > > > or > > > > C:\Dload\misc>test "*"\ hello > > :*\: > > :hello: > > > > is acceptable to you. > > The second one certainly looks like it satisfies The Request, although > in an ideal world (with correct globbing), the second one would/should > produce some sort of error. I don't understand why do you think the second example should have produced an error. This is the DOS/Windows shell we are talking about, not a Unix shell. With DOS/Windows shells, a backslash is not special, so the following character (the blank) is not escaped. DJGPP is basically a DOS/Windows programming environment, it just has enough Unix features added to allow you to build Unix-born programs and use them similarly (but not identically) to how they are used on Unix. But we still do not transform DOS into Unix. As another data-point, consider the EOF character: it's Ctrl-D on Unix, but Ctrl-Z on DOS. Programs that need the user to terminate input with the EOF character, need to see Ctrl-Z in the ported versions. So some DOS-specifics are (and IMHO should be) still with us. That is the basic principle of DJGPP: it creates programs that are good DOS/Windows citizens, in the sense that they fully support interoperability with other DOS/Windows programs, and yet add Unix features that do not contradict with DOS/Windows. > I don't know why I'd want to delete all > asterisks and backslashes in all my text files, but it would be nice > if it were _possible_. It's possible, you just have to quote a bit differently.