mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 10:42:45 +00:00
f5f40dd63b
MFC: 3 days Merge commit '1f833b3fc9968c3dd7ed79ccf0525ebf16c891ad' into main
35 lines
483 B
C
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];
|
|
}
|