6 FILE *lookup_file(const char *name,const char *suffix,const char *dir)
7 /* éÝÅÔ ÆÁÊÌ ÓÎÁÞÁÌÁ × ÔÅËÕÝÅÊ ÄÉÒÅËÔÏÒÉÉ, ÐÏÔÏÍ × ÄÉÒÅËÔÏÒÉÉ
8 dir × ÔÅËÕÝÅÊ ÄÉÒÅËÔÏÒÉÉ, ÐÏÔÏÍ × /usr/local/lib/fgis/$dir */
9 { char namebuf[1024],pathbuf[1024];
13 if (strlen(name)<strlen(suffix)||
14 strcmp(name+strlen(name)-strlen(suffix),suffix))
15 strcat(namebuf,suffix);
16 if (!stat(namebuf,&buf)) return fopen(namebuf,"r");
20 if (pathbuf[strlen(dir)-1]!='/'){ pathbuf[strlen(dir)]='/';
21 pathbuf[strlen(dir)+1]=0;
23 strcat(pathbuf,namebuf);
24 strcpy(namebuf,pathbuf);
25 if (!stat(namebuf,&buf)) return fopen(namebuf,"r");
27 strcat(strcpy(pathbuf,LIBDIR),namebuf);
28 if (!stat(pathbuf,&buf)) return fopen(pathbuf,"r");