CVS commit: src/usr.bin/tail
Module Name:src Committed By: wiz Date: Tue Jul 4 07:04:51 UTC 2017 Modified Files: src/usr.bin/tail: tail.1 Log Message: Add EXIT STATUS section. Use Ex. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/usr.bin/tail/tail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.1 diff -u src/usr.bin/tail/tail.1:1.16 src/usr.bin/tail/tail.1:1.17 --- src/usr.bin/tail/tail.1:1.16 Mon Jul 3 21:34:21 2017 +++ src/usr.bin/tail/tail.1 Tue Jul 4 07:04:50 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: tail.1,v 1.16 2017/07/03 21:34:21 wiz Exp $ +.\" $NetBSD: tail.1,v 1.17 2017/07/04 07:04:50 wiz Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -139,10 +139,8 @@ header consisting of the string where .Dq XXX is the name of the file. -.Pp -The -.Nm -utility exits 0 on success, and >0 if an error occurs. +.Sh EXIT STATUS +.Ex -std tail .Sh SEE ALSO .Xr cat 1 , .Xr head 1 ,
CVS commit: src/usr.bin/tail
Module Name:src Committed By: eadler Date: Tue Mar 6 03:33:26 UTC 2018 Modified Files: src/usr.bin/tail: tail.c Log Message: [tail] Fix type of 'len' ok pgoyette To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.c diff -u src/usr.bin/tail/tail.c:1.19 src/usr.bin/tail/tail.c:1.20 --- src/usr.bin/tail/tail.c:1.19 Mon Oct 2 08:23:23 2017 +++ src/usr.bin/tail/tail.c Tue Mar 6 03:33:26 2018 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tail.c,v 1.19 2017/10/02 08:23:23 wiz Exp $"); +__RCSID("$NetBSD: tail.c,v 1.20 2018/03/06 03:33:26 eadler Exp $"); #endif /* not lint */ #include @@ -235,7 +235,7 @@ static void obsolete(char *argv[]) { char *ap, *p, *t; - int len; + size_t len; char *start; while ((ap = *++argv) != NULL) {
CVS commit: src/usr.bin/tail
Module Name:src Committed By: kre Date: Sun Oct 1 22:35:23 UTC 2017 Modified Files: src/usr.bin/tail: tac.1 Log Message: Remove some unnecessary words. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/tail/tac.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tac.1 diff -u src/usr.bin/tail/tac.1:1.1 src/usr.bin/tail/tac.1:1.2 --- src/usr.bin/tail/tac.1:1.1 Sun Oct 1 20:49:24 2017 +++ src/usr.bin/tail/tac.1 Sun Oct 1 22:35:23 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: tac.1,v 1.1 2017/10/01 20:49:24 maya Exp $ +.\" $NetBSD: tac.1,v 1.2 2017/10/01 22:35:23 kre Exp $ .\" .\" Copyright (c) 2017 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -43,7 +43,7 @@ .Nm .Pq cat backwards outputs the contents of each of each of the specified files, -or of the standard input if no files are specified its standard input, +or the standard input if no files are specified, in reverse line order to the standard output. .Sh EXIT STATUS .Ex -std tac
CVS commit: src/usr.bin/tail
Module Name:src Committed By: wiz Date: Mon Oct 2 08:23:23 UTC 2017 Modified Files: src/usr.bin/tail: tail.1 tail.c Log Message: Sort options. -qv are not specific to -r, so separate them. Add -q and -v descriptions to the general option table. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/tail/tail.1 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.1 diff -u src/usr.bin/tail/tail.1:1.18 src/usr.bin/tail/tail.1:1.19 --- src/usr.bin/tail/tail.1:1.18 Sun Oct 1 20:49:24 2017 +++ src/usr.bin/tail/tail.1 Mon Oct 2 08:23:23 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: tail.1,v 1.18 2017/10/01 20:49:24 maya Exp $ +.\" $NetBSD: tail.1,v 1.19 2017/10/02 08:23:23 wiz Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -40,10 +40,11 @@ .Nd display the last part of a file .Sh SYNOPSIS .Nm +.Fl qv .Oo .Fl f | .Fl F | -.Fl rqv +.Fl r .Oc .Oo .Fl b Ar number | @@ -113,6 +114,9 @@ or similar programs. The location is .Ar number lines. +.It Fl q +Do not prepend a header for each file, even if multiple files +are specified. .It Fl r The .Fl r @@ -131,6 +135,8 @@ from the beginning or end of the input f The default for the .Fl r option is to display all of the input. +.It Fl v +Prepend each file with a header. .El .Pp If more than a single file is specified, or the Index: src/usr.bin/tail/tail.c diff -u src/usr.bin/tail/tail.c:1.18 src/usr.bin/tail/tail.c:1.19 --- src/usr.bin/tail/tail.c:1.18 Sun Oct 1 20:49:24 2017 +++ src/usr.bin/tail/tail.c Mon Oct 2 08:23:23 2017 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tail.c,v 1.18 2017/10/01 20:49:24 maya Exp $"); +__RCSID("$NetBSD: tail.c,v 1.19 2017/10/02 08:23:23 wiz Exp $"); #endif /* not lint */ #include @@ -317,7 +317,7 @@ static void usage(void) { (void)fprintf(stderr, - "Usage: %s [-f | -F | -rqv] [-b # | -c # | -n #] [file ...]\n", + "Usage: %s [-qv] [-f | -F | -r] [-b # | -c # | -n #] [file ...]\n", getprogname()); exit(1); }
CVS commit: src/usr.bin/tail
Module Name:src Committed By: pgoyette Date: Sun Oct 15 03:57:47 UTC 2017 Modified Files: src/usr.bin/tail: tail.1 Log Message: Nit-picking: avoid split infinitive To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tail/tail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.1 diff -u src/usr.bin/tail/tail.1:1.19 src/usr.bin/tail/tail.1:1.20 --- src/usr.bin/tail/tail.1:1.19 Mon Oct 2 08:23:23 2017 +++ src/usr.bin/tail/tail.1 Sun Oct 15 03:57:47 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: tail.1,v 1.19 2017/10/02 08:23:23 wiz Exp $ +.\" $NetBSD: tail.1,v 1.20 2017/10/15 03:57:47 pgoyette Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -89,7 +89,7 @@ The .Fl f option causes .Nm -to not stop when end of file is reached, but rather to wait for additional +not to stop when end of file is reached, but rather to wait for additional data to be appended to the input. The .Fl f
CVS commit: src/usr.bin/tail
Module Name:src Committed By: christos Date: Fri Oct 9 17:51:27 UTC 2015 Modified Files: src/usr.bin/tail: forward.c Log Message: PR/50322: Timo Buhrmester: tail -F misbehaves with stdin closed Compare fp with stdin not fileno(fp) with STDIN_FILENO, because if tail is called with 0 closed, then we are not going to be setting event filters for the file because we'll erroneously think it is stdin. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/tail/forward.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/forward.c diff -u src/usr.bin/tail/forward.c:1.32 src/usr.bin/tail/forward.c:1.33 --- src/usr.bin/tail/forward.c:1.32 Fri Oct 18 16:47:07 2013 +++ src/usr.bin/tail/forward.c Fri Oct 9 13:51:26 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: forward.c,v 1.32 2013/10/18 20:47:07 christos Exp $ */ +/* $NetBSD: forward.c,v 1.33 2015/10/09 17:51:26 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: forward.c,v 1.32 2013/10/18 20:47:07 christos Exp $"); +__RCSID("$NetBSD: forward.c,v 1.33 2015/10/09 17:51:26 christos Exp $"); #endif /* not lint */ #include @@ -198,7 +198,7 @@ forward(FILE *fp, enum STYLE style, off_ n = 0; memset(ev, 0, sizeof(ev)); - if (fflag == 2 && fileno(fp) != STDIN_FILENO) { + if (fflag == 2 && fp != stdin) { EV_SET(&ev[n], fileno(fp), EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_DELETE | NOTE_RENAME, 0, 0); @@ -240,7 +240,7 @@ forward(FILE *fp, enum STYLE style, off_ */ (void) sleep(1); - if (fflag == 2 && fileno(fp) != STDIN_FILENO && + if (fflag == 2 && fp != stdin && stat(fname, &statbuf) != -1) { if (statbuf.st_ino != sbp->st_ino || statbuf.st_dev != sbp->st_dev ||
CVS commit: src/usr.bin/tail
Module Name:src Committed By: kamil Date: Sat Jun 20 10:53:28 UTC 2020 Modified Files: src/usr.bin/tail: tac.1 Log Message: Remove double 'each of' Reported by Weitian LI liweitianux (DragonFly). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/tail/tac.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tac.1 diff -u src/usr.bin/tail/tac.1:1.2 src/usr.bin/tail/tac.1:1.3 --- src/usr.bin/tail/tac.1:1.2 Sun Oct 1 22:35:23 2017 +++ src/usr.bin/tail/tac.1 Sat Jun 20 10:53:28 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: tac.1,v 1.2 2017/10/01 22:35:23 kre Exp $ +.\" $NetBSD: tac.1,v 1.3 2020/06/20 10:53:28 kamil Exp $ .\" .\" Copyright (c) 2017 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -30,7 +30,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 1, 2017 +.Dd June 20, 2020 .Dt TAC 1 .Os .Sh NAME @@ -42,7 +42,7 @@ .Sh DESCRIPTION .Nm .Pq cat backwards -outputs the contents of each of each of the specified files, +outputs the contents of each of the specified files, or the standard input if no files are specified, in reverse line order to the standard output. .Sh EXIT STATUS
CVS commit: src/usr.bin/tail
Module Name:src Committed By: wiz Date: Thu Jan 31 23:09:06 UTC 2013 Modified Files: src/usr.bin/tail: tail.1 tail.c Log Message: Add comma after i.e. >From Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/usr.bin/tail/tail.1 cvs rdiff -u -r1.16 -r1.17 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.1 diff -u src/usr.bin/tail/tail.1:1.13 src/usr.bin/tail/tail.1:1.14 --- src/usr.bin/tail/tail.1:1.13 Thu Aug 7 11:16:02 2003 +++ src/usr.bin/tail/tail.1 Thu Jan 31 23:09:06 2013 @@ -1,4 +1,4 @@ -.\" $NetBSD: tail.1,v 1.13 2003/08/07 11:16:02 agc Exp $ +.\" $NetBSD: tail.1,v 1.14 2013/01/31 23:09:06 wiz Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -172,7 +172,7 @@ and .Fl n options modify the .Fl r -option, i.e. ``-r -c 4'' displays the last 4 characters of the last line +option, i.e., ``-r -c 4'' displays the last 4 characters of the last line of the input, while the historic tail (using the historic syntax ``-4cr'') would ignore the .Fl c Index: src/usr.bin/tail/tail.c diff -u src/usr.bin/tail/tail.c:1.16 src/usr.bin/tail/tail.c:1.17 --- src/usr.bin/tail/tail.c:1.16 Sat Sep 3 10:59:11 2011 +++ src/usr.bin/tail/tail.c Thu Jan 31 23:09:06 2013 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tail.c,v 1.16 2011/09/03 10:59:11 christos Exp $"); +__RCSID("$NetBSD: tail.c,v 1.17 2013/01/31 23:09:06 wiz Exp $"); #endif /* not lint */ #include @@ -78,7 +78,7 @@ main(int argc, char *argv[]) * get displayed, not the starting point in the file. The one major * incompatibility in this version as compared to historical versions * is that the 'r' option couldn't be modified by the -lbc options, - * i.e. it was always done in lines. This version treats -rc as a + * i.e., it was always done in lines. This version treats -rc as a * number of characters in reverse order. Finally, the default for * -r is the entire file, not 10 lines. */
CVS commit: src/usr.bin/tail
Module Name:src Committed By: lukem Date: Mon Apr 13 23:33:25 UTC 2009 Modified Files: src/usr.bin/tail: extern.h forward.c read.c reverse.c tail.c Log Message: Fix WARNS=4 issues (-Wcast-qual -Wshadow -Wsign-compare) XXX: need a "cleaner" way to do the check in reverse.c, as a general rule To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/tail/extern.h cvs rdiff -u -r1.28 -r1.29 src/usr.bin/tail/forward.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tail/read.c cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tail/reverse.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/extern.h diff -u src/usr.bin/tail/extern.h:1.8 src/usr.bin/tail/extern.h:1.9 --- src/usr.bin/tail/extern.h:1.8 Mon Feb 16 21:57:04 2004 +++ src/usr.bin/tail/extern.h Mon Apr 13 23:33:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.8 2004/02/16 21:57:04 itojun Exp $ */ +/* $NetBSD: extern.h,v 1.9 2009/04/13 23:33:25 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -40,8 +40,8 @@ void forward(FILE *, enum STYLE, off_t, struct stat *); void reverse(FILE *, enum STYLE, off_t, struct stat *); -int bytes(FILE *, off_t); -int lines(FILE *, off_t); +int displaybytes(FILE *, off_t); +int displaylines(FILE *, off_t); void err(int fatal, const char *fmt, ...) __attribute__((__format__(__printf__, 2, 3))); @@ -49,4 +49,4 @@ void oerr(void); extern int fflag, rflag, rval; -extern char *fname; +extern const char *fname; Index: src/usr.bin/tail/forward.c diff -u src/usr.bin/tail/forward.c:1.28 src/usr.bin/tail/forward.c:1.29 --- src/usr.bin/tail/forward.c:1.28 Wed May 24 16:34:25 2006 +++ src/usr.bin/tail/forward.c Mon Apr 13 23:33:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: forward.c,v 1.28 2006/05/24 16:34:25 christos Exp $ */ +/* $NetBSD: forward.c,v 1.29 2009/04/13 23:33:25 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: forward.c,v 1.28 2006/05/24 16:34:25 christos Exp $"); +__RCSID("$NetBSD: forward.c,v 1.29 2009/04/13 23:33:25 lukem Exp $"); #endif /* not lint */ #include @@ -147,7 +147,7 @@ return; } } else { - if (bytes(fp, off)) + if (displaybytes(fp, off)) return; } break; @@ -169,7 +169,7 @@ return; } } else { - if (lines(fp, off)) + if (displaylines(fp, off)) return; } break; Index: src/usr.bin/tail/read.c diff -u src/usr.bin/tail/read.c:1.14 src/usr.bin/tail/read.c:1.15 --- src/usr.bin/tail/read.c:1.14 Tue Sep 30 04:03:37 2008 +++ src/usr.bin/tail/read.c Mon Apr 13 23:33:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.14 2008/09/30 04:03:37 dholland Exp $ */ +/* $NetBSD: read.c,v 1.15 2009/04/13 23:33:25 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: read.c,v 1.14 2008/09/30 04:03:37 dholland Exp $"); +__RCSID("$NetBSD: read.c,v 1.15 2009/04/13 23:33:25 lukem Exp $"); #endif /* not lint */ #include @@ -51,7 +51,7 @@ #include "extern.h" /* - * bytes -- read bytes to an offset from the end and display. + * displaybytes -- read bytes to an offset from the end and display. * * This is the function that reads to a byte offset from the end of the input, * storing the data in a wrap-around buffer which is then displayed. If the @@ -63,7 +63,7 @@ * Non-zero return means than a (non-fatal) error occurred. */ int -bytes(FILE *fp, off_t off) +displaybytes(FILE *fp, off_t off) { int ch, len, tlen; char *ep, *p, *t; @@ -119,7 +119,7 @@ } /* - * lines -- read lines to an offset from the end and display. + * displaylines -- read lines to an offset from the end and display. * * This is the function that reads to a line offset from the end of the input, * storing the data in an array of buffers which is then displayed. If the @@ -131,11 +131,11 @@ * Non-zero return means than a (non-fatal) error occurred. */ int -lines(FILE *fp, off_t off) +displaylines(FILE *fp, off_t off) { struct { - u_int blen; - u_int len; + int blen; + int len; char *l; } *lines; int ch; Index: src/usr.bin/tail/reverse.c diff -u src/usr.bin/tail/reverse.c:1.19 src/usr.bin/tail/reverse.c:1.20 --- src/usr.bin/tail/reverse.c:1.19 Sun Apr 9 19:39:17 2006 +++ src/usr.bin/tail/reverse.c Mon Apr 13 23:33:25 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: reverse.c,v 1.19 2006/04/09 19:39:17 christos Exp $ */ +/* $NetBSD: reverse.c,v 1.20 2009/04/13 23:33:25 lukem Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: reverse.c,v 1.19 2006/04/09 19:39:17 christos Exp $"); +__RCSID("$NetBSD: reverse.c,v 1.20 2009/04/13 23:33:25 lukem Exp $"); #endif /
CVS commit: src/usr.bin/tail
Module Name:src Committed By: christos Date: Sat Sep 3 09:02:20 UTC 2011 Modified Files: src/usr.bin/tail: extern.h forward.c misc.c read.c reverse.c tail.c Log Message: Instead of declaring our own err() which is different than the standard one, and using it incorrectly in a few places because of confusion (does it print errno or not?), declare two versions following the standard ones xerrx and, xerr, and use those as appropriate, implementing them using them vwarn and vwarnx. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/tail/extern.h cvs rdiff -u -r1.29 -r1.30 src/usr.bin/tail/forward.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/tail/misc.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/tail/read.c cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tail/reverse.c cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/extern.h diff -u src/usr.bin/tail/extern.h:1.9 src/usr.bin/tail/extern.h:1.10 --- src/usr.bin/tail/extern.h:1.9 Mon Apr 13 19:33:25 2009 +++ src/usr.bin/tail/extern.h Sat Sep 3 05:02:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.9 2009/04/13 23:33:25 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.10 2011/09/03 09:02:20 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -43,8 +43,8 @@ int displaybytes(FILE *, off_t); int displaylines(FILE *, off_t); -void err(int fatal, const char *fmt, ...) - __attribute__((__format__(__printf__, 2, 3))); +void xerr(int fatal, const char *fmt, ...) __printflike(2, 3); +void xerrx(int fatal, const char *fmt, ...) __printflike(2, 3); void ierr(void); void oerr(void); Index: src/usr.bin/tail/forward.c diff -u src/usr.bin/tail/forward.c:1.29 src/usr.bin/tail/forward.c:1.30 --- src/usr.bin/tail/forward.c:1.29 Mon Apr 13 19:33:25 2009 +++ src/usr.bin/tail/forward.c Sat Sep 3 05:02:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: forward.c,v 1.29 2009/04/13 23:33:25 lukem Exp $ */ +/* $NetBSD: forward.c,v 1.30 2011/09/03 09:02:20 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: forward.c,v 1.29 2009/04/13 23:33:25 lukem Exp $"); +__RCSID("$NetBSD: forward.c,v 1.30 2011/09/03 09:02:20 christos Exp $"); #endif /* not lint */ #include @@ -180,7 +180,7 @@ if (fflag) { kq = kqueue(); if (kq < 0) - err(1, "kqueue"); + xerr(1, "kqueue"); action = ADD_EVENTS; } @@ -225,7 +225,7 @@ case USE_KQUEUE: if (kevent(kq, NULL, 0, ev, 1, NULL) < 0) -err(1, "kevent"); +xerr(1, "kevent"); if (ev[0].filter == EVFILT_VNODE) { /* file was rotated, wait until it reappears */ @@ -305,7 +305,7 @@ start = mmap(NULL, (size_t)mmap_size, PROT_READ, MAP_FILE|MAP_SHARED, fileno(fp), mmap_offset); if (start == MAP_FAILED) { - err(0, "%s: %s", fname, strerror(EFBIG)); + xerr(0, "%s", fname); return (1); } @@ -326,7 +326,7 @@ break; if (munmap(start, mmap_size)) { - err(0, "%s: %s", fname, strerror(errno)); + xerr(0, "%s", fname); return (1); } @@ -344,7 +344,7 @@ WR(p, mmap_size - mmap_remaining); file_remaining += mmap_size - mmap_remaining; if (munmap(start, mmap_size)) { - err(0, "%s: %s", fname, strerror(errno)); + xerr(0, "%s", fname); return (1); } Index: src/usr.bin/tail/misc.c diff -u src/usr.bin/tail/misc.c:1.6 src/usr.bin/tail/misc.c:1.7 --- src/usr.bin/tail/misc.c:1.6 Thu Aug 7 07:16:02 2003 +++ src/usr.bin/tail/misc.c Sat Sep 3 05:02:20 2011 @@ -35,7 +35,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: misc.c,v 1.6 2003/08/07 11:16:02 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.7 2011/09/03 09:02:20 christos Exp $"); #endif /* not lint */ #include @@ -46,31 +46,43 @@ #include #include #include +#include #include "extern.h" void ierr(void) { - err(0, "%s: %s", fname, strerror(errno)); + xerr(0, "%s", fname); } void oerr(void) { - err(1, "stdout: %s", strerror(errno)); + xerr(1, "stdout"); } void -err(int fatal, const char *fmt, ...) +xerr(int fatal, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - (void)fprintf(stderr, "tail: "); - (void)vfprintf(stderr, fmt, ap); + vwarn(fmt, ap); + va_end(ap); + if (fatal) + exit(1); + rval = 1; +} + +void +xerrx(int fatal, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vwarnx(fmt, ap); va_end(ap); - (void)fprintf(stderr, "\n"); if (fatal) exit(1); rval = 1; Index: src/usr.bin/tail/read.c diff -u src/usr.bin/tail/read.c:1.15 src/usr.bin/tail/read.c:1.16 --- src/usr.bin/tail/read.c:1.15 Mon Apr 13 19:33:25 2009 +++ src/usr.bin/tail/read.c Sat Sep 3 05:02:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.15 2009/04/13 23:33:25 lukem Exp $ */ +/* $NetBSD: read.c,v 1.16 2011/09/03 09:02:20 christos Exp $ */ /*- *
CVS commit: src/usr.bin/tail
Module Name:src Committed By: christos Date: Sat Sep 3 10:35:13 UTC 2011 Modified Files: src/usr.bin/tail: reverse.c Log Message: leave the original errno as it was. don't report EFBIG on all mmap failures. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/tail/reverse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/reverse.c diff -u src/usr.bin/tail/reverse.c:1.21 src/usr.bin/tail/reverse.c:1.22 --- src/usr.bin/tail/reverse.c:1.21 Sat Sep 3 05:02:20 2011 +++ src/usr.bin/tail/reverse.c Sat Sep 3 06:35:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: reverse.c,v 1.21 2011/09/03 09:02:20 christos Exp $ */ +/* $NetBSD: reverse.c,v 1.22 2011/09/03 10:35:13 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: reverse.c,v 1.21 2011/09/03 09:02:20 christos Exp $"); +__RCSID("$NetBSD: reverse.c,v 1.22 2011/09/03 10:35:13 christos Exp $"); #endif /* not lint */ #include @@ -122,7 +122,6 @@ if ((start = mmap(NULL, (size_t)size, PROT_READ, MAP_FILE|MAP_SHARED, fileno(fp), (off_t)0)) == (caddr_t)-1) { - errno = EFBIG; xerr(0, "%s", fname); return; }
CVS commit: src/usr.bin/tail
Module Name:src Committed By: christos Date: Sat Sep 3 10:59:11 UTC 2011 Modified Files: src/usr.bin/tail: forward.c read.c reverse.c tail.c Log Message: minor knf, no functional change. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.bin/tail/forward.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/tail/read.c cvs rdiff -u -r1.22 -r1.23 src/usr.bin/tail/reverse.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/tail/tail.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/forward.c diff -u src/usr.bin/tail/forward.c:1.30 src/usr.bin/tail/forward.c:1.31 --- src/usr.bin/tail/forward.c:1.30 Sat Sep 3 05:02:20 2011 +++ src/usr.bin/tail/forward.c Sat Sep 3 06:59:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: forward.c,v 1.30 2011/09/03 09:02:20 christos Exp $ */ +/* $NetBSD: forward.c,v 1.31 2011/09/03 10:59:10 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: forward.c,v 1.30 2011/09/03 09:02:20 christos Exp $"); +__RCSID("$NetBSD: forward.c,v 1.31 2011/09/03 10:59:10 christos Exp $"); #endif /* not lint */ #include @@ -206,15 +206,15 @@ memset(ev, 0, sizeof(ev)); if (fflag == 2 && fileno(fp) != STDIN_FILENO) { EV_SET(&ev[n], fileno(fp), EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_CLEAR, - NOTE_DELETE | NOTE_RENAME, 0, 0); +EV_ADD | EV_ENABLE | EV_CLEAR, +NOTE_DELETE | NOTE_RENAME, 0, 0); n++; } EV_SET(&ev[n], fileno(fp), EVFILT_READ, -EV_ADD | EV_ENABLE, 0, 0, 0); + EV_ADD | EV_ENABLE, 0, 0, 0); n++; - if (kevent(kq, ev, n, NULL, 0, NULL) < 0) { + if (kevent(kq, ev, n, NULL, 0, NULL) == -1) { close(kq); kq = -1; action = USE_SLEEP; @@ -224,7 +224,7 @@ break; case USE_KQUEUE: - if (kevent(kq, NULL, 0, ev, 1, NULL) < 0) + if (kevent(kq, NULL, 0, ev, 1, NULL) == -1) xerr(1, "kevent"); if (ev[0].filter == EVFILT_VNODE) { @@ -290,7 +290,7 @@ #define MMAP_MAXSIZE (10 * 1024 * 1024) if (!(file_size = sbp->st_size)) - return (0); + return 0; file_remaining = file_size; if (file_remaining > MMAP_MAXSIZE) { @@ -306,7 +306,7 @@ MAP_FILE|MAP_SHARED, fileno(fp), mmap_offset); if (start == MAP_FAILED) { xerr(0, "%s", fname); - return (1); + return 1; } mmap_remaining = mmap_size; @@ -327,7 +327,7 @@ if (munmap(start, mmap_size)) { xerr(0, "%s", fname); - return (1); + return 1; } if (mmap_offset >= MMAP_MAXSIZE) { @@ -345,7 +345,7 @@ file_remaining += mmap_size - mmap_remaining; if (munmap(start, mmap_size)) { xerr(0, "%s", fname); - return (1); + return 1; } /* @@ -355,7 +355,7 @@ */ if (fseeko(fp, file_remaining, SEEK_SET) == -1) { ierr(); - return (1); + return 1; } - return (0); + return 0; } Index: src/usr.bin/tail/read.c diff -u src/usr.bin/tail/read.c:1.16 src/usr.bin/tail/read.c:1.17 --- src/usr.bin/tail/read.c:1.16 Sat Sep 3 05:02:20 2011 +++ src/usr.bin/tail/read.c Sat Sep 3 06:59:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.16 2011/09/03 09:02:20 christos Exp $ */ +/* $NetBSD: read.c,v 1.17 2011/09/03 10:59:10 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: read.c,v 1.16 2011/09/03 09:02:20 christos Exp $"); +__RCSID("$NetBSD: read.c,v 1.17 2011/09/03 10:59:10 christos Exp $"); #endif /* not lint */ #include @@ -82,7 +82,7 @@ } if (ferror(fp)) { ierr(); - return (1); + return 1; } if (rflag) { @@ -115,7 +115,7 @@ if ((len = p - sp) != 0) WR(sp, len); } - return (0); + return 0; } /* @@ -181,7 +181,7 @@ if (ferror(fp)) { free(lines); ierr(); - return (1); + return 1; } if (cnt) { lines[recno].l = sp; @@ -206,5 +206,5 @@ WR(lines[cnt].l, lines[cnt].len); } free(lines); - return (0); + return 0; } Index: src/usr.bin/tail/reverse.c diff -u src/usr.bin/tail/reverse.c:1.22 src/usr.bin/tail/reverse.c:1.23 --- src/usr.bin/tail/reverse.c:1.22 Sat Sep 3 06:35:13 2011 +++ src/usr.bin/tail/reverse.c Sat Sep 3 06:59:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: reverse.c,v 1.22 2011/09/03 10:35:13 christos Exp $ */ +/* $NetBSD: reverse.c,v 1.23 2011/09/03 10:59:11 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)reverse.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: reverse.c,v 1.22 2011/09/03 10:35:13 christos Exp $"); +__RCSID("$NetBSD: reverse.c,v 1.23 2011/09/03 10:59:11 christos Exp $"); #endif /* not lint */ #include @@ -121,7 +121,7 @@ } if ((start = mmap(NULL, (size_t)size, PROT_READ, - MAP_FILE|MAP_SHARED, fileno(fp), (off_t)0)) == (caddr_t)-1) { + MAP_FILE|MAP_SHARED, fileno(fp), (off_t)0)) == MAP_FAILED) { xerr(0,
CVS commit: src/usr.bin/tail
Module Name:src Committed By: wiz Date: Sun Jun 15 11:37:56 UTC 2014 Modified Files: src/usr.bin/tail: tail.1 Log Message: Fix -f description: it is also ignored if stdin is a FIFO. >From Philip Guenther via jmc@openbsd. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tail/tail.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tail/tail.1 diff -u src/usr.bin/tail/tail.1:1.14 src/usr.bin/tail/tail.1:1.15 --- src/usr.bin/tail/tail.1:1.14 Thu Jan 31 23:09:06 2013 +++ src/usr.bin/tail/tail.1 Sun Jun 15 11:37:56 2014 @@ -1,4 +1,4 @@ -.\" $NetBSD: tail.1,v 1.14 2013/01/31 23:09:06 wiz Exp $ +.\" $NetBSD: tail.1,v 1.15 2014/06/15 11:37:56 wiz Exp $ .\" .\" Copyright (c) 1980, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" -.Dd June 6, 1993 +.Dd June 15, 2014 .Dt TAIL 1 .Os .Sh NAME @@ -92,7 +92,8 @@ to not stop when end of file is reached, data to be appended to the input. The .Fl f -option is ignored if the standard input is a pipe, but not if it is a FIFO. +option is ignored if there are no file arguments and the standard +input is a pipe or a FIFO. .It Fl F The .Fl F