| 12 |
|
|
| 13 |
|
#include "paths.h" |
| 14 |
|
|
| 15 |
– |
char *libpath = NULL; /* library search path */ |
| 15 |
|
|
| 17 |
– |
|
| 16 |
|
FILE * |
| 17 |
|
fropen(fname) /* find file and open for reading */ |
| 18 |
|
register char *fname; |
| 19 |
|
{ |
| 20 |
< |
extern char *strcpy(), *getenv(); |
| 20 |
> |
extern char *strcpy(), *getlibpath(); |
| 21 |
|
FILE *fp; |
| 22 |
|
char pname[MAXPATH]; |
| 23 |
|
register char *sp, *cp; |
| 27 |
|
|
| 28 |
|
if (ISDIRSEP(fname[0]) || fname[0] == '.') /* absolute path */ |
| 29 |
|
return(fopen(fname, "r")); |
| 32 |
– |
|
| 33 |
– |
if (libpath == NULL) { /* get search path */ |
| 34 |
– |
libpath = getenv(ULIBVAR); |
| 35 |
– |
if (libpath == NULL) |
| 36 |
– |
libpath = DEFPATH; |
| 37 |
– |
} |
| 30 |
|
/* check search path */ |
| 31 |
< |
sp = libpath; |
| 31 |
> |
sp = getlibpath(); |
| 32 |
|
do { |
| 33 |
|
cp = pname; |
| 34 |
|
while (*sp && (*cp = *sp++) != PATHSEP) |