void sig_handler(int sig) { if (sig == SIGSEGV) { ft_putstr("parse error\n"); execve(returncurr(NULL, NULL), NULL, g_environ); return ; } ft_putchar('\n'); if (!returnrun(0, 0)) putprompt(); }
void setvideomode(int ax, int bx, int cx, int dx) { if (g_disk_flag) { enddisk(); } if (videoflag) { endvideo(); videoflag = 0; } g_good_mode = true; switch (g_dot_mode) { case 0: // text clear(); /* touchwin(curwin); */ wrefresh(curwin); break; case 11: startdisk(); dotwrite = writedisk; dotread = readdisk; lineread = normalineread; linewrite = normaline; break; case 19: // X window putprompt(); dotwrite = writevideo; dotread = readvideo; lineread = readvideoline; linewrite = writevideoline; videoflag = 1; startvideo(); setforgraphics(); break; default: std::printf("Bad mode %d\n", g_dot_mode); exit(-1); } if (g_dot_mode != 0) { loaddac(); g_and_color = g_colors - 1; g_box_count = 0; } g_vesa_x_res = g_screen_x_dots; g_vesa_y_res = g_screen_y_dots; }
union node * parsecmd(interact) { int t; doprompt = interact; if (doprompt) putprompt(ps1val()); needprompt = 0; if ((t = readtoken()) == TEOF) return NEOF; if (t == TNL) return NULL; tokpushback++; return list(1); }
STATIC void parseheredoc() { struct heredoc *here; union node *n; while (heredoclist) { here = heredoclist; heredoclist = here->next; if (needprompt) { putprompt(ps2val()); needprompt = 0; } readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX, here->eofmark, here->striptabs); n = (union node *)stalloc(sizeof (struct narg)); n->narg.type = NARG; n->narg.next = NULL; n->narg.text = wordtext; n->narg.backquote = backquotelist; here->here->nhere.doc = n; } }
STATIC int xxreadtoken() { register c; if (tokpushback) { tokpushback = 0; return lasttoken; } if (needprompt) { putprompt(ps2val()); needprompt = 0; } startlinno = plinno; for (;;) { /* until token or start of word found */ c = pgetc_macro(); if (c == ' ' || c == '\t') continue; /* quick check for white space first */ switch (c) { case ' ': case '\t': continue; case '#': while ((c = pgetc()) != '\n' && c != PEOF); pungetc(); continue; case '\\': if (pgetc() == '\n') { startlinno = ++plinno; if (doprompt) putprompt(ps2val()); continue; } pungetc(); goto breakloop; case '\n': plinno++; needprompt = doprompt; RETURN(TNL); case PEOF: RETURN(TEOF); case '&': if (pgetc() == '&') RETURN(TAND); pungetc(); RETURN(TBACKGND); case '|': if (pgetc() == '|') RETURN(TOR); pungetc(); RETURN(TPIPE); case ';': if (pgetc() == ';') RETURN(TENDCASE); pungetc(); RETURN(TSEMI); case '(': RETURN(TLP); case ')': RETURN(TRP); default: goto breakloop; } } breakloop: return readtoken1(c, BASESYNTAX, (char *)NULL, 0); #undef RETURN }