Mail Archives: djgpp/1997/02/13/22:37:24
aho450s AT nic DOT smsu DOT edu (Tony O'Bryan) writes:
>
> On 2 Feb 1997 20:53:35 GMT, an096 AT yfn DOT ysu DOT edu (David A. Scott) wrote:
>
> >95 seems to be a casturated version. How does one even
> >get a list of the commands the Dos supports.
>
> Type "help" at the command prompt.
Here's a small program that I wrote that seems along these
lines. It's really just a useful emulation of the Un*x which
command -- compile to which.exe and place on your path :)
/* You are free to use and do whatever you want with this code */
#include <stdio.h>
#include <dir.h>
int
main(int argc, char **argv)
{
int i,j;
const char *ext[] = { "com", "exe", "bat" };
const char* where;
char buf[256]; /* if this is not big enough, get a life */
for (i=1; i<argc; i++) {
where = NULL;
for (j=0; j<3; j++) {
sprintf(buf, "%s.%s", argv[i], ext[j]);
if ((where = searchpath(buf))) {
printf("%s\n", where);
break;
}
}
if (where==NULL)
printf("%s not found\n", argv[i]);
}
return 0;
}
--
-John
- Raw text -