1/*
2 * modetoa - return an asciized mode
3 */
4#include <stdio.h>
5
6#include "lib_strbuf.h"
7#include "ntp_stdlib.h"
8
9const char *
10modetoa(
11	int mode
12	)
13{
14	char *bp;
15	static const char *modestrings[] = {
16		"unspec",
17		"sym_active",
18		"sym_passive",
19		"client",
20		"server",
21		"broadcast",
22		"control",
23		"private",
24		"bclient",
25	};
26
27	if (mode < 0 || mode >= (sizeof modestrings)/sizeof(char *)) {
28		LIB_GETBUF(bp);
29		(void)sprintf(bp, "mode#%d", mode);
30		return bp;
31	}
32
33	return modestrings[mode];
34}
35