1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00
freebsd/contrib/ntp/libntp/modetoa.c
Cy Schubert 2b15cb3d09 MFV ntp 4.2.8p1 (r258945, r275970, r276091, r276092, r276093, r278284)
Thanks to roberto for providing pointers to wedge this into HEAD.

Approved by:	roberto
2015-03-30 13:30:15 +00:00

36 lines
507 B
C

/*
* modetoa - return an asciized mode
*/
#include <config.h>
#include <stdio.h>
#include "lib_strbuf.h"
#include "ntp_stdlib.h"
const char *
modetoa(
size_t mode
)
{
char *bp;
static const char * const modestrings[] = {
"unspec",
"sym_active",
"sym_passive",
"client",
"server",
"broadcast",
"control",
"private",
"bclient",
};
if (mode >= COUNTOF(modestrings)) {
LIB_GETBUF(bp);
snprintf(bp, LIB_BUFLENGTH, "mode#%zu", mode);
return bp;
}
return modestrings[mode];
}