Annotation of embedaddon/ntp/libntp/modetoa.c, revision 1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>