blob: 8966a873d785e872dda04b3e8df3e5906ab68b9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# $NetBSD: dmesg,v 1.1 2020/04/14 13:58:11 christos Exp $
define dmesg
set $mbp = msgbufp
set $bufdata = &$mbp->msg_bufc[0]
set $print = $mbp->msg_bufs
set $newl = 0
set $skip = 0
set $i = -1
set $p = $bufdata + $mbp->msg_bufx - 1
while ($i < $mbp->msg_bufs)
set $i = $i + 1
set $p = $p + 1
if ($p == $bufdata + $mbp->msg_bufs)
set $p = $bufdata
end
if ($i < $mbp->msg_bufs - $print)
loop_continue
end
set $c = $p[0]
# Skip syslog sequences
if ($skip)
if ($c == '>')
set $newl = 0
set $skip = 0
end
loop_continue
end
if ($newl && $c == '<')
set $skip = 1
loop_continue
end
if ($c == '\0')
loop_continue
end
set $newl = $c == '\n'
printf "%c", $c
end
if (!$newl)
printf "\n"
end
end
document dmesg
print the message buffer
end
|