Line | Count | Source (jump to first uncovered line) |
1 | /* | |
2 | * modetoa - return an asciized mode | |
3 | */ | |
4 | #include <config.h> | |
5 | #include <stdio.h> | |
6 | ||
7 | #include "lib_strbuf.h" | |
8 | #include "ntp_stdlib.h" | |
9 | ||
10 | const char * | |
11 | modetoa( | |
12 | size_t mode | |
13 | ) | |
14 | 246 | { |
15 | 246 | char *bp; |
16 | 246 | static const char * const modestrings[] = { |
17 | 246 | "unspec", |
18 | 246 | "sym_active", |
19 | 246 | "sym_passive", |
20 | 246 | "client", |
21 | 246 | "server", |
22 | 246 | "broadcast", |
23 | 246 | "control", |
24 | 246 | "private", |
25 | 246 | "bclient", |
26 | 246 | }; |
27 | ||
28 | 246 | if (mode >= COUNTOF(modestrings)) { |
29 | 0 | LIB_GETBUF(bp); |
30 | 0 | snprintf(bp, LIB_BUFLENGTH, "mode#%zu", mode); |
31 | 0 | return bp; |
32 | 0 | } |
33 | ||
34 | 246 | return modestrings[mode]; |
35 | 246 | } |