Wildcard expansion in Turbo C

der Mouse mouse at mcgill-vision.UUCP
Mon Mar 7 17:18:11 AEST 1988


In article <329 at gen1.UUCP>, bob at gen1.UUCP (Robert Kamins) writes:
> In <1282 at nmtsun.nmt.edu>, greg at nmtsun.nmt.edu (Greg Lindhorst) writes:
>> How can one get Turbo C to expand wild carded arguments on the
>> command line?
> [In UNIX, this is done by the shell.]  In MS-DOS-land, you get to do
> it all by yourself.

> I have a "glob" routine that does an MS-DOS wild-card expansion.  The
> trouble with MS-DOS expansion is that you can't easily glob stuff
> like "*c" and expect to get files with names like "ab.c".

Yes.  And ugh.  One weekend when I had MS-DOS inflicted on me, I
started to write a glob routine that behaved sensibly.  (It just told
DOS to expand "*.*" in the appropriate directory and then filtered out
what it wanted on its own.)  It's not finished, but if enough people
are desperate enough to want it, I can probably dig out and post the
part that is finished.

There is nothing inherently difficult about this; my main problem was
that the machine I was on had no editor I would consider civilized.  I
was also using Microsoft's C compiler, that being what was available.
(Not my machine; I would never be happy on anything that small.)  The
version I was using (I think it was version 4.something, for what
that's worth) would bugcheck fairly easily, for example on the program

main()
{
 ((unsigned char far (*)[2])0xb0000000)[(0)+(80*(0))][0] = 0;
}

Yes, that mess resulted from a macro expansion, and yes, I was trying
to write to screen memory.  When either of the two (0) terms is
replaced by a variable such as (i) or (j), the bugcheck disappeared.

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list