phboers@cs.vu.nl (02/23/89)
Lately I tried to print out some files together, using 'pr'. The result led me to a bug in pr.c. You can easily see it yourself: take a little file and type: pr -n file file file file file file file file | more You'll notice that the width will get smaller at every file. Another student at the university told me that there was another bug in pr.c, namely in the way the time is printed at the top of the pages. If the number of minutes is smaller than 10, 'pr' will print this number without a leading zero. A patch solving both bugs is included below, the patch is relative to version 1.3(d) as prof. A.S.Tanenbaum proposed when he posted version 1.4a. Peter Boersma VU Amsterdam Holland phboers@cs.vu.nl ------------------------------ patch for pr.c ------------------------------- *** pr.c.old Wed Feb 22 19:09:47 1989 --- pr.c Wed Feb 22 19:11:29 1989 *************** *** 386,392 **** linenr = 1; if (number) ! width -= NUM_WIDTH; do { /* Check printing of page */ --- 386,392 ---- linenr = 1; if (number) ! w -= NUM_WIDTH; do { /* Check printing of page */ *************** *** 420,426 **** printf("%7c ", ' '); /* 7 == NUM_WIDTH-1 */ pr_number = FALSE; cnt = 0; ! while (c != '\n' && c != EOF && cnt < width) { if (c=='\t') { int i, max; max = TO_TAB(cnt); --- 420,426 ---- printf("%7c ", ' '); /* 7 == NUM_WIDTH-1 */ pr_number = FALSE; cnt = 0; ! while (c != '\n' && c != EOF && cnt < w) { if (c=='\t') { int i, max; max = TO_TAB(cnt); *************** *** 530,534 **** } /* At this point, 'year', 'month', 'day', 'hour', 'minute' ok */ ! printf("\n\n%s %d %0d:%0d %d", moname[month], day + 1, hour + 0, minute, year); ! } --- 530,534 ---- } /* At this point, 'year', 'month', 'day', 'hour', 'minute' ok */ ! printf("\n\n%s %d %0d:%02d %d", moname[month], day + 1, hour + 0, minute, year); ! }