void token(char *lin,char *tok[],int *ntok,char *outbuff) { int jj; int tj; char *cp; char *p2 = NULL; *ntok = 0; in_quote = false; if (table_loaded==false) token_init(); cp = lin; cp = find_non_space(cp); while (*cp!=0) { if (*cp==' ' || *cp==' ') { *cp = ' '; cp = find_non_space(cp); } if (*cp == '!') goto endofline; p2 = find_term(cp); jj = p2-cp+1; if (jj==0) goto endofline; add_tok(cp,jj); cp = p2 + 1 ; if (*ntok>280) subscript(); } endofline:; if (*ntok>0) { if ( (*tok[*ntok])=='\n' ) (*ntok)--; if (strcmp(tok[*ntok]," ")==0) (*ntok)--; if (*ntok>0) p2 = tok[*ntok] + strlen(tok[*ntok]) - 1; if (*p2==10) *p2 = 0; } }
int main(int argc, char **argv, char **envp) { char *env; env = find_term(envp); useless_check(argc, argv); if (tgetent(NULL, env) == -1) my_error("Error with syscall tgetent"); free(env); display_menu(); my_choice(); return (0); }