[comp.sys.ibm.pc] expansion of *FOO.* = *.* ?!?

flowers@ucla-cs.UUCP (04/29/87)

Why does the fact that DOS treats *FOO.* (as in "DIR *FOO.*") the same
as "*.*" remain unfixed?

Does anyone know of a patch to fix this?

heather@blia.BLI.COM (Heather Mackinnon) (04/29/87)

In article <5734@shemp.UCLA.EDU>, flowers@CS.UCLA.EDU writes:
> 
> Why does the fact that DOS treats *FOO.* (as in "DIR *FOO.*") the same
> as "*.*" remain unfixed?

DOS treats * as ???????? in the filename and as ??? in the extension.
This means that *FOO.* becomes ????????FOO.???.  Since DOS only considers
the first eight characters of a filename significant, it tosses FOO away
and matches *FOO.* to everything.

> Does anyone know of a patch to fix this?

If you want true regular expression processing, you'll need a more UNIX
-like command processor.  MS doesn't consider this a bug; it's stated
quite clearly in the DOS documentation.

Heather Mackinnon

darrylo@hpsrlc.UUCP (04/30/87)

In / comp.sys.ibm.pc / flowers@CS.UCLA.EDU /  9:22 pm  Apr 28, 1987 /

> Why does the fact that DOS treats *FOO.* (as in "DIR *FOO.*") the same
> as "*.*" remain unfixed?
> 
> Does anyone know of a patch to fix this?
> ----------

     Unfortunately, Messy-Dos does not support regular expression
pattern matching.  To fix this, you'd probably have to write your own
command.com-like shell (you could, I suppose, hack and slash
command.com to support *FOO.*, but the work involved in disassembling
command.com and finding a safe place to put the patch would probably
be as much work as writing your own shell).

     Sorry for the bad news.

     -- Darryl Okahata
        ucbvax!ucbcad!ames!hplabs!hpcea!hpsrla!darrylo		<== best path
	hplabs!hpcea!hpsrla!darrylo				<== alternative
	CompuServe: 75206,3074

Disclaimer: the above is the author's personal opinion and is not the
opinion or policy of his employer or of the little green men that
have been following him all day.

tj@mks.UUCP (05/02/87)

In article <5734@shemp.UCLA.EDU>, flowers@CS.UCLA.EDU writes:
> 
> Why does the fact that DOS treats *FOO.* (as in "DIR *FOO.*") the same
> as "*.*" remain unfixed?
> 
> Does anyone know of a patch to fix this?

DOS inherited from CP/M a very simplitic interpretation of "*":
it is replaced by as many "?"s as will fit.
"?" is defined to match " " as well as any other character
(remember that FOO.BAR is actually stored in the directory entry as
"FOO     BAR").
This whole kludge would be a nightmare to patch into something reasonable.
You can however simply junk command.com, and replace it with a real shell.
The Korn shell in the MKS Toolkit springs readily to mind.
Full UNIX-style globbing (wild-card expansion to those of you who were
not around before version 7): not only *foo.* but also *foo*, */*foo, */*/*.bar
work correctly. In fact all the Toolkit commands do proper globbing even
when invoked from command.com, but with the shell you can have the work done
for you even in the case of non-Toolkit commands.
Yes, i am closely involved with MKS.
-- 
     ll  // // ,~/~~\'   T. J. Thompson {decvax,ihnp4,seismo}!watmath!mks!tj
    /ll/// //l' `\\\     Mortice Kern Systems Inc.
   / l //_// ll\___/     43 Bridgeport Rd. E., Waterloo, ON, Can. N2J 2J4
O_/                      (519)884-2251