aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tail/forward.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2022-07-13 04:14:25 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2023-12-13 16:39:38 +0000
commit585762c3733f3446fe2dad63a1f460903731927c (patch)
treee3da99c284465497163ac581dfa2e2cb2ce1553d /usr.bin/tail/forward.c
parente6a359060aeb5b5438676dd3be53bdc203b01df3 (diff)
Improve usability of head(1) and tail(1):
- Consistently support -q (quiet) and -v (verbose) - Allow specifying numbers with SI prefixes supported by expand_number(3) - Remove 2^31 limit on lines for head(1) MFC after: 2 weeks Reviewed by: lwhsu, pauamma, gbe Relnotes: yes Differential Revision: https://reviews.freebsd.org/D35720 (cherry picked from commit 643ac419fafba89f5adda0e0ea75b538727453fb)
Diffstat (limited to 'usr.bin/tail/forward.c')
-rw-r--r--usr.bin/tail/forward.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c
index 48516a730a50..f991b2517c48 100644
--- a/usr.bin/tail/forward.c
+++ b/usr.bin/tail/forward.c
@@ -243,8 +243,8 @@ show(file_info_t *file)
int ch;
while ((ch = getc(file->fp)) != EOF) {
- if (last != file && no_files > 1) {
- if (!qflag)
+ if (last != file) {
+ if (vflag || (qflag == 0 && no_files > 1))
printfn(file->file_name, 1);
last = file;
}
@@ -322,7 +322,7 @@ follow(file_info_t *files, enum STYLE style, off_t off)
if (file->fp) {
active = 1;
n++;
- if (no_files > 1 && !qflag)
+ if (vflag || (qflag == 0 && no_files > 1))
printfn(file->file_name, 1);
forward(file->fp, file->file_name, style, off, &file->st);
if (Fflag && fileno(file->fp) != STDIN_FILENO)