forked from osmocom/wireshark
Clean up capinfos output.
Make sure there's always a space between a number and "[TGMK]bytes", "[TGMK]bits", and "[TGMK]packets". Change-Id: I710385303e451e9aea6fc9bbea562f59ca0d22c9 Reviewed-on: https://code.wireshark.org/review/3810 Reviewed-by: Guy Harris <guy@alum.mit.edu>daniel/osmux
parent
a52939cef2
commit
cda5c16667
|
@ -549,8 +549,8 @@ print_stats(const gchar *filename, capture_info *cf_info)
|
|||
if (machine_readable) {
|
||||
print_value("", 2, " packets/sec", cf_info->packet_rate);
|
||||
} else {
|
||||
size_string = format_size((gint64)cf_info->packet_rate, format_size_unit_none);
|
||||
printf ("%spackets/sec\n", size_string);
|
||||
size_string = format_size((gint64)cf_info->packet_rate, format_size_unit_packets_s);
|
||||
printf ("%s\n", size_string);
|
||||
g_free(size_string);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,16 +153,22 @@ gchar *format_size(gint64 size, format_size_flags_e flags) {
|
|||
case format_size_unit_none:
|
||||
break;
|
||||
case format_size_unit_bytes:
|
||||
g_string_append(human_str, is_small ? "bytes" : "B");
|
||||
g_string_append(human_str, is_small ? " bytes" : "B");
|
||||
break;
|
||||
case format_size_unit_bits:
|
||||
g_string_append(human_str, is_small ? "bits" : "b");
|
||||
g_string_append(human_str, is_small ? " bits" : "b");
|
||||
break;
|
||||
case format_size_unit_bits_s:
|
||||
g_string_append(human_str, is_small ? "bits/s" : "bps");
|
||||
g_string_append(human_str, is_small ? " bits/s" : "bps");
|
||||
break;
|
||||
case format_size_unit_bytes_s:
|
||||
g_string_append(human_str, is_small ? "bytes/s" : "Bps");
|
||||
g_string_append(human_str, is_small ? " bytes/s" : "Bps");
|
||||
break;
|
||||
case format_size_unit_packets:
|
||||
g_string_append(human_str, is_small ? " packets" : "packets");
|
||||
break;
|
||||
case format_size_unit_packets_s:
|
||||
g_string_append(human_str, is_small ? " packets/s" : "packets/s");
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
|
|
|
@ -86,11 +86,13 @@ WS_DLL_PUBLIC
|
|||
int ws_xton(char ch);
|
||||
|
||||
typedef enum {
|
||||
format_size_unit_none = 0, /**< No unit will be appended. You must supply your own. */
|
||||
format_size_unit_bytes = 1, /**< "bytes" for un-prefixed sizes, "B" otherwise. */
|
||||
format_size_unit_bits = 2, /**< "bits" for un-prefixed sizes, "b" otherwise. */
|
||||
format_size_unit_bits_s = 3, /**< "bits/s" for un-prefixed sizes, "bps" otherwise. */
|
||||
format_size_unit_bytes_s = 4, /**< "bytes/s" for un-prefixed sizes, "Bps" otherwise. */
|
||||
format_size_unit_none = 0, /**< No unit will be appended. You must supply your own. */
|
||||
format_size_unit_bytes = 1, /**< "bytes" for un-prefixed sizes, "B" otherwise. */
|
||||
format_size_unit_bits = 2, /**< "bits" for un-prefixed sizes, "b" otherwise. */
|
||||
format_size_unit_bits_s = 3, /**< "bits/s" for un-prefixed sizes, "bps" otherwise. */
|
||||
format_size_unit_bytes_s = 4, /**< "bytes/s" for un-prefixed sizes, "Bps" otherwise. */
|
||||
format_size_unit_packets = 5, /**< "packets" */
|
||||
format_size_unit_packets_s = 6, /**< "packets/s" */
|
||||
format_size_prefix_si = 0 << 8, /**< SI (power of 1000) prefixes will be used. */
|
||||
format_size_prefix_iec = 1 << 8 /**< IEC (power of 1024) prefixes will be used. */
|
||||
/* XXX format_size_prefix_default_for_this_particular_os ? */
|
||||
|
|
Loading…
Reference in New Issue