From 729490c212774f5b0aade0f632a9a5aa82708803 Mon Sep 17 00:00:00 2001 From: ceriel Date: Sat, 7 Feb 1987 00:35:16 +0000 Subject: [PATCH] *** empty log message *** --- mach/proto/top/top.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index c4af8ecd3..62f498d1b 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -155,9 +155,9 @@ fill_window(w,len) write_first(w) queue w; { - instr_p ip; + register instr_p ip = qhead(w); - write_instr(ip = qhead(w)); + fputs(ip->line, stdout); remove_head(w); oldinstr(ip); } @@ -524,14 +524,15 @@ static bool junk_state = FALSE; /* TRUE while processing a very long line */ instr_p read_instr() { - register instr_p ip; + instr_p ip; register int c; register char *p; + register FILE *inp = stdin; char *plim; ip = newinstr(); plim = &ip->line[MAXLINELEN]; - if (( c = getchar()) == EOF) return NIL; + if (( c = getc(inp)) == EOF) return NIL; for (p = ip->line; p < plim;) { *p++ = c; if (c == '\n') { @@ -540,26 +541,15 @@ instr_p read_instr() junk_state = FALSE; return ip; } - c = getchar(); + c = getc(inp); } - ungetc(c,stdin); + ungetc(c,inp); *p = '\0'; junk_state = ip->state = JUNK; return ip; } -write_instr(ip) - instr_p ip; -{ - register char *p; - - for (p = ip->line; *p != '\0'; p++) { - putchar(*p); - } -} - - /* Core allocation. * As all instruction struct have the same size we can re-use every struct. -- 2.34.1