diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-11-20 17:11:51 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-11-20 17:11:51 +0000 |
commit | e612dcba6501911b2a321c6e9259f1a0f847828f (patch) | |
tree | 14a5ef98f8df2a3c8725fb9f8bdf541a0e6df6fa /usr.sbin | |
parent | 98726003615a510480bd7b961a5ca35442a937b9 (diff) |
limit the number of displayed lines per node in relay_protodebug().
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/hoststated/relay.c | 14 | ||||
-rw-r--r-- | usr.sbin/relayd/relay.c | 14 |
2 files changed, 24 insertions, 4 deletions
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c index 28b90f48edb..584f85e9456 100644 --- a/usr.sbin/hoststated/relay.c +++ b/usr.sbin/hoststated/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.59 2007/11/20 15:54:55 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.60 2007/11/20 17:11:50 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -339,6 +339,7 @@ relay_protodebug(struct relay *rlay) struct protonode *proot, *pn; struct proto_tree *tree; const char *name; + int i; fprintf(stderr, "protocol %d: name %s\n", proto->id, proto->name); fprintf(stderr, "\tflags: 0x%04x\n", proto->flags); @@ -361,8 +362,17 @@ relay_protodebug(struct relay *rlay) tree = &proto->request_tree; show: RB_FOREACH(proot, proto_tree, tree) { - PROTONODE_FOREACH(pn, proot, entry) + i = 0; + PROTONODE_FOREACH(pn, proot, entry) { +#ifndef DEBUG + /* Limit the number of displayed lines */ + if (++i > 100) { + fprintf(stderr, "\t\t...\n"); + break; + } +#endif relay_nodedebug(name, pn); + } } if (tree == &proto->request_tree) { name = "response"; diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 28b90f48edb..584f85e9456 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.59 2007/11/20 15:54:55 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.60 2007/11/20 17:11:50 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -339,6 +339,7 @@ relay_protodebug(struct relay *rlay) struct protonode *proot, *pn; struct proto_tree *tree; const char *name; + int i; fprintf(stderr, "protocol %d: name %s\n", proto->id, proto->name); fprintf(stderr, "\tflags: 0x%04x\n", proto->flags); @@ -361,8 +362,17 @@ relay_protodebug(struct relay *rlay) tree = &proto->request_tree; show: RB_FOREACH(proot, proto_tree, tree) { - PROTONODE_FOREACH(pn, proot, entry) + i = 0; + PROTONODE_FOREACH(pn, proot, entry) { +#ifndef DEBUG + /* Limit the number of displayed lines */ + if (++i > 100) { + fprintf(stderr, "\t\t...\n"); + break; + } +#endif relay_nodedebug(name, pn); + } } if (tree == &proto->request_tree) { name = "response"; |