diff --git a/hyptop/table.h b/hyptop/table.h index 34e42940..87d9f791 100644 --- a/hyptop/table.h +++ b/hyptop/table.h @@ -106,6 +106,7 @@ struct table_col_priv { char head_char[2]; char head_last[TABLE_HEADING_SIZE]; int rsort; + int needs_quotes; }; /* @@ -135,6 +136,11 @@ static inline int table_col_enabled(struct table_col *col) return col->p->enabled; } +static inline int table_col_needs_quotes(struct table_col *col) +{ + return col->p->needs_quotes; +} + /* * Table Column Constructor Macros */ diff --git a/hyptop/table_col_unit.c b/hyptop/table_col_unit.c index 630ad5d1..0f460ab2 100644 --- a/hyptop/table_col_unit.c +++ b/hyptop/table_col_unit.c @@ -63,7 +63,7 @@ static int l_unit_raw(struct table_col *col, struct table_entry *e) */ static int l_str(struct table_col *col, struct table_entry *e) { - (void) col; + col->p->needs_quotes = 1; return strlen(e->str); } @@ -226,6 +226,8 @@ static int l_unit_hm_u64(char *str, u64 v1, int negative) static int l_unit_hm(struct table_col *col, struct table_entry *e) { + col->p->needs_quotes = 1; + if (!e->set) return snprintf(e->str, sizeof(e->str), L_COL_NOT_SET_STR); @@ -272,6 +274,8 @@ static int l_unit_dhm_u64(char *str, u64 v1, int negative) static int l_unit_dhm(struct table_col *col, struct table_entry *e) { + col->p->needs_quotes = 1; + if (!e->set) return snprintf(e->str, sizeof(e->str), L_COL_NOT_SET_STR);