File:  [CSRG BSD Unix] / 43BSDReno / contrib / isode-beta / compat / general.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

/* general.c - general utilities for emulation of 4.2BSD */

#ifndef	lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/compat/general.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif

/* 
 * $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/compat/general.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
 *
 *
 * $Log: general.c,v $
 * Revision 1.1.1.1  2018/04/24 16:12:56  root
 * BSD 4.3reno
 *
 * Revision 7.0  89/11/23  21:23:00  mrose
 * Release 6.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include <stdio.h>
#include "general.h"
#include "manifest.h"

/*    Berkeley UNIX: 4.2 */

#ifdef	BSD42

/* Simply including "general.h" is sufficient. */

#endif

/*    non-Berkeley UNIX */

#ifndef	BSDLIBC

#ifndef	lint

struct qelem {
    struct qelem   *q_forw;
    struct qelem   *q_back;
    char	    q_data[1];	/* extensible */
};


insque (elem, pred)
struct qelem   *elem,
	       *pred;
{
    pred -> q_forw -> q_back = elem;
    elem -> q_forw = pred -> q_forw;
    elem -> q_back = pred;
    pred -> q_forw = elem;
}


remque (elem)
struct qelem   *elem;
{
    elem -> q_forw -> q_back = elem -> q_back;
    elem -> q_back -> q_forw = elem -> q_forw;
}

#endif
#endif

/*    DUP2 */

#ifdef	SYS5
#include <fcntl.h>


extern int errno;


int     dup2 (d1, d2)
register int    d1,
                d2;
{
    int     d;

    if (d1 == d2)
	return OK;

    (void) close (d2);
    if ((d = fcntl (d1, F_DUPFD, d2)) == NOTOK)
	return NOTOK;
    if (d == d2)
	return OK;

    errno = 0;
    return NOTOK;
}
#endif

/*     BYTEORDER */

#ifndef	SWABLIB

/* ROS and HP-UX don't seem to have these in libc.a */

#undef	ntohs
u_short	ntohs (netshort) u_short netshort; { return netshort; }

#undef	htons
u_short	htons (hostshort) u_short hostshort; { return hostshort; }

#undef	ntohl
u_long	ntohl (netlong) u_long netlong; { return netlong; }

#undef	htonl
u_long	htonl (hostlong) u_long hostlong; { return hostlong; }

#endif

unix.superglobalmegacorp.com

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