void AddStandardSections( SectionList **list, char * path) { #ifdef CRAY AddStandardCraySections(list, path); return; #else register int i; char file[BUFSIZ]; int numSections = sizeof(SectionNames) / sizeof(SectionNames[0]); for (i=0; i < numSections; i++) { snprintf(file, sizeof(file), "%s%s", SEARCHDIR, SectionNames[i].suffix); AddNewSection(list, path, file, SectionNames[i].name, TRUE); #ifdef SEARCHOTHER snprintf(file, sizeof(file), "%s%s", SEARCHOTHER, SectionNames[i].suffix); AddNewSection(list, path, file, SectionNames[i].name, TRUE); #endif } #endif }
void AddStandardCraySections( SectionList **list, char *path) { char file[BUFSIZ]; int i; #define NoSuf (char *)0 #define Suffix (char *)1 #define Fold (char *)2 #define FoldSuffix (char *)3 static char *cname[] = { "(1) User Commands", Suffix, "1", "1bsd", NULL, "(1) User Commands (instant)", NoSuf, "1r", "1rb", NULL, "(1m) System Administration", NoSuf, "1m", NULL, "(2) System Calls", Suffix, "2", NULL, "(3) Subroutines", FoldSuffix, "3", "3bsd", "3c", "3m", "3mt", "3s", "3sl", "3z", NULL, "(3) Subroutines (FORTRAN)", Fold, "3f", NULL, "(3) Subroutines (I/O)", Fold, "3io", NULL, "(3) Subroutines (X11)", NoSuf, "3X11", NULL, "(3) Subroutines (Xt)", NoSuf, "3Xt", NULL, "(3) Subroutines (misc.)", Suffix, "3q", NULL, "(3) Subroutines (misc.)", Fold, "3x", NULL, "(3) Subroutines (networking)", Suffix, "3n", "3rpc", "3svc", "3w", "3yp", NULL, "(3) Subroutines (scientific)", Fold, "3sci", NULL, "(3) Subroutines (utilities)", FoldSuffix, "3db", "3u", NULL, "(4) Devices", Suffix, "4", "4d", "4f", "4n", "4p", "4s", NULL, "(5) File Formats", Suffix, "5", NULL, "(6) Games", Suffix, "6", NULL, "(7) Miscellaneous", Suffix, "7", NULL, "(8) Sys. Administration", NoSuf, "8", NULL, "(l) Local", Suffix, "l", NULL, "(n) New", Suffix, "n", NULL, "(o) Old", Suffix, "o", NULL, "(info) Information", NoSuf, "info", NULL, "(osi) Miscellaneous", NoSuf, "osi", NULL, "(sl) Miscellaneous", NoSuf, "sl", NULL, "(ultra) Miscellaneous", NoSuf, "ultra", NULL, NULL }; char **p = cname; while (*p != NULL) { char *message = *p++; int flags = (int) *p++; while (*p != NULL) { snprintf(file, sizeof(file), "%s%s", SEARCHDIR, *p++); AddNewSection(list, path, file, message, flags); } p++; } }
static void ReadMandescFile(SectionList ** section_list, char *path) { char mandesc_file[BUFSIZ]; /* full path to the mandesc file. */ FILE *descfile; char string[BUFSIZ], local_file[BUFSIZ]; Boolean use_defaults = TRUE; char *cp; snprintf(mandesc_file, sizeof(mandesc_file), "%s/%s", path, MANDESC); if ((descfile = fopen(mandesc_file, "r")) != NULL) { while (fgets(string, BUFSIZ, descfile) != NULL) { string[strlen(string) - 1] = '\0'; /* Strip off the CR. */ if (streq(string, NO_SECTION_DEFAULTS)) { use_defaults = FALSE; continue; } if ((cp = strchr(string, '\t')) != NULL) { char *s; *cp++ = '\0'; strcpy(local_file, MAN); strcat(local_file, string); if ((s = strchr(cp, '\t')) != NULL) { *s++ = '\0'; if (streq(s, SUFFIX)) AddNewSection(section_list, path, local_file, cp, MSUFFIX); else if (streq(s, FOLD)) AddNewSection(section_list, path, local_file, cp, MFOLD); else if (streq(s, FOLDSUFFIX)) AddNewSection(section_list, path, local_file, cp, MFOLDSUFFIX); else AddNewSection(section_list, path, local_file, cp, MNULL); } else AddNewSection(section_list, path, local_file, cp, MNULL); } else { snprintf(local_file, sizeof(local_file), "%s%c", MAN, string[0]); AddNewSection(section_list, path, local_file, (string + 1), FALSE); #ifdef SEARCHOTHER snprintf(local_file, sizeof(local_file), "%s%c", SEARCHOTHER, string[0]); AddNewSection(section_list, path, local_file, (string + 1), FALSE); #endif } } fclose(descfile); } if (use_defaults) AddStandardSections(section_list, path); }