Annotation of 43BSDReno/contrib/isode-beta/compat/isohost.c, revision 1.1

1.1     ! root        1: /* isohost.c - getlocalhost */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/compat/RCS/isohost.c,v 7.0 89/11/23 21:23:08 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/compat/RCS/isohost.c,v 7.0 89/11/23 21:23:08 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       isohost.c,v $
        !            12:  * Revision 7.0  89/11/23  21:23:08  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include "general.h"
        !            32: #include "manifest.h"
        !            33: #ifdef TCP
        !            34: #include "internet.h"
        !            35: #endif
        !            36: #include "tailor.h"
        !            37: #ifdef SYS5
        !            38: #include <sys/utsname.h>
        !            39: #endif
        !            40: 
        !            41: /*  */
        !            42: 
        !            43: char   *getlocalhost () {
        !            44:     register char   *cp;
        !            45: #ifdef TCP
        !            46:     register struct hostent *hp;
        !            47: #endif
        !            48: #ifdef SYS5
        !            49:     struct utsname uts;
        !            50: #endif
        !            51:     static char buffer[BUFSIZ];
        !            52: 
        !            53:     if (buffer[0])
        !            54:        return buffer;
        !            55: 
        !            56:     isodetailor (NULLCP, 0);
        !            57:     if (*isodename)
        !            58:        (void) strcpy (buffer, isodename);
        !            59:     else {
        !            60: #if    !defined(SOCKETS) && !defined(SYS5)
        !            61:        (void) strcpy (buffer, "localhost");
        !            62: #endif
        !            63: #ifdef SOCKETS
        !            64:        (void) gethostname (buffer, sizeof buffer);
        !            65: #endif
        !            66: #ifdef SYS5
        !            67:        (void) uname (&uts);
        !            68:        (void) strcpy (buffer, uts.nodename);
        !            69: #endif
        !            70: 
        !            71: #ifdef TCP
        !            72:        if (hp = gethostbyname (buffer))
        !            73:            (void) strcpy (buffer, hp -> h_name);
        !            74:        else
        !            75:            SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
        !            76:                  ("%s: unknown host", buffer));
        !            77: #endif
        !            78: 
        !            79:        if (cp = index (buffer, '.'))
        !            80:            *cp = NULL;
        !            81:     }
        !            82: 
        !            83:     return buffer;
        !            84: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.