aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-03-25 11:37:04 +0800
committerHarald Welte <laforge@gnumonks.org>2010-03-25 11:46:46 +0800
commitb59f9350f873833757cc750306a074495f24e095 (patch)
treeec818fe9944fc37d579e225307f8fadc406479aa
parentb2eb83fa95b209fb01de2996a1382c944fc265fe (diff)
get_value_string(): return "unknown 0x..." instead of "unknown"
-rw-r--r--src/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index 2a73d39..4dab064 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -2,9 +2,11 @@
#include <string.h>
#include <stdint.h>
#include <errno.h>
+#include <stdio.h>
#include <osmocore/utils.h>
+static char namebuf[255];
const char *get_value_string(const struct value_string *vs, uint32_t val)
{
int i;
@@ -15,7 +17,9 @@ const char *get_value_string(const struct value_string *vs, uint32_t val)
if (vs[i].value == val)
return vs[i].str;
}
- return "unknown";
+
+ snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
+ return namebuf;
}
int get_string_value(const struct value_string *vs, const char *str)