because the convention is to represent ports in base 10.
gcc-workaround is no longer needed and was removed.
Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
#define SYMBOL(id, v) { .identifier = (id), .value = (v) }
#define SYMBOL_LIST_END (struct symbolic_constant) { }
+/**
+ * enum base - indicate how to display symbol table values
+ *
+ * @BASE_HEXADECIMAL: hexadecimal
+ * @BASE_DECIMAL: decimal
+ */
+enum base {
+ BASE_HEXADECIMAL,
+ BASE_DECIMAL,
+};
+
/**
* struct symbol_table - type construction from symbolic values
*
+ * @base: base of symbols representation
* @symbols: the symbols
*/
struct symbol_table {
- int gcc_workaround;
+ enum base base;
struct symbolic_constant symbols[];
};
if (byteorder == BYTEORDER_BIG_ENDIAN)
switch_byteorder(&value, len);
- printf("\t%-30s\t0x%.*" PRIx64 "\n",
- s->identifier, 2 * len, value);
+ if (tbl->base == BASE_DECIMAL)
+ printf("\t%-30s\t%20lu\n", s->identifier, value);
+ else
+ printf("\t%-30s\t0x%.*" PRIx64 "\n",
+ s->identifier, 2 * len, value);
}
}
#include <datatype.h>
const struct symbol_table inet_service_tbl = {
- .symbols = {
+ .base = BASE_DECIMAL,
+ .symbols = {
SYMBOL("tcpmux", __constant_htons(1)),
SYMBOL("echo", __constant_htons(7)),
SYMBOL("discard", __constant_htons(9)),