static void print_node_info(struct gnutella_shell *sh, const struct gnutella_node *n) { gnet_node_flags_t flags; time_delta_t up, con; char buf[1024]; char vendor_escaped[50]; char uptime_buf[8]; char contime_buf[8]; g_return_if_fail(sh); g_return_if_fail(n); if (!node_fill_flags(NODE_ID(n), &flags)) return; con = n->connect_date ? delta_time(tm_time(), n->connect_date) : 0; up = n->up_date ? delta_time(tm_time(), n->up_date) : 0; { const char *vendor; char *escaped; vendor = node_vendor(n); escaped = hex_escape(vendor, TRUE); clamp_strcpy(vendor_escaped, sizeof vendor_escaped, escaped); if (escaped != vendor) { HFREE_NULL(escaped); } } clamp_strcpy(uptime_buf, sizeof uptime_buf, up > 0 ? compact_time(up) : "?"); clamp_strcpy(contime_buf, sizeof contime_buf, con > 0 ? compact_time(con) : "?"); gm_snprintf(buf, sizeof buf, "%-21.45s %5.1u %s %2.2s %6.6s %6.6s %.50s", node_addr(n), (unsigned) n->gnet_port, node_flags_to_string(&flags), iso3166_country_cc(n->country), contime_buf, uptime_buf, vendor_escaped); shell_write(sh, buf); shell_write(sh, "\n"); /* Terminate line */ }
const char * guc_node_flags_to_string(const gnet_node_flags_t *flags) { return node_flags_to_string(flags); }