|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 1123 (0x463) Types: TextFile Names: »prt.c.orig«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Adv/Program/prt.c.orig«
/* * Print string s in an orderly fashion. (Provide linebreaks * where necessary.) */ #include "adv.h" int (*nl_proc)(); /* if not null, called before printing \n */ static char pbuf[256]; static int pp; prt(s) register char *s; { if (s == 0) { pflush(); return; } while (*s) if (*s == '\n') { pflush(); if (nl_proc) (*nl_proc)(); Wputc(*s++, CurWin); } else pput(*s++); } /* * Put character into buffer up to blank; then flush buffer * If current character would "spill over", go to next line. */ pput(c) register int c; { register char *p; pbuf[pp++] = c; if (CurWin->w_cursor.col + pp >= COLS) { p = &pbuf[pp]; *p = 0; while (--p >= pbuf) if (*p == ' ') break; if (p < pbuf) p = &pbuf[pp]; c = *p; *p = 0; Wputs(pbuf, CurWin); *p = c; if (CurWin->w_cursor.col) { if (nl_proc) (*nl_proc)(); Wputc('\n', CurWin); } while (*p == ' ') p++; if (*p) { strcpy(pbuf, p); pp = strlen(pbuf); } else pp = 0; } } /* * Write the buffered chars to the window */ pflush() { pbuf[pp] = 0; Wputs(pbuf, CurWin); pp = 0; }