Deleted Added
full compact
read.c (11411) read.c (17339)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Edward Sze-Tyan Wang.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 44 unchanged lines hidden (view full) ---

53 *
54 * This is the function that reads to a byte offset from the end of the input,
55 * storing the data in a wrap-around buffer which is then displayed. If the
56 * rflag is set, the data is displayed in lines in reverse order, and this
57 * routine has the usual nastiness of trying to find the newlines. Otherwise,
58 * it is displayed from the character closest to the beginning of the input to
59 * the end.
60 */
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Edward Sze-Tyan Wang.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 44 unchanged lines hidden (view full) ---

53 *
54 * This is the function that reads to a byte offset from the end of the input,
55 * storing the data in a wrap-around buffer which is then displayed. If the
56 * rflag is set, the data is displayed in lines in reverse order, and this
57 * routine has the usual nastiness of trying to find the newlines. Otherwise,
58 * it is displayed from the character closest to the beginning of the input to
59 * the end.
60 */
61void
61int
62bytes(fp, off)
63 register FILE *fp;
64 off_t off;
65{
66 register int ch, len, tlen;
67 register char *ep, *p, *t;
68 int wrap;
69 char *sp;

--- 5 unchanged lines hidden (view full) ---

75 *p = ch;
76 if (++p == ep) {
77 wrap = 1;
78 p = sp;
79 }
80 }
81 if (ferror(fp)) {
82 ierr();
62bytes(fp, off)
63 register FILE *fp;
64 off_t off;
65{
66 register int ch, len, tlen;
67 register char *ep, *p, *t;
68 int wrap;
69 char *sp;

--- 5 unchanged lines hidden (view full) ---

75 *p = ch;
76 if (++p == ep) {
77 wrap = 1;
78 p = sp;
79 }
80 }
81 if (ferror(fp)) {
82 ierr();
83 return;
83 return 1;
84 }
85
86 if (rflag) {
87 for (t = p - 1, len = 0; t >= sp; --t, ++len)
88 if (*t == '\n' && len) {
89 WR(t + 1, len);
90 len = 0;
91 }

--- 28 unchanged lines hidden (view full) ---

120 *
121 * This is the function that reads to a line offset from the end of the input,
122 * storing the data in an array of buffers which is then displayed. If the
123 * rflag is set, the data is displayed in lines in reverse order, and this
124 * routine has the usual nastiness of trying to find the newlines. Otherwise,
125 * it is displayed from the line closest to the beginning of the input to
126 * the end.
127 */
84 }
85
86 if (rflag) {
87 for (t = p - 1, len = 0; t >= sp; --t, ++len)
88 if (*t == '\n' && len) {
89 WR(t + 1, len);
90 len = 0;
91 }

--- 28 unchanged lines hidden (view full) ---

120 *
121 * This is the function that reads to a line offset from the end of the input,
122 * storing the data in an array of buffers which is then displayed. If the
123 * rflag is set, the data is displayed in lines in reverse order, and this
124 * routine has the usual nastiness of trying to find the newlines. Otherwise,
125 * it is displayed from the line closest to the beginning of the input to
126 * the end.
127 */
128void
128int
129lines(fp, off)
130 register FILE *fp;
131 off_t off;
132{
133 struct {
134 u_int blen;
135 u_int len;
136 char *l;

--- 29 unchanged lines hidden (view full) ---

166 if (++recno == off) {
167 wrap = 1;
168 recno = 0;
169 }
170 }
171 }
172 if (ferror(fp)) {
173 ierr();
129lines(fp, off)
130 register FILE *fp;
131 off_t off;
132{
133 struct {
134 u_int blen;
135 u_int len;
136 char *l;

--- 29 unchanged lines hidden (view full) ---

166 if (++recno == off) {
167 wrap = 1;
168 recno = 0;
169 }
170 }
171 }
172 if (ferror(fp)) {
173 ierr();
174 return;
174 return 1;
175 }
176 if (cnt) {
177 lines[recno].l = sp;
178 lines[recno].len = cnt;
179 if (++recno == off) {
180 wrap = 1;
181 recno = 0;
182 }

--- 16 unchanged lines hidden ---
175 }
176 if (cnt) {
177 lines[recno].l = sp;
178 lines[recno].len = cnt;
179 if (++recno == off) {
180 wrap = 1;
181 recno = 0;
182 }

--- 16 unchanged lines hidden ---