diff options
Diffstat (limited to 'usr.sbin/xntpd/lib/modetoa.c')
-rw-r--r-- | usr.sbin/xntpd/lib/modetoa.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/usr.sbin/xntpd/lib/modetoa.c b/usr.sbin/xntpd/lib/modetoa.c new file mode 100644 index 0000000..4833271 --- /dev/null +++ b/usr.sbin/xntpd/lib/modetoa.c @@ -0,0 +1,33 @@ +/* modetoa.c,v 3.1 1993/07/06 01:08:33 jbj Exp + * modetoa - return an asciized mode + */ +#include <stdio.h> + +#include "lib_strbuf.h" +#include "ntp_stdlib.h" + +char * +modetoa(mode) + int mode; +{ + char *bp; + static char *modestrings[] = { + "unspec", + "sym_active", + "sym_passive", + "client", + "server", + "broadcast", + "control", + "private", + "bclient", + }; + + if (mode < 0 || mode >= (sizeof modestrings)/sizeof(char *)) { + LIB_GETBUF(bp); + (void)sprintf(bp, "mode#%d", mode); + return bp; + } + + return modestrings[mode]; +} |