File: modetoa.c

package info (click to toggle)
ntp 1%3A4.2.6.p5%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 22,056 kB
  • sloc: ansic: 144,116; sh: 12,381; perl: 1,401; makefile: 1,274; yacc: 1,034; awk: 417; asm: 37; sed: 7
file content (34 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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 >= COUNTOF(modestrings)) {
		LIB_GETBUF(bp);
		snprintf(bp, LIB_BUFLENGTH, "mode#%d", mode);
		return bp;
	}

	return modestrings[mode];
}