/* * findsys() looks up a system name in the SYSTEMS file, then returns a * pointer to the SYSTEMS line for that file. */ #include #include "news.h" #include "cico.h" char * findsys(system) char *system; { char cur[9]; /* system on this line of SYSTEMS */ FILE *sysfile; static char arg[400]; /* semi-processed current line */ if (strlen(system) > 7) system[7] = 0; if (sysfile = fopen(makepath(arg, NETDIR, SYSTEMS), "r")) { while (rdline(sysfile, arg, sizeof arg)) if (sscanf(arg, "%7s", cur) == 1 && strcmp(system,cur) == 0) { fclose(sysfile); return arg; } fclose(sysfile); } return (char *)0; } /* findsys */