home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (C) 1993 Marc Stern (internet: stern@mble.philips.be) */
-
- #include <stdlib.h>
- #include <string.h>
- #include <dos.h>
- #include "tools.h"
-
-
- extern char **_argv; /* if not in Borland */
-
-
- /***
- *
- * Function : getpgmpath
- *
- * Topics : Transforms a filename into a full pathname
- * relative to program directory.
- *
- * Parameters : in/out char *filename filename
- *
- * Return : pointer to filename
- *
- ***/
-
- char *getpgmpath( char *filename )
-
- { char buffer[_MAX_PATH], *ptr;
-
- strcpy( buffer, filename );
- strcpy( filename, _argv[0] );
- ptr = strrchr(filename, '\\');
-
- if ( ! ptr ) { strcpy( filename, buffer );
- return filename;
- }
-
- strcpy( ptr + 1, buffer );
- strupr( filename );
-
- return filename;
- }