From 4d4a06afcbc6ca1a2056ab2e4973b454eba59de3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 12 Aug 2010 18:29:31 +0800 Subject: split easytool into multiple files, add database of MRT station names --- easytool/utils.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 easytool/utils.c (limited to 'easytool/utils.c') diff --git a/easytool/utils.c b/easytool/utils.c new file mode 100644 index 0000000..ab8fb72 --- /dev/null +++ b/easytool/utils.c @@ -0,0 +1,23 @@ + +#include +#include +#include +#include + +#include "utils.h" + +static char namebuf[255]; +const char *get_value_string(const struct value_string *vs, uint32_t val) +{ + int i; + + for (i = 0;; i++) { + if (vs[i].value == 0 && vs[i].str == NULL) + break; + if (vs[i].value == val) + return vs[i].str; + } + + snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val); + return namebuf; +} -- cgit v1.2.3