5 #define isspace(c) ((c)==' ' || (c)=='\t' || (c)=='\n')
8 * skip past all systems in equivlist
17 sp = strchr(base, '!');
21 if(lookup(base, "equivlist", &fp, 0, 0)==1){
22 /* found or us, forget this system */
26 /* no files or system is not found, and not us */
35 okfile(char *cp, Biobuf *fp)
45 /* one iteration per system name in the file */
46 while(buf = Brdline(fp, '\n')) {
47 ep = &buf[Blinelen(fp)];
48 for(bp=buf; bp < ep;){
49 while(isspace(*bp) || *bp==',')
51 if(strncmp(bp, cp, len) == 0) {
53 if(isspace(c) || c==',')
56 while(bp < ep && (!isspace(*bp)) && *bp!=',')
61 /* didn't find it, prohibit forwarding */
65 /* return 1 if name found in one of the files
66 * 0 if name not found in one of the files
67 * -1 if neither file exists
70 lookup(char *cp, char *local, Biobuf **lfpp, char *global, Biobuf **gfpp)
72 static String *file = 0;
77 abspath(local, UPASLIB, s_restart(file));
78 if (*lfpp != 0 || (*lfpp = sysopen(s_to_c(file), "r", 0)) != 0) {
79 if (okfile(cp, *lfpp))
85 abspath(global, UPASLIB, s_restart(file));
86 if (*gfpp != 0 || (*gfpp = sysopen(s_to_c(file), "r", 0)) != 0) {
87 if (okfile(cp, *gfpp))
92 return (local || global)? 0 : -1;