mirror of
https://github.com/opnsense/src.git
synced 2026-04-29 10:11:09 -04:00
Add a -a option to show the entire message buffer.
This commit is contained in:
parent
85744dbb39
commit
9d1334552f
2 changed files with 26 additions and 5 deletions
|
|
@ -40,6 +40,7 @@
|
|||
.Nd "display the system message buffer"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl a
|
||||
.Op Fl M Ar core
|
||||
.Op Fl N Ar system
|
||||
.Sh DESCRIPTION
|
||||
|
|
@ -48,6 +49,11 @@ displays the contents of the system message buffer.
|
|||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width indent
|
||||
.It Fl a
|
||||
Show all data in the message buffer. This includes any syslog records
|
||||
and
|
||||
.Pa /dev/console
|
||||
output.
|
||||
.It Fl M
|
||||
Extract values associated with the name list from the specified core
|
||||
instead of the default
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ static const char rcsid[] =
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <vis.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
struct nlist nl[] = {
|
||||
#define X_MSGBUF 0
|
||||
|
|
@ -72,17 +73,22 @@ main(argc, argv)
|
|||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register int ch, newl, skip;
|
||||
register char *p, *ep;
|
||||
int ch, newl, skip;
|
||||
char *p, *ep;
|
||||
struct msgbuf *bufp, cur;
|
||||
char *bp, *memf, *nlistf;
|
||||
kvm_t *kd;
|
||||
char buf[5];
|
||||
int all = 0;
|
||||
int pri;
|
||||
|
||||
(void) setlocale(LC_CTYPE, "");
|
||||
memf = nlistf = NULL;
|
||||
while ((ch = getopt(argc, argv, "M:N:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "aM:N:")) != -1)
|
||||
switch(ch) {
|
||||
case 'a':
|
||||
all++;
|
||||
break;
|
||||
case 'M':
|
||||
memf = optarg;
|
||||
break;
|
||||
|
|
@ -140,11 +146,20 @@ main(argc, argv)
|
|||
ch = *p;
|
||||
/* Skip "\n<.*>" syslog sequences. */
|
||||
if (skip) {
|
||||
if (ch == '>')
|
||||
newl = skip = 0;
|
||||
if (ch == '\n') {
|
||||
skip = 0;
|
||||
newl = 1;
|
||||
} if (ch == '>') {
|
||||
if (LOG_FAC(pri) == LOG_KERN || all)
|
||||
newl = skip = 0;
|
||||
} else if (ch >= '0' && ch <= '9') {
|
||||
pri *= 10;
|
||||
pri += ch - '0';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (newl && ch == '<') {
|
||||
pri = 0;
|
||||
skip = 1;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue