bool cp_oddcomm(char *s, wordlist *wl) { FILE *fp; if ((fp = inp_pathopen(s, "r")) != NULL) { char buf[BSIZE_SP]; wordlist *setarg; (void) fclose(fp); (void) sprintf(buf, "argc = %d argv = ( ", wl_length(wl)); while (wl) { (void) strcat(buf, wl->wl_word); (void) strcat(buf, " "); wl = wl->wl_next; } (void) strcat(buf, ")"); setarg = cp_lexer(buf); com_set(setarg); wl_free(setarg); inp_source(s); cp_remvar("argc"); cp_remvar("argv"); return (TRUE); } if (wl && eq(wl->wl_word, "=")) { wordlist *ww = wl_cons(copy(s), wl); com_let(ww); wl_delete_slice(ww, ww->wl_next); return (TRUE); } return (FALSE); }
bool cp_oddcomm(char *s, wordlist *wl) { FILE *fp; char buf[BSIZE_SP]; wordlist ww; if ((fp = inp_pathopen(s, "r"))) { (void) fclose(fp); (void) sprintf(buf, "argc = %d argv = ( ", wl_length(wl)); while (wl) { (void) strcat(buf, wl->wl_word); (void) strcat(buf, " "); wl = wl->wl_next; } (void) strcat(buf, ")"); com_set(cp_lexer(buf)); inp_source(s); cp_remvar("argc"); cp_remvar("argv"); return (TRUE); } else if (wl && eq(wl->wl_word, "=")) { ww.wl_next = wl; wl->wl_prev = &ww; ww.wl_prev = NULL; ww.wl_word = s; com_let(&ww); return (TRUE); } else return (FALSE); }