www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/13/22:37:24

From: John Hagelgans <jhagelga AT btsdev28 DOT develop DOT nyc DOT dbna DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DOS HELP NEEDED
Date: 13 Feb 1997 16:34:44 -0500
Organization: Deutsche Bank North America
Lines: 43
Message-ID: <tkisp30xudn.fsf@btsdev28.develop.nyc.dbna.com>
References: <5d2usf$5h8 AT news DOT ysu DOT edu> <32f5fc1b DOT 2843413 AT ursa DOT smsu DOT edu>
NNTP-Posting-Host: btsdev28.develop.nyc.dbna.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019