diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-08-12 18:29:31 +0800 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-08-12 18:29:31 +0800 |
commit | 4d4a06afcbc6ca1a2056ab2e4973b454eba59de3 (patch) | |
tree | 548e0ffbf36d7491f98c6c901bc094bce2ec534e /easytool/utils.c | |
parent | e59e499029c05a68156cdf9d61ceac54e6813d3a (diff) |
split easytool into multiple files, add database of MRT station names
Diffstat (limited to 'easytool/utils.c')
-rw-r--r-- | easytool/utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 <stdlib.h> +#include <unistd.h> +#include <stdint.h> +#include <stdio.h> + +#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; +} |