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