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

1.1     ! root        1: /* general.c - general utilities for emulation of 4.2BSD */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/compat/RCS/general.c,v 7.0 89/11/23 21:23:00 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/compat/RCS/general.c,v 7.0 89/11/23 21:23:00 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       general.c,v $
        !            12:  * Revision 7.0  89/11/23  21:23:00  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: 
        !            34: /*    Berkeley UNIX: 4.2 */
        !            35: 
        !            36: #ifdef BSD42
        !            37: 
        !            38: /* Simply including "general.h" is sufficient. */
        !            39: 
        !            40: #endif
        !            41: 
        !            42: /*    non-Berkeley UNIX */
        !            43: 
        !            44: #ifndef        BSDLIBC
        !            45: 
        !            46: #ifndef        lint
        !            47: 
        !            48: struct qelem {
        !            49:     struct qelem   *q_forw;
        !            50:     struct qelem   *q_back;
        !            51:     char           q_data[1];  /* extensible */
        !            52: };
        !            53: 
        !            54: 
        !            55: insque (elem, pred)
        !            56: struct qelem   *elem,
        !            57:               *pred;
        !            58: {
        !            59:     pred -> q_forw -> q_back = elem;
        !            60:     elem -> q_forw = pred -> q_forw;
        !            61:     elem -> q_back = pred;
        !            62:     pred -> q_forw = elem;
        !            63: }
        !            64: 
        !            65: 
        !            66: remque (elem)
        !            67: struct qelem   *elem;
        !            68: {
        !            69:     elem -> q_forw -> q_back = elem -> q_back;
        !            70:     elem -> q_back -> q_forw = elem -> q_forw;
        !            71: }
        !            72: 
        !            73: #endif
        !            74: #endif
        !            75: 
        !            76: /*    DUP2 */
        !            77: 
        !            78: #ifdef SYS5
        !            79: #include <fcntl.h>
        !            80: 
        !            81: 
        !            82: extern int errno;
        !            83: 
        !            84: 
        !            85: int     dup2 (d1, d2)
        !            86: register int    d1,
        !            87:                 d2;
        !            88: {
        !            89:     int     d;
        !            90: 
        !            91:     if (d1 == d2)
        !            92:        return OK;
        !            93: 
        !            94:     (void) close (d2);
        !            95:     if ((d = fcntl (d1, F_DUPFD, d2)) == NOTOK)
        !            96:        return NOTOK;
        !            97:     if (d == d2)
        !            98:        return OK;
        !            99: 
        !           100:     errno = 0;
        !           101:     return NOTOK;
        !           102: }
        !           103: #endif
        !           104: 
        !           105: /*     BYTEORDER */
        !           106: 
        !           107: #ifndef        SWABLIB
        !           108: 
        !           109: /* ROS and HP-UX don't seem to have these in libc.a */
        !           110: 
        !           111: #undef ntohs
        !           112: u_short        ntohs (netshort) u_short netshort; { return netshort; }
        !           113: 
        !           114: #undef htons
        !           115: u_short        htons (hostshort) u_short hostshort; { return hostshort; }
        !           116: 
        !           117: #undef ntohl
        !           118: u_long ntohl (netlong) u_long netlong; { return netlong; }
        !           119: 
        !           120: #undef htonl
        !           121: u_long htonl (hostlong) u_long hostlong; { return hostlong; }
        !           122: 
        !           123: #endif

unix.superglobalmegacorp.com

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