void runhelpsystem(unsigned int helpid) { char filename[15]; sprintf(filename,"hlp%5d.txt",helpid); runhelp(filename); }
/* Update the display and wait for an input event. */ int curses_runio(int *control) { int ch, i; for (;;) { render(); ch = tolower(getch()); switch (ch) { case '\r': case '\n': case KEY_ENTER: *control = ctl_button; return 1; case KEY_MOUSE: if (getmouseevent(control)) return 1; break; case '?': case KEY_F(1): if (!runhelp()) return 0; break; case '\022': if (!runruleshelp()) return 0; break; case '\026': if (!runlicensedisplay()) return 0; break; case '\001': changediechars(+1); break; case '\f': clearok(stdscr, TRUE); break; case KEY_RESIZE: initlayout(); break; case '\003': case '\030': return 0; case 'q': case '\033': if (controls[ctl_button].value == bval_newgame) return 0; break; case ERR: exit(1); default: for (i = 0 ; i < ctl_count ; ++i) { if (controls[i].key == ch) { *control = i; return 1; } } } } }
// executes a list of % separated commands // non-dot commands are assumed to be syslinux commands // All syslinux commands are appended with the contents of kerargs // If it fails (kernel not found) then the next one is tried in the // list // returns QUIT_CMD or RPT_CMD t_dotcmd execdotcmd(const char *cmd, char *defcmd, const char *kerargs) { char cmdline[MAX_CMD_LINE_LENGTH]; char dotcmd[MAX_CMD_LINE_LENGTH]; char *curr,*next,*p,*args; char ctr; strcpy(dotcmd,cmd); next = dotcmd; cmdline[0] = '\0'; while (*next) { // if something to do curr = next; p = strchr(next,'%'); if (p) { *p--='\0'; next=p+2; while (*p == ' ') p--; *(++p)='\0'; // remove trailing spaces } else { if (*defcmd) { // execute defcmd next next=defcmd; defcmd=NULL; // exec def cmd only once } else next=NULL; } // now we just need to execute the command "curr" curr = strip(curr); if (curr[0] != '.') { // just run the kernel strcpy(cmdline,curr); if (kerargs) strcat(cmdline,kerargs); runsyslinuximage(cmdline,0); // No IPAppend } else { // We have a DOT command // split command into command and args (may be empty) args = curr; while ( (*args != ' ') && (*args != '\0') ) args++; if (*args) { // found a space *args++ = '\0'; while (*args == ' ') args++; // skip over spaces } if ( (strcmp(curr,".exit")==0) || (strcmp(curr,".quit")==0) ) return QUIT_CMD; if ( (strcmp(curr,".repeat")==0) || (strcmp(curr,".ignore")==0) || (strcmp(curr,".wait")==0) ) return RPT_CMD; if (strcmp(curr,".beep")==0) { if ((args) && ('0' <= args[0]) && (args[0] <= '9')) ctr = args[0]-'0'; else ctr=1; for (;ctr>0; ctr--) beep(); } if (strcmp(curr,".help")==0) runhelp(args); } } return RPT_CMD; // by default we do not quit }
int main(int argc, char *argv[]) { if (argc < 2) { csprint("Usage: display.c32 <textfile>\n", 0x07); exit(1); } init_help(NULL); // No base dir, so all filenames must be absolute runhelp(argv[1]); close_help(); return 0; }
void genhelp () { runhelp ("general"); }