Hello all. This little patch make route(8) avoid printing "Routing tables" line when there are no routing tables to show.
Index: show.c =================================================================== RCS file: /cvs/src/sbin/route/show.c,v retrieving revision 1.89 diff -u -p -r1.89 show.c --- show.c 11 Oct 2010 11:45:00 -0000 1.89 +++ show.c 17 Jan 2011 19:43:28 -0000 @@ -154,8 +154,6 @@ p_rttables(int af, u_int tableid, int ha lim = buf + needed; } - printf("Routing tables\n"); - if (buf) { for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; @@ -310,15 +308,18 @@ p_rtentry(struct rt_msghdr *rtm) return; } + mask = rti_info[RTAX_NETMASK]; + if ((sa = rti_info[RTAX_DST]) == NULL) + return; + + if (old_af == -1) + puts("Routing tables"); + if (old_af != sa->sa_family) { old_af = sa->sa_family; pr_family(sa->sa_family); pr_rthdr(sa->sa_family); } - - mask = rti_info[RTAX_NETMASK]; - if ((sa = rti_info[RTAX_DST]) == NULL) - return; p_sockaddr(sa, mask, rtm->rtm_flags, WID_DST(sa->sa_family)); p_sockaddr_mpls(sa, rti_info[RTAX_SRC], rtm->rtm_mpls,