version 1.3, 1999/11/17 15:34:13 |
version 1.4, 2000/01/12 17:49:53 |
|
|
|
|
static struct path_entry *new_path_entry __P((const char *)); |
static struct path_entry *new_path_entry __P((const char *)); |
static void ensure_m4path __P((void)); |
static void ensure_m4path __P((void)); |
static FILE *dopath __P((const char *)); |
static struct input_file *dopath __P((struct input_file *, const char *)); |
|
|
static struct path_entry * |
static struct path_entry * |
new_path_entry(dirname) |
new_path_entry(dirname) |
|
|
} |
} |
|
|
static |
static |
FILE * |
struct input_file * |
dopath(filename) |
dopath(i, filename) |
|
struct input_file *i; |
const char *filename; |
const char *filename; |
{ |
{ |
char path[MAXPATHLEN]; |
char path[MAXPATHLEN]; |
struct path_entry *pe; |
struct path_entry *pe; |
FILE *file; |
FILE *f; |
|
|
for (pe = first; pe; pe = pe->next) { |
for (pe = first; pe; pe = pe->next) { |
snprintf(path, sizeof(path), "%s/%s", pe->name, filename); |
snprintf(path, sizeof(path), "%s/%s", pe->name, filename); |
if ((file = fopen(path, "r")) != 0) |
if ((f = fopen(path, "r")) != 0) { |
return file; |
set_input(i, f, path); |
|
return i; |
|
} |
} |
} |
return NULL; |
return NULL; |
} |
} |
|
|
FILE * |
struct input_file * |
fopen_trypath(filename) |
fopen_trypath(i, filename) |
|
struct input_file *i; |
const char *filename; |
const char *filename; |
{ |
{ |
FILE *f; |
FILE *f; |
|
|
f = fopen(filename, "r"); |
f = fopen(filename, "r"); |
if (f) |
if (f != NULL) { |
return f; |
set_input(i, f, filename); |
|
return i; |
|
} |
if (filename[0] == '/') |
if (filename[0] == '/') |
return NULL; |
return NULL; |
|
|
ensure_m4path(); |
ensure_m4path(); |
|
|
return dopath(filename); |
return dopath(i, filename); |
} |
} |
|
|
|
|
|
|