modetoa.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* modetoa - return an asciized mode
*/
#include <stdio.h>
#include "lib_strbuf.h"
#include "ntp_stdlib.h"
const char *
modetoa(mode)
int mode;
{
char *bp;
static const 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];
}