mirror of
https://github.com/Stichting-MINIX-Research-Foundation/netbsd.git
synced 2025-08-09 05:59:13 -04:00
37 lines
545 B
C
37 lines
545 B
C
/* $NetBSD: modetoa.c,v 1.3 2012/02/01 07:46:22 kardel Exp $ */
|
|
|
|
/*
|
|
* modetoa - return an asciized mode
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
#include "lib_strbuf.h"
|
|
#include "ntp_stdlib.h"
|
|
|
|
const char *
|
|
modetoa(
|
|
size_t mode
|
|
)
|
|
{
|
|
char *bp;
|
|
static const char *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];
|
|
}
|