summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/syslogd.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2011-07-12 11:28:31 +0000
committersthen <sthen@openbsd.org>2011-07-12 11:28:31 +0000
commit2cb6e4c655b9a44ab0d143682312322f07ccea5f (patch)
tree636d777b8dbc08831d138c7107437a9fe7192e43 /usr.sbin/syslogd/syslogd.c
parentbe ways more verbose with -a (diff)
downloadwireguard-openbsd-2cb6e4c655b9a44ab0d143682312322f07ccea5f.tar.xz
wireguard-openbsd-2cb6e4c655b9a44ab0d143682312322f07ccea5f.zip
Allow syslogc -n XX to display less than the whole file, and -n XX -f to
display more/less than the default of 10. ok mpf@ jmc@
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r--usr.sbin/syslogd/syslogd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index cc9782b75df..d092abf6b3f 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.103 2009/10/27 23:59:54 deraadt Exp $ */
+/* $OpenBSD: syslogd.c,v 1.104 2011/07/12 11:28:31 sthen Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -207,7 +207,7 @@ int membuf_drop = 0; /* logs were dropped in continuous membuf read */
/*
* Client protocol NB. all numeric fields in network byte order
*/
-#define CTL_VERSION 1
+#define CTL_VERSION 2
/* Request */
struct {
@@ -219,6 +219,7 @@ struct {
#define CMD_FLAGS 5 /* Query flags only */
#define CMD_READ_CONT 6 /* Read out log continuously */
u_int32_t cmd;
+ u_int32_t lines;
char logname[MAX_MEMBUF_NAME];
} ctl_cmd;
@@ -1910,7 +1911,10 @@ ctlconn_read_handler(void)
}
if (ctl_cmd.cmd == CMD_READ_CONT) {
f->f_un.f_mb.f_attached = 1;
- tailify_replytext(reply_text, 10);
+ tailify_replytext(reply_text,
+ ctl_cmd.lines > 0 ? ctl_cmd.lines : 10);
+ } else if (ctl_cmd.lines > 0) {
+ tailify_replytext(reply_text, ctl_cmd.lines);
}
}
break;