From 1a66adc864150e820ab5cc020e6f77477326076d Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Wed, 27 Nov 2002 16:06:21 +0000 Subject: next round in print fixes: -only print priority if it is not equal to the default one -space handling overhaul --- sbin/pfctl/parse.y | 6 +++--- sbin/pfctl/pfctl_altq.c | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index c565d193623..1e82be489e0 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.220 2002/11/27 15:49:16 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.221 2002/11/27 16:06:20 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -2457,7 +2457,7 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, if (pf->opts & PF_OPT_VERBOSE) { print_altq(&pf->paltq->altq, 0); if (nqueues && nqueues->tail) { - printf(" queue { "); + printf("queue { "); LOOP_THROUGH(struct node_queue, queue, nqueues, printf("%s ", @@ -2547,7 +2547,7 @@ expand_queue(struct pf_altq *a, struct node_queue *nqueues, if (pf->opts & PF_OPT_VERBOSE) { print_altq(&pf->paltq->altq, 0); if (nqueues && nqueues->tail) { - printf(" { "); + printf("{ "); LOOP_THROUGH(struct node_queue, queue, nqueues, printf("%s ", queue->queue); diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c index cb13bc17acc..a826c350a1c 100644 --- a/sbin/pfctl/pfctl_altq.c +++ b/sbin/pfctl/pfctl_altq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_altq.c,v 1.10 2002/11/27 15:00:41 henning Exp $ */ +/* $OpenBSD: pfctl_altq.c,v 1.11 2002/11/27 16:06:20 henning Exp $ */ /* * Copyright (C) 2002 * Sony Computer Science Laboratories Inc. All rights reserved. @@ -142,16 +142,16 @@ print_altq(const struct pf_altq *a, unsigned level) return; } - printf("altq on %s scheduler", a->ifname); + printf("altq on %s scheduler ", a->ifname); switch(a->scheduler) { case ALTQT_CBQ: print_cbq_opts(a); if (!a->pq_u.cbq_opts.flags) - printf(" cbq"); + printf("cbq "); } - printf(" bandwidth %s tbrsize %u", rate2str((double)a->ifbandwidth), + printf("bandwidth %s tbrsize %u ", rate2str((double)a->ifbandwidth), a->tbrsize); } @@ -163,8 +163,10 @@ print_queue(const struct pf_altq *a, unsigned level) printf("queue "); for (i = 0; i < level; ++i) printf(" "); - printf("%s bandwidth %s priority %u", a->qname, - rate2str((double)a->bandwidth), a->priority); + printf("%s ", a->qname); + printf("bandwidth %s ", rate2str((double)a->bandwidth)); + if (a->priority != DEFAULT_PRIORITY) + printf("priority %u ", a->priority); switch (a->scheduler) { case ALTQT_CBQ: print_cbq_opts(a); @@ -440,7 +442,7 @@ print_cbq_opts(const struct pf_altq *a) */ if (opts->flags) { - printf(" cbq("); + printf("cbq("); if (opts->flags & CBQCLF_RED) printf(" red"); if (opts->flags & CBQCLF_ECN) @@ -461,7 +463,7 @@ print_cbq_opts(const struct pf_altq *a) printf(" root"); if (opts->flags & CBQCLF_DEFCLASS) printf(" default"); - printf(" )"); + printf(" ) "); } } @@ -535,7 +537,7 @@ pfctl_print_altq_node(const struct pf_altq_node *node, unsigned level) print_altq(&node->altq, level); if (node->children != NULL) { - printf(" {"); + printf("{"); for (child = node->children; child != NULL; child = child->next) { printf("%s", child->altq.qname); -- cgit v1.2.3