bdc155d820
Approved by: roberto
36 lines
507 B
C
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];
|
|
}
|