summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorHarald Welte2010-03-25 04:37:04 +0100
committerHarald Welte2010-03-25 04:46:46 +0100
commitb59f9350f873833757cc750306a074495f24e095 (patch)
treeec818fe9944fc37d579e225307f8fadc406479aa /src/utils.c
parentCreate a dummy m4 directory to make autoreconf --install --force work (diff)
downloadlibosmocore-b59f9350f873833757cc750306a074495f24e095.tar.gz
libosmocore-b59f9350f873833757cc750306a074495f24e095.tar.xz
libosmocore-b59f9350f873833757cc750306a074495f24e095.zip
get_value_string(): return "unknown 0x..." instead of "unknown"
Diffstat (limited to 'src/utils.c')
-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)