2013-08-06 19:08:41 +00:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "ubase.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
|
|
|
eprintf("usage: %s\n", argv0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
ARGBEGIN {
|
|
|
|
default:
|
|
|
|
usage();
|
|
|
|
} ARGEND;
|
|
|
|
|
2013-08-12 09:17:36 +00:00
|
|
|
n = dmesg_size();
|
2013-08-06 19:08:41 +00:00
|
|
|
if (n < 0)
|
2013-08-12 09:17:36 +00:00
|
|
|
eprintf("dmesg_size:");
|
2013-08-06 19:08:41 +00:00
|
|
|
buf = malloc(n);
|
|
|
|
if (!buf)
|
|
|
|
eprintf("malloc:");
|
2013-08-12 09:17:36 +00:00
|
|
|
n = dmesg_read(buf, n);
|
2013-08-06 19:08:41 +00:00
|
|
|
if (n < 0)
|
2013-08-12 09:17:36 +00:00
|
|
|
eprintf("dmesg_read:");
|
|
|
|
n = dmesg_show(STDOUT_FILENO, buf, n);
|
2013-08-09 18:05:38 +00:00
|
|
|
if (n < 0)
|
2013-08-12 09:17:36 +00:00
|
|
|
eprintf("dmesg_show:");
|
2013-08-06 19:08:41 +00:00
|
|
|
free(buf);
|
|
|
|
return 0;
|
|
|
|
}
|