From: luke AT jet DOT msk DOT su (Oleg Yu. Polyanski) Newsgroups: comp.os.msdos.djgpp Subject: Re: using redir Date: 19 Jun 1998 13:18:55 +0400 Organization: Jet Infosystems Lines: 27 Message-ID: References: NNTP-Posting-Host: goliath.service.jet.msk.su Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >>>>> "Eli" == Eli Zaretskii writes: Eli, why this program if we already have ported `which'? >> Next question : Is there any command available like 'which' in UNIX >> ? Eli> You can easily write it yourself, using the library function Eli> __dosexec_find_on_path. For example (untested!): Eli> #include #include #include Eli> Eli> int main (int argc, char *argv[]) { char Eli> full_path[FILENAME_MAX]; extern char **environ; Eli> if (argc <= 1) { printf ("Usage: %s progname\n", argv[0]); Eli> return 0; } Eli> if (__dosexec_find_on_path (argv[1], (char **)0, full_path) Eli> == NULL && __dosexec_find_on_path (argv[1], environ, full_path) Eli> == NULL) printf ("%s: Command not found\n", argv[1]); else printf Eli> ("%s\n", full_path); Eli> return 0; } /Oleg