char * prsub(struct shpstr *sp) { if (mchr[(int)sp->shp_type].m_flags & M_SUB) return prbuf("sub #%d", sp->shp_uid); else return prship(sp); }
char * prnatid(natid cnum) { struct natstr *np = getnatp(cnum); if (CANT_HAPPEN(!np)) return prbuf("%d (#%d)", cnum, cnum); return prnat(np); }
/* * Print out the contents of the file f, one screenful at a time. */ void screen(FILE *f, int num_lines) { int ch; int nchars; int length; /* length of current line */ static int prev_len = 1; /* length of previous line */ for (;;) { while (num_lines > 0 && !Pause) { if ((nchars = get_line(f, &length)) == EOF) { if (clreol) clreos(); return; } if (ssp_opt && length == 0 && prev_len == 0) continue; prev_len = length; if (bad_so || (Senter && *Senter == ' ' && promptlen > 0)) erasep(0); /* * Must clear before drawing line since tabs on some * terminals do not erase what they tab over. */ if (clreol) cleareol(); prbuf(Line, length); if (nchars < promptlen) { /* erasep() sets promptlen to 0 */ erasep(nchars); } else promptlen = 0; #if 0 /* XXX - is this needed? */ if (clreol) { /* must clear again in case we wrapped * */ cleareol(); } #endif if (nchars < Mcol || !fold_opt) { /* will turn off UL if necessary */ prbuf("\n", 1); } if (nchars == STOP) break; num_lines--; } if (pstate) { tputs(ULexit, 1, putch); pstate = 0; } fflush(stdout); if ((ch = Getc(f)) == EOF) { if (clreol) clreos(); return; } if (Pause && clreol) clreos(); Ungetc(ch, f); Pause = 0; startup = 0; if ((num_lines = command(NULL, f)) == 0) return; if (hard && promptlen > 0) erasep(0); if (noscroll && num_lines >= dlines) { if (clreol) home(); else doclear(); } /* * XXX - should store the *first* line on the screen, * not the last (but we don't know the file position). * Fixing this requires keeping an arry of dline off_ts * and updating each one when a new line is started. */ screen_start.line = Currline; screen_start.chrctr = Ftell(f); } }
char * prnat(struct natstr *np) { return prbuf("%s (#%d)", np->nat_cnam, np->nat_cnum); }