Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!ukc!edcastle!djm From: djm@castle.ed.ac.uk (D Murphy) Newsgroups: comp.sys.ibm.pc Subject: Re: What interprets *.* Message-ID: <450@castle.ed.ac.uk> Date: 20 Sep 89 13:11:37 GMT References: <635.25170D1F@mudos.ann-arbor.mi.us> Reply-To: djm@castle.ed.ac.uk (D Murphy) Organization: Edinburgh University Chemistry Lines: 33 In article <635.25170D1F@mudos.ann-arbor.mi.us> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes: >In article <32164@ames.arc.nasa.gov>, gahooten@titan (Gregory A. Hooten) writes: > >In Unix, it is the shell that interprets the character *, what in > >DOS will do the same thing? Is it left to the Command.com, or is it > >left to each utility to do on its own? > >Each program has to do it on its own. This is actually much worse >than COMMAND.COM doing it for you, because then you have differing >interpretations of things like "*89.*" (does it mean "*.*", like >COMMAND.COM thinks it does, or "any file with `89' in the name", >like some other utilities do?), plus the bother of having to code the >wildcard handling into programs that you write. >Marc Unangst Yes, each program has to contain wildcard handling routines, BUT DOS does it for you. You use the DOS functions 4Eh and 4Fh. 4Eh is `Find First File', and you pass as argument in DS:DX an ASCIIZ string containing the pathname you want to match. Any *'s are expanded to fill remaining space with ? characters (which is why an attempt to copy *.TXT with no matches gives the message ????????.TXT file not found). Anyway, the matched filename is placed at offset 1Eh from the disk transfer address (default PSP:80h, or you can set it with DOS function 1Eh if you want your own) and ASCIIZed. A subsequent call to 4Fh will either find the next matching file (you MUST NOT alter the DTA or this won't work) or return 18 in AX meaning there were no further matches. I don't think DOS will allow *89.* - it will allow 89*.*, which is expanded to 89??????.??? since the wildcard handling is somewhat primitive. The above does not work for DOS 1.0, it certainly works for 3.2 and maybe for 2.0, but I'm not sure. Murff.....