Mail Archives: djgpp/2002/12/13/04:14:47
> From: "Arthur J. O'Dwyer" <ajo AT andrew DOT cmu DOT edu>
> 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.
- Raw text -