Mail Archives: djgpp/1992/10/13/13:42:39
Chris and Eric are noting anomolies in MS-DOS directory listings. I
haven't actually gotten into directory code in a major way since I
retired my Osborne 1 and CP/M, but I have some suspicions from looking
at Zortech C++'s directory classes and DOS interface function
descriptions:
> It sounds like you are using go32 to do wild-card expansion. The
> expansion that go32 does is MS-DOS style, which means that "*" doesn't
> match a filename that has a "." in the middle of it (you need "*.*" to
> match all files). MS-DOS style expansion also means that anything
> after a "*" is ignored, so that "ls *test.c" is equivalent to "ls
> *.c". Also, for reasons that I don't understand, a "*" gets expanded
> to include both "." and "..", which is what you are seeing. This
> seems wrong to me, but it's in go32 or maybe is built into MS-DOS and
> is therefore out of my hands.
If I remember correctly, "." and ".." are not entries in an MS-DOS
directory. MS-DOS finds them by special casing them. Inconsistently
enough, the special case considers them to be alphabetical. That's
MS-DOS; not much you can do about it ;-)
I don't know about GO32 or COMMAND.COM, but under 4DOS "*" is
equivalent to "*.*"; to get the behavior you describe you need "*.".
4DOS also accepts the "*test.c" syntax.
> On a related note, I've noticed some strangeness even with "noglob" in
> my GO32 environment variable. For example, if I do "ls *~" to list my
> emacs backup files, this works correctly if there is at least one
> backup file (because the shell expands "*~" into a list of file names
> before ls even sees it). But if there aren't any backup files,
> something is expanding the "*~" into "." or something like that. This
> behavior seems wrong, but I don't know how to fix it. I assume the
> cause is some low-level MS-DOS call which is doing wild-card
> expansion. Or maybe go32.exe is doing this even though noglob is set.
In csh, "~" is an abbreviation for $HOME. Since MS-DOS doesn't know
about it, it sounds like either "ls" or "MS_SH200" is globbing "*~",
and for some reason when it doesn't find anything else, tries "~" as a
special case and gets $HOME or maybe ".". I don't think that
low-level MS-DOS functions do any globbing; that's all done by the
user program. Most libraries have slightly higher-level functions
which do some globbing, but the entries to DOS via INT 21 insist that
only single character wildcards ("?") are permitted.
--
Stephen Turnbull The Ohio State University Department of Economics
410 Arps Hall, 1945 N. High St., Columbus, OH 43210-1172 USA
Phone: (614) 292-0654 Fax: ...-3906 Email: turnbull DOT 1 AT osu DOT edu
- Raw text -