File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / modetoa.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 5 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: /*
    2:  * modetoa - return an asciized mode
    3:  */
    4: #include <stdio.h>
    5: 
    6: #include "lib_strbuf.h"
    7: #include "ntp_stdlib.h"
    8: 
    9: const char *
   10: modetoa(
   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 >= COUNTOF(modestrings)) {
   28: 		LIB_GETBUF(bp);
   29: 		snprintf(bp, LIB_BUFLENGTH, "mode#%d", mode);
   30: 		return bp;
   31: 	}
   32: 
   33: 	return modestrings[mode];
   34: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>