diff --git a/usr.bin/ktrdump/ktrdump.8 b/usr.bin/ktrdump/ktrdump.8 index f5df3e97f936..db931a62ad0c 100644 --- a/usr.bin/ktrdump/ktrdump.8 +++ b/usr.bin/ktrdump/ktrdump.8 @@ -33,7 +33,7 @@ .Nd print kernel ktr trace buffer .Sh SYNOPSIS .Nm -.Op Fl cft +.Op Fl cfqt .Op Fl e Ar execfile .Op Fl m Ar corefile .Op Fl o Ar outfile @@ -48,6 +48,8 @@ The following options are available: Print the CPU number that each entry was logged from. .It Fl f Print the file and line number that each entry was logged from. +.It Fl q +Quiet mode; don't print the column header. .It Fl t Print the timestamp for each entry. .It Fl e Ar execfile diff --git a/usr.bin/ktrdump/ktrdump.c b/usr.bin/ktrdump/ktrdump.c index dcae2a71d243..a4319d348b57 100644 --- a/usr.bin/ktrdump/ktrdump.c +++ b/usr.bin/ktrdump/ktrdump.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #define SBUFLEN 128 #define USAGE \ - "usage: ktrdump [-c] [-f] [-t] [-e execfile] [-i ktrfile ] [-m corefile] [-o outfile]" + "usage: ktrdump [-c] [-f] [-q] [-t] [-e execfile] [-i ktrfile ] [-m corefile] [-o outfile]" extern char *optarg; extern int optind; @@ -64,6 +64,7 @@ static int cflag; static int eflag; static int fflag; static int mflag; +static int qflag; static int tflag; static int iflag; @@ -100,7 +101,7 @@ main(int ac, char **av) * Parse commandline arguments. */ out = stdout; - while ((c = getopt(ac, av, "cfte:i:m:o:")) != -1) + while ((c = getopt(ac, av, "cfqte:i:m:o:")) != -1) switch (c) { case 'c': cflag = 1; @@ -129,6 +130,9 @@ main(int ac, char **av) if ((out = fopen(optarg, "w")) == NULL) err(1, "%s", optarg); break; + case 'q': + qflag++; + break; case 't': tflag = 1; break; @@ -176,25 +180,28 @@ main(int ac, char **av) /* * Print a nice header. */ - fprintf(out, "%-6s ", "index"); - if (cflag) - fprintf(out, "%-3s ", "cpu"); - if (tflag) - fprintf(out, "%-16s ", "timestamp"); - if (fflag) - fprintf(out, "%-40s ", "file and line"); - fprintf(out, "%s", "trace"); - fprintf(out, "\n"); + if (!qflag) { + fprintf(out, "%-6s ", "index"); + if (cflag) + fprintf(out, "%-3s ", "cpu"); + if (tflag) + fprintf(out, "%-16s ", "timestamp"); + if (fflag) + fprintf(out, "%-40s ", "file and line"); + fprintf(out, "%s", "trace"); + fprintf(out, "\n"); - fprintf(out, "------ "); - if (cflag) - fprintf(out, "--- "); - if (tflag) - fprintf(out, "---------------- "); - if (fflag) - fprintf(out, "---------------------------------------- "); - fprintf(out, "----- "); - fprintf(out, "\n"); + fprintf(out, "------ "); + if (cflag) + fprintf(out, "--- "); + if (tflag) + fprintf(out, "---------------- "); + if (fflag) + fprintf(out, + "---------------------------------------- "); + fprintf(out, "----- "); + fprintf(out, "\n"); + } /* * Now tear through the trace buffer.