forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnames.c
43 lines (35 loc) · 1006 Bytes
/
names.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "names.h"
/* Indented for 'check-source' because it has to be included after names.h */
#include "gen_state_names.h"
const char *state_name(enum state s)
{
size_t i;
for (i = 0; enum_state_names[i].name; i++)
if (enum_state_names[i].v == s)
return enum_state_names[i].name;
return "unknown";
}
const char *input_name(enum state_input in)
{
size_t i;
for (i = 0; enum_state_input_names[i].name; i++)
if (enum_state_input_names[i].v == in)
return enum_state_input_names[i].name;
return "unknown";
}
const char *cstatus_name(enum command_status cstatus)
{
size_t i;
for (i = 0; enum_command_status_names[i].name; i++)
if (enum_command_status_names[i].v == cstatus)
return enum_command_status_names[i].name;
return "unknown";
}
const char *peercond_name(enum state_peercond peercond)
{
size_t i;
for (i = 0; enum_state_peercond_names[i].name; i++)
if (enum_state_peercond_names[i].v == peercond)
return enum_state_peercond_names[i].name;
return "unknown";
}