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