]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/libntp/modetoa.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / libntp / modetoa.c
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 {
15         char *bp;
16         static const char * const modestrings[] = {
17                 "unspec",
18                 "sym_active",
19                 "sym_passive",
20                 "client",
21                 "server",
22                 "broadcast",
23                 "control",
24                 "private",
25                 "bclient",
26         };
27
28         if (mode >= COUNTOF(modestrings)) {
29                 LIB_GETBUF(bp);
30                 snprintf(bp, LIB_BUFLENGTH, "mode#%zu", mode);
31                 return bp;
32         }
33
34         return modestrings[mode];
35 }