9 |
|
* 11/6/86 Finally added error checking! |
10 |
|
*/ |
11 |
|
|
12 |
– |
#include "standard.h" |
13 |
– |
|
14 |
– |
#include "paths.h" |
15 |
– |
|
12 |
|
#include <ctype.h> |
13 |
|
|
14 |
+ |
#include "standard.h" |
15 |
+ |
#include "platform.h" |
16 |
+ |
#include "paths.h" |
17 |
|
#include "object.h" |
19 |
– |
|
18 |
|
#include "otypes.h" |
19 |
|
|
20 |
|
int xac; /* global xform argument count */ |
40 |
|
|
41 |
|
int stdinused = 0; /* stdin has been used by -f option? */ |
42 |
|
|
43 |
< |
char mainfn[MAXPATH]; /* main file name */ |
43 |
> |
char mainfn[PATH_MAX]; /* main file name */ |
44 |
|
FILE *mainfp = NULL; /* main file pointer */ |
45 |
|
|
46 |
|
#define progname (xav[0]) |
887 |
|
openmain(iname) /* open input, changing directory for file */ |
888 |
|
char *iname; |
889 |
|
{ |
890 |
< |
static char origdir[MAXPATH]; |
891 |
< |
static char curfn[MAXPATH]; |
890 |
> |
static char origdir[PATH_MAX]; |
891 |
> |
static char curfn[PATH_MAX]; |
892 |
|
static int diffdir; |
893 |
|
register char *fpath; |
894 |
|
|
914 |
|
return; |
915 |
|
} |
916 |
|
if (mainfp == NULL) { /* first call, initialize */ |
917 |
< |
getwd(origdir); |
917 |
> |
getcwd(origdir, sizeof(origdir)); |
918 |
|
} else if (!strcmp(iname, curfn)) { /* just need to rewind? */ |
919 |
|
rewind(mainfp); |
920 |
|
return; |
928 |
|
} |
929 |
|
strcpy(curfn, iname); /* remember input name */ |
930 |
|
/* get full path for file */ |
931 |
< |
if ((fpath = getpath(iname, getlibpath(), R_OK)) == NULL) { |
931 |
> |
if ((fpath = getpath(iname, getrlibpath(), R_OK)) == NULL) { |
932 |
|
fprintf(stderr, "%s: cannot find file \"%s\"\n", |
933 |
|
progname, iname); |
934 |
|
exit(1); |