1/* $NetBSD: modetoa.c,v 1.3 2012/02/01 07:46:22 kardel 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 11const char * 12modetoa( 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 >= COUNTOF(modestrings)) { 30 LIB_GETBUF(bp); 31 snprintf(bp, LIB_BUFLENGTH, "mode#%zu", mode); 32 return bp; 33 } 34 35 return modestrings[mode]; 36} 37