| return imp; |
return imp; |
| } |
} |
| |
|
| /* index of last '/' or '\' in file, 0 if there is none. !! Hmm, could |
/* index of last '/' or '\' in file, 0 if there is none. */ |
| be implemented with strrchr and the separator should be |
|
| OS-dependent */ |
|
| int onlypath(char *file) |
int onlypath(char *file) |
| { |
{ |
| int i; |
return strrchr(file, DIRSEP)-file; |
| i=strlen(file); |
|
| while (i) { |
|
| if (file[i]=='\\' || file[i]=='/') break; |
|
| i--; |
|
| } |
|
| return i; |
|
| } |
} |
| |
|
| FILE *openimage(char *fullfilename) |
FILE *openimage(char *fullfilename) |
| char fullfilename[dirlen+strlen(imagename)+2]; |
char fullfilename[dirlen+strlen(imagename)+2]; |
| |
|
| memcpy(fullfilename, path, dirlen); |
memcpy(fullfilename, path, dirlen); |
| if (fullfilename[dirlen-1]!='/') |
if (fullfilename[dirlen-1]!=DIRSEP) |
| fullfilename[dirlen++]='/'; |
fullfilename[dirlen++]=DIRSEP; |
| strcpy(fullfilename+dirlen,imagename); |
strcpy(fullfilename+dirlen,imagename); |
| return openimage(fullfilename); |
return openimage(fullfilename); |
| } |
} |
| FILE * image_file=NULL; |
FILE * image_file=NULL; |
| char *origpath=path; |
char *origpath=path; |
| |
|
| if(strchr(imagename, '/')==NULL) { |
if(strchr(imagename, DIRSEP)==NULL) { |
| /* first check the directory where the exe file is in !! 01may97jaw */ |
/* first check the directory where the exe file is in !! 01may97jaw */ |
| if (onlypath(progname)) |
if (onlypath(progname)) |
| image_file=checkimage(progname, onlypath(progname), imagename); |
image_file=checkimage(progname, onlypath(progname), imagename); |