| 4 |
|
/* |
| 5 |
|
* getpath.c - function to search for file in a list of directories |
| 6 |
|
* |
| 7 |
< |
* External symbols declared in standard.h |
| 7 |
> |
* External symbols declared in rtio.h |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
|
#include "copyright.h" |
| 13 |
|
#include <ctype.h> |
| 14 |
|
|
| 15 |
|
#include "rtio.h" |
| 16 |
+ |
#include "paths.h" |
| 17 |
|
|
| 18 |
|
|
| 19 |
< |
#ifdef _WIN32 |
| 19 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 20 |
|
static char * |
| 21 |
|
core_getpath /* wrapped below: expand fname, return full path */ |
| 22 |
|
#else |
| 24 |
|
getpath /* expand fname, return full path */ |
| 25 |
|
#endif |
| 26 |
|
( |
| 27 |
< |
register char *fname, |
| 28 |
< |
register char *searchpath, |
| 29 |
< |
int mode |
| 27 |
> |
char *fname, |
| 28 |
> |
char *searchpath, |
| 29 |
> |
int mode |
| 30 |
|
) |
| 31 |
|
{ |
| 32 |
|
static char pname[PATH_MAX]; |
| 33 |
|
char uname[512]; |
| 34 |
< |
register char *cp; |
| 34 |
> |
char *cp; |
| 35 |
|
int i; |
| 36 |
|
|
| 37 |
|
if (fname == NULL) { return(NULL); } |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
|
| 85 |
< |
#ifdef _WIN32 |
| 85 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 86 |
|
/* This is a wrapper around the above, "emulating" access mode X_OK, |
| 87 |
|
which is not supported on Windows. |
| 88 |
|
If we see X_OK and the filename has no extension, then we'll remove |
| 93 |
|
*/ |
| 94 |
|
char * |
| 95 |
|
getpath( /* expand fname, return full path */ |
| 96 |
< |
register char *ffname, |
| 97 |
< |
register char *searchpath, |
| 98 |
< |
int mode |
| 96 |
> |
char *ffname, |
| 97 |
> |
char *searchpath, |
| 98 |
> |
int mode |
| 99 |
|
) |
| 100 |
|
{ |
| 101 |
< |
register char *cp; |
| 101 |
> |
char *cp; |
| 102 |
|
char fname[PATH_MAX]; |
| 103 |
|
|
| 104 |
|
if (ffname == NULL) |