blob: ab8fb727eb7e734a1e662aaf8f1c3cebefa38119 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}
|