mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 08:52:46 +00:00
35 lines
493 B
C
35 lines
493 B
C
/*
|
|
* modetoa - return an asciized mode
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
#include "lib_strbuf.h"
|
|
#include "ntp_stdlib.h"
|
|
|
|
const char *
|
|
modetoa(
|
|
int mode
|
|
)
|
|
{
|
|
char *bp;
|
|
static const char *modestrings[] = {
|
|
"unspec",
|
|
"sym_active",
|
|
"sym_passive",
|
|
"client",
|
|
"server",
|
|
"broadcast",
|
|
"control",
|
|
"private",
|
|
"bclient",
|
|
};
|
|
|
|
if (mode < 0 || mode >= (sizeof modestrings)/sizeof(char *)) {
|
|
LIB_GETBUF(bp);
|
|
(void)sprintf(bp, "mode#%d", mode);
|
|
return bp;
|
|
}
|
|
|
|
return modestrings[mode];
|
|
}
|