diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-12-31 14:09:28 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-12-31 14:09:28 +0000 |
commit | 5cdc7dd0d1b78da343aab9946e6c55f5de951ed2 (patch) | |
tree | dab6c28d4d6592acd3e493b2182bc0f703a86ed7 | |
parent | d7886ea8e76b9d3fb26eb9ffcab4d85acf3b6f15 (diff) |
Rename print_timer() to show_timer() and move it to output.c
Currently this needs a bit of a hack because fmt_timeframe()
does not really print a timeframe but instead needs a timestamp
relative to now. This needs to be adjusted but will be done later.
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 16 | ||||
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.h | 1 | ||||
-rw-r--r-- | usr.sbin/bgpctl/output.c | 13 |
3 files changed, 15 insertions, 15 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 96527b41658..a4e12576d1c 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.254 2019/12/20 09:16:05 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.255 2019/12/31 14:09:27 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -46,7 +46,6 @@ int main(int, char *[]); int show(struct imsg *, struct parse_result *); -void print_timer(const char *, time_t); void show_attr(void *, u_int16_t, int); void show_communities(u_char *, size_t, int); void show_community(u_char *, u_int16_t); @@ -405,7 +404,7 @@ show(struct imsg *imsg, struct parse_result *res) case IMSG_CTL_SHOW_TIMER: t = imsg->data; if (t->type > 0 && t->type < Timer_Max) - print_timer(timernames[t->type], t->val); + show_timer(t); break; case IMSG_CTL_SHOW_INTERFACE: iface = imsg->data; @@ -645,17 +644,6 @@ fmt_timeframe(time_t t) } void -print_timer(const char *name, time_t d) -{ - printf(" %-20s ", name); - - if (d <= 0) - printf("%-20s\n", "due"); - else - printf("due in %-13s\n", fmt_timeframe_core(d)); -} - -void show_fib_flags(u_int16_t flags) { if (flags & F_DOWN) diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h index 59ed69b2b2e..7f25ffd892e 100644 --- a/usr.sbin/bgpctl/bgpctl.h +++ b/usr.sbin/bgpctl/bgpctl.h @@ -17,6 +17,7 @@ struct parse_result; void show_head(struct parse_result *); void show_neighbor(struct peer *, struct parse_result *); +void show_timer(struct ctl_timer *); void show_fib(struct kroute_full *); void show_fib_table(struct ktable *); void show_nexthop(struct ctl_show_nexthop *); diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index 5033bb033fd..f18cb407775 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.1 2019/12/20 09:16:05 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.2 2019/12/31 14:09:27 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -281,6 +281,17 @@ show_neighbor(struct peer *p, struct parse_result *res) } void +show_timer(struct ctl_timer *t) +{ + printf(" %-20s ", timernames[t->type]); + + if (t->val <= 0) + printf("%-20s\n", "due"); + else + printf("due in %-13s\n", fmt_timeframe(time(NULL) - t->val)); +} + +void show_fib(struct kroute_full *kf) { char *p; |