/* vi: set sw=4 ts=4: */
/*
 *
 * dmesg - display/control kernel ring buffer.
 *
 * Copyright 2006 Rob Landley <rob@landley.net>
 * Copyright 2006 Bernhard Fischer <rep.nop@aon.at>
 *
 * Licensed under GPLv2, see file LICENSE in this tarball for details.
 */

#include "busybox.h"
#include <unistd.h>
#include <sys/klog.h>

int dmesg_main(int argc, char **argv);
int dmesg_main(int argc, char **argv)
{
	char *size, *level;
	int flags = getopt32(argc, argv, "cs:n:", &size, &level);

	if (flags & 4) {
		if (klogctl(8, NULL, xatoul_range(level, 0, 10)))
			bb_perror_msg_and_die("klogctl");
	} else {
		int len;
		char *buf;

		len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : 16384;
		buf = xmalloc(len);
		if (0 > (len = klogctl(3 + (flags & 1), buf, len)))
			bb_perror_msg_and_die("klogctl");

		// Skip <#> at the start of lines, and make sure we end with a newline.

		if (ENABLE_FEATURE_DMESG_PRETTY) {
			int last = '\n';
			int in;

			for (in = 0; in<len;) {
				if (last == '\n' && buf[in] == '<') in += 3;
				else putchar(last = buf[in++]);
			}
			if (last != '\n') putchar('\n');
		} else {
			write(1,buf,len);
			if (len && buf[len-1]!='\n') putchar('\n');
		}

		if (ENABLE_FEATURE_CLEAN_UP) free(buf);
	}

	return 0;
}
