/*****************************************************************************\ * * Name: _system.c * * Purpose: Source for dd_FindFileOnPath(), which searches the given * environment variable and finds a .exe, .com or .dll file * on that "path" (ie the path can be the name of any env * variable). * * Revision History: * 05/14/91 - Dave Steckler - Created * \*****************************************************************************/ #include #include #include #include #define INCL_DOSDLL_SUPFUNCS #include #include "llibcd.h" static int _CheckFile(char *pszFileName, char *pszProgName, char *pszPathElem, unsigned short usPathElemLen, char *pszExt, BOOL fPathSpecified, BOOL fDotSpecified); /*****************************************************************************\ * * This routine scans the path for the .exe, .com, or .dll file * given and returns pszFileName set to the fully qualified path to that * file. This function basically just sets things up for CheckFile to do * the real work. * \****************************************************************************/ int dd_FindFileOnPath( char *pszProgName, char *pszFileName, char *pszPath ) { char * pszSemicolon; char * apszExt[] = { ".EXE", ".COM", ".DLL" }; char * pszThePath; unsigned short usNumExt = 3; unsigned short usLen; int iReturn; BOOL fPathSpecified; BOOL fDotSpecified; unsigned short i; /* * Check out the program name. If there is a \ in it, don't bother * looking down the path. If there is a . in it, don't bother adding * extensions when looking down the path. */ fPathSpecified = (strchr(pszProgName, '\\') != NULL); fDotSpecified = (strchr(pszProgName, '.') != NULL); /* * For each extension. */ for (i=0 ; i