void DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val) { FILE * file; /* The manpage file. */ ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer; XawListReturnStruct * ret_struct = (XawListReturnStruct *) ret_val; file = FindManualFile(man_globals, man_globals->current_directory, ret_struct->list_index); PutUpManpage(man_globals, file); }
static FILE * DoManualSearch(ManpageGlobals * man_globals, char *string) { int e_num = NO_ENTRY; int i; /* search current section first. */ i = man_globals->current_directory; e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries); /* search other sections. */ if (e_num == NO_ENTRY) { i = 0; /* At the exit of the loop i needs to be the one we used. */ while (TRUE) { if (i == man_globals->current_directory) if (++i >= sections) return (NULL); e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries); if (e_num != NO_ENTRY) break; if (++i >= sections) return (NULL); } /* * Manual page found in some other section, unhighlight the current one. */ if (man_globals->manpagewidgets.box != NULL) XawListUnhighlight(man_globals->manpagewidgets. box[man_globals->current_directory]); } else { /* * Highlight the element we are searching for if it is in the directory * listing currently being shown. */ if (man_globals->manpagewidgets.box != NULL) XawListHighlight(man_globals->manpagewidgets.box[i], e_num); } return (FindManualFile(man_globals, i, e_num)); }