freebsd-src/contrib/ntp/libntp/modetoa.c
Cy Schubert f5f40dd63b ntp: Vendor import of ntp-4.2.8p18
MFC:	3 days

Merge commit '1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad' into main
2024-05-26 18:41:22 -07:00

35 lines
483 B
C

/*
* modetoa - return an asciized mode
*/
#include <config.h>
#include <stdio.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];
}