diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-12-02 09:01:21 +0000 |
---|---|---|
committer | <> | 2014-12-04 16:11:25 +0000 |
commit | bdab5265fcbf3f472545073a23f8999749a9f2b9 (patch) | |
tree | c6018dd03dea906f8f1fb5f105f05b71a7dc250a /libntp/modetoa.c | |
download | ntp-bdab5265fcbf3f472545073a23f8999749a9f2b9.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
Diffstat (limited to 'libntp/modetoa.c')
-rw-r--r-- | libntp/modetoa.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libntp/modetoa.c b/libntp/modetoa.c new file mode 100644 index 0000000..b476bc9 --- /dev/null +++ b/libntp/modetoa.c @@ -0,0 +1,35 @@ +/* + * modetoa - return an asciized mode + */ +#include <config.h> +#include <stdio.h> + +#include "lib_strbuf.h" +#include "ntp_stdlib.h" + +const char * +modetoa( + int mode + ) +{ + char *bp; + static const char * const modestrings[] = { + "unspec", + "sym_active", + "sym_passive", + "client", + "server", + "broadcast", + "control", + "private", + "bclient", + }; + + if (mode < 0 || mode >= COUNTOF(modestrings)) { + LIB_GETBUF(bp); + snprintf(bp, LIB_BUFLENGTH, "mode#%d", mode); + return bp; + } + + return modestrings[mode]; +} |