X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=blobdiff_plain;f=tap-protohierstat.c;h=7b79a70a8bf1e0a50914d79c4760373e4dad8353;hp=ac3721a66d5857db1e2c5ac8ab52ea30f928fb90;hb=0180a288fa38bef477488aecd025aade16614bbf;hpb=f026752489e09f18ac113ec6482e1abb0e420646 diff --git a/tap-protohierstat.c b/tap-protohierstat.c index ac3721a66d..7b79a70a8b 100644 --- a/tap-protohierstat.c +++ b/tap-protohierstat.c @@ -39,6 +39,7 @@ #include "epan/epan_dissect.h" #include "epan/proto.h" #include +#include #include "register.h" typedef struct _phs_t { @@ -135,17 +136,23 @@ protohierstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt, const v static void phs_draw(phs_t *rs, int indentation) { - int i; - char str[80]; + int i, stroff; +#define MAXPHSLINE 80 + char str[MAXPHSLINE]; for(;rs;rs=rs->sibling){ if(rs->protocol==-1){ return; } str[0]=0; + stroff=0; for(i=0;i15){ + stroff+=g_snprintf(str+stroff, MAXPHSLINE-stroff, "..."); + break; + } + stroff+=g_snprintf(str+stroff, MAXPHSLINE-stroff, " "); } - strcat(str, rs->proto_name); + stroff+=g_snprintf(str+stroff, MAXPHSLINE-stroff, rs->proto_name); printf("%-40s frames:%d bytes:%d\n",str, rs->frames, rs->bytes); phs_draw(rs->child, indentation+1); } @@ -216,6 +223,6 @@ protohierstat_init(const char *optarg) void register_tap_listener_protohierstat(void) { - register_tap_listener_cmd_arg("io,phs", protohierstat_init); + register_stat_cmd_arg("io,phs", protohierstat_init); }