/* * help_topic: Given a topic, we search the help directory, and try to * find the right file, if all is cool, and we can open it, or zcat it, * then we call help_prompt to get the actually displaying of the file * on the road. */ static void help_topic (char *path, char *name) { char *filename = (char *) 0; if (!name) return; /* what is the base name? */ malloc_sprintf(&filename, "%s/%s", path, name); if (filename[strlen(filename)-1] == '/') chop(filename, 1); /* let uzfopen have all the fun */ if ((help_fp = uzfopen(&filename, path, 1))) { /* Isnt this a heck of a lot better then the kludge you were using? */ help_put_it(name, "*** Help on %s", name); help_prompt(name, NULL); } else help_put_it (name, "*** No help available on %s: Use ? for list of topics", name); new_free(&filename); return; }
void help(char *command) { if(!command) help_ls(); else if(!strcmp(command, "help" )) help_help(); else if(!strcmp(command, "prompt" )) help_prompt(); else if(!strcmp(command, "init" )) help_init(); else if(!strcmp(command, "drop" )) help_drop(); else if(!strcmp(command, "create-service")) help_create_service(); else if(!strcmp(command, "list" )) help_list(); else if(!strcmp(command, "switch" )) help_switch(); else if(!strcmp(command, "back" )) help_back(); else if(!strcmp(command, "book" )) help_book(); else if(!strcmp(command, "service" )) help_service(); else if(!strcmp(command, "bill" )) help_bill(); else if(!strcmp(command, "checkout" )) help_checkout(); else error_print("Unknown command!"); }
/* * help_prompt: The main procedure called to display the help file * currently being accessed. Using add_wait_prompt(), it sets it * self up to be recalled when the next page is asked for. If * called when we have finished paging the help file, we exit, as * there is nothing left to show. If line is 'q' or 'Q', exit the * help pager, clean up, etc.. If all is cool for now, we call * show_help, and either if its finished, exit, or prompt for the * next page. From here, if we've finished the help page, and * doing help prompts, prompt for the help.. */ static void help_prompt (char *name, char *line) { if (finished_help_paging) { if (*paused_topic) help_show_paused_topic(paused_topic, empty_string); return; } if (line && toupper(*line) == 'Q') { finished_help_paging = 1; fclose(help_fp); help_fp = NULL; } if (show_help(help_window, name)) { if (dumb_mode) help_prompt(name, NULL); else add_wait_prompt("*** Hit any key for more, 'q' to quit ***", help_prompt, name, WAIT_PROMPT_KEY, 1); } else { finished_help_paging = 1; if (help_fp) fclose(help_fp); help_fp = NULL; if (help_show_directory) { if (get_int_var(HELP_PAGER_VAR)) { if (dumb_mode) help_show_paused_topic(name, empty_string); else add_wait_prompt("*** Hit any key to end ***", help_show_paused_topic, paused_topic, WAIT_PROMPT_KEY, 1); } else { help_show_paused_topic(paused_topic, empty_string); set_help_screen((Screen *) 0); } help_show_directory = 0; return; } } if (finished_help_paging) { if (get_int_var(HELP_PROMPT_VAR)) { char tmp[BIG_BUFFER_SIZE + 1]; snprintf(tmp, sizeof tmp, "%s%sHelp? ", help_topic_list, *help_topic_list ? " " : empty_string); if (!dumb_mode) add_wait_prompt(tmp, help_me, help_topic_list, WAIT_PROMPT_LINE, 1); } else { if (*paused_topic) help_show_paused_topic(paused_topic, empty_string); #if 0 set_help_screen((Screen *) 0); #endif } } }