nexterr(void) { char *p,*q; int num= 0; static char erfile[80]; if(errbuf == NULL) { msg("No more error !!"); errbuf= errmsg->fwd; return(NG); } locate(1,(ldup == 0)? lastdisplay+1: ldup+1); rcls(); vtputs(errbuf->buffer); strncpy(erfile,errbuf->buffer,79); erfile[79]= '\0'; if((p= strchr(erfile,'.')) == NULL) { msg("Illegal error file <illegal extention>\a[%s]",erfile); return(NG); } *p= '\0';num= strlen(erfile); *p= '.'; for(++p;isalpha(*p);++p) if(*p == '\0') return(NG); *p= '\0'; p= &errbuf->buffer[num]; num= 0; for( ;!isdigit(*p);++p) if(*p == '\0') return(NG); while(isdigit(*p)) { num *= 10; num += (*p - '0'); ++p; } p= errbuf->buffer; errbuf= errbuf->fwd; if(lng == ASM && strchr(p,'+') == NULL) return(OK); return(searchnum(num,erfile)); }
// Redisplay the mode line for the window pointed to by winp. If popbuf is NULL, display a fully-formatted mode line containing // the current buffer's name and filename (but in condensed form if the current terminal width is less than 96 columns); // otherwise, display only the buffer name and filename of buffer "popbuf". This is the only routine that has any idea of how // the mode line is formatted. You can change the mode line format by hacking at this routine. Called by "update" any time // there is a dirty window. void wupd_modeline(EWindow *winp,Buffer *popbuf) { int c; int n; // Cursor position. Buffer *bufp; ModeSpec *msp; int lchar; int condensed = term.t_ncol < 80 ? -1 : term.t_ncol < 96 ? 1 : 0; char wkbuf[32]; // Work buffer. static struct { // Mode display parameters. int leadch,trailch; uint flags; } *mdp,md[] = { {'(',')',0}, {'[',']',0}, {-1,-1,0}}; n = winp->w_toprow + winp->w_nrows; // Row location. // Note that we assume that setting REVERSE will cause the terminal driver to draw with the inverted relationship of // fcolor and bcolor, so that when we say to set the foreground color to "white" and background color to "black", the // fact that "reverse" is enabled means that the terminal driver actually draws "black" on a background of "white". // Makes sense, no? This way, devices for which the color controls are optional will still get the "reverse" signals. vscreen[n]->v_left = 0; vscreen[n]->v_right = term.t_ncol; #if COLOR vscreen[n]->v_flags |= VFCHGD | VFCOLOR; // Redraw next time. vscreen[n]->v_rfcolor = 7; // Black on. vscreen[n]->v_rbcolor = 0; // White... #else vscreen[n]->v_flags |= VFCHGD; // Redraw next time. #endif vtmove(n,0); // Seek to right line. if(winp == curwp) // Make the current buffer stand out. lchar = '='; #if REVSTA else if(opflags & OPHAVEREV) lchar = ' '; #endif else lchar = '-'; // Full display? if(popbuf == NULL) { bufp = winp->w_bufp; vtputc((bufp->b_flags & BFTRUNC) ? '#' : lchar); // "#" if truncated. vtputc((bufp->b_flags & BFCHGD) ? '*' : lchar); // "*" if changed. vtputc((bufp->b_flags & BFNARROW) ? '<' : lchar); // "<" if narrowed. vtputc(' '); n = 4; // Display program name and version. if(!condensed) { sprintf(wkbuf,"%s %s ",Myself,Version); n += vtputs(wkbuf); } // Are we horizontally scrolled? if(winp->w_face.wf_fcol > 0) { sprintf(wkbuf,"[<%d] ",winp->w_face.wf_fcol); n += vtputs(wkbuf); } // Display the screen number if bottom window and there's more than one screen. if(winp->w_nextp == NULL && scrcount() > 1) { sprintf(wkbuf,"S%hu ",cursp->s_num); n += vtputs(wkbuf); } // Display keyboard macro recording state. if(kmacro.km_state == KMRECORD) n += vtputs("*R* "); // Display the line and/or column point position if enabled and winp is current window. if(winp == curwp) { if(curbp->b_modes & MDLINE) { sprintf(wkbuf,"L:%ld ",getlinenum(bufp,winp->w_face.wf_dot.lnp)); n += vtputs(wkbuf); } if(curbp->b_modes & MDCOL) { sprintf(wkbuf,"C:%d ",getccol()); n += vtputs(wkbuf); } } // Display the modes, in short form if condensed display. md[0].flags = modetab[MDR_GLOBAL].flags & modetab[MDR_SHOW].flags; md[1].flags = winp->w_bufp->b_modes; mdp = md; do { msp = ((c = mdp->leadch) == '[') ? bmodeinfo : gmodeinfo; do { if(mdp->flags & msp->mask) { n += vtputc(c); c = ' '; if(condensed >= 0) n += vtputs(msp->mlname); else { n += vtputc(msp->mlname[0]); if(msp->mlname[1] != '\0') n += vtputc(msp->mlname[1]); } } } while((++msp)->name != NULL); if(c != mdp->leadch) { n += vtputc(mdp->trailch); n += vtputc(' '); } } while((++mdp)->leadch > 0); #if 0 // Display internal modes on modeline. vtputc(lchar); vtputc((winp->w_flags & WFCOLOR) ? 'C' : lchar); vtputc((winp->w_flags & WFMODE) ? 'M' : lchar); vtputc((winp->w_flags & WFHARD) ? 'H' : lchar); vtputc((winp->w_flags & WFEDIT) ? 'E' : lchar); vtputc((winp->w_flags & WFMOVE) ? 'V' : lchar); vtputc((winp->w_flags & WFFORCE) ? 'F' : lchar); vtputc(lchar); n += 8; #endif n += wupd_tab(lchar); } else { n = 0; bufp = popbuf; vtputc(lchar); n += wupd_tab(lchar) + 1; } // Display the buffer name. n += vtputs(bufp->b_bname) + 1; vtputc(' '); // Display the filename in the remaining space using strfit(). if(bufp->b_fname != NULL) { char wkbuf[TT_MAXCOLS]; n += wupd_tab(lchar); if(condensed < 0) { vtputc(*text34); // "File: " vtputc(':'); vtputc(' '); n += 3; } else n += vtputs(text34); // "File: " n += vtputs(strfit(wkbuf,term.t_ncol - n - 1,bufp->b_fname,0)) + 1; vtputc(' '); } // If it's the current window, not a pop-up, "pwd" mode, and room still available, display the working directory as // well. if(winp == curwp && popbuf == NULL && (modetab[MDR_GLOBAL].flags & MDWKDIR) && ((int) term.t_ncol - n) > 12) { char *wdp; char wkbuf[TT_MAXCOLS]; n += wupd_tab(lchar); n += vtputs(text274); // "WD: " (void) getwkdir(&wdp,false); n += vtputs(strfit(wkbuf,term.t_ncol - n - 1,wdp,0)) + 1; vtputc(' '); } // Pad to full width. while(n < (int) term.t_ncol) { vtputc(lchar); ++n; } }