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

1.1     ! misho       1: /*
        !             2:  * refnumtoa - return asciized refclock addresses stored in local array space
        !             3:  */
        !             4: #include <stdio.h>
        !             5: 
        !             6: #include "ntp_net.h"
        !             7: #include "lib_strbuf.h"
        !             8: #include "ntp_stdlib.h"
        !             9: 
        !            10: char *
        !            11: refnumtoa(
        !            12:        sockaddr_u *num
        !            13:        )
        !            14: {
        !            15:        register u_int32 netnum;
        !            16:        register char *buf;
        !            17:        register const char *rclock;
        !            18: 
        !            19:        LIB_GETBUF(buf);
        !            20: 
        !            21:        if (ISREFCLOCKADR(num)) {
        !            22:                netnum = SRCADR(num);
        !            23:                rclock = clockname((int)((u_long)netnum >> 8) & 0xff);
        !            24: 
        !            25:                if (rclock != NULL)
        !            26:                        snprintf(buf, LIB_BUFLENGTH, "%s(%lu)",
        !            27:                                 rclock, (u_long)netnum & 0xff);
        !            28:                else
        !            29:                        snprintf(buf, LIB_BUFLENGTH, "REFCLK(%lu,%lu)",
        !            30:                                 ((u_long)netnum >> 8) & 0xff,
        !            31:                                 (u_long)netnum & 0xff);
        !            32: 
        !            33:        }
        !            34: 
        !            35:        return buf;
        !            36: }

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