forward.c (139993) | forward.c (140101) |
---|---|
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 --- 22 unchanged lines hidden (view full) --- 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#include <sys/cdefs.h> 38 | 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 --- 22 unchanged lines hidden (view full) --- 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#include <sys/cdefs.h> 38 |
39__FBSDID("$FreeBSD: head/usr.bin/tail/forward.c 139993 2005-01-10 20:16:08Z dwmalone $"); | 39__FBSDID("$FreeBSD: head/usr.bin/tail/forward.c 140101 2005-01-12 04:06:31Z brian $"); |
40 41#ifndef lint 42static const char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; 43#endif 44 45#include <sys/types.h> 46#include <sys/stat.h> 47#include <sys/time.h> --- 193 unchanged lines hidden (view full) --- 241/* 242 * follow -- display the file, from an offset, forward. 243 * 244 */ 245 246static void 247show(file_info_t *file) 248{ | 40 41#ifndef lint 42static const char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; 43#endif 44 45#include <sys/types.h> 46#include <sys/stat.h> 47#include <sys/time.h> --- 193 unchanged lines hidden (view full) --- 241/* 242 * follow -- display the file, from an offset, forward. 243 * 244 */ 245 246static void 247show(file_info_t *file) 248{ |
249 int ch, first; | 249 int ch; 250 static file_info_t *last; |
250 | 251 |
251 first = 1; | |
252 while ((ch = getc(file->fp)) != EOF) { | 252 while ((ch = getc(file->fp)) != EOF) { |
253 if (first && no_files > 1) { | 253 if (last != file && no_files > 1) { |
254 (void)printf("\n==> %s <==\n", file->file_name); | 254 (void)printf("\n==> %s <==\n", file->file_name); |
255 first = 0; | 255 last = file; |
256 } 257 if (putchar(ch) == EOF) 258 oerr(); 259 } 260 (void)fflush(stdout); 261 if (ferror(file->fp)) { 262 file->fp = NULL; 263 ierr(); --- 123 unchanged lines hidden --- | 256 } 257 if (putchar(ch) == EOF) 258 oerr(); 259 } 260 (void)fflush(stdout); 261 if (ferror(file->fp)) { 262 file->fp = NULL; 263 ierr(); --- 123 unchanged lines hidden --- |