|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 2406 (0x966)
Types: TextFile
Names: »socket.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/others/quipu/uips/dish/socket.c«
/* socket.c - dish -pipe support */
#ifndef lint
static char *rcsid = "$Header: /f/osi/others/quipu/uips/dish/RCS/socket.c,v 7.0 89/11/23 22:36:06 mrose Rel $";
#endif
/*
* $Header: /f/osi/others/quipu/uips/dish/RCS/socket.c,v 7.0 89/11/23 22:36:06 mrose Rel $
*
*
* $Log: socket.c,v $
* Revision 7.0 89/11/23 22:36:06 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.
*
*/
#include <stdio.h>
#include "quipu/util.h"
#include "tailor.h"
#include "general.h"
#ifdef SOCKETS /* USE INTERNET SOCKETS */
#include "internet.h"
get_dish_sock (isock, pid)
struct sockaddr_in *isock;
int pid;
{
int myppid;
char * getenv ();
char * ptr, * prnt;
static char buffer [BUFSIZ];
static char parent [BUFSIZ];
int portno;
char *dp;
register struct hostent *hp;
if ((myppid = pid) == 0)
myppid = getppid ();
if (pid != 0 || (ptr = getenv ("DISHPROC")) == NULLCP) {
#ifdef notanymore
char *cp;
#endif
portno = (myppid & 0xffff) | 0x8000;
#ifdef notanymore
if ((hp = gethostbystring (cp = getlocalhost ())) == NULL) {
(void) fprintf (stderr,"%s: unknown host", cp);
return (-1);
}
(void) sprintf (buffer, "%s %d",
inet_ntoa (*(struct in_addr *) hp -> h_addr),
portno);
#else
(void) sprintf (buffer, "127.0.0.1 %d", portno);
#endif
(void) setenv ("DISHPROC", ptr = buffer);
}
if (pid !=0 || (prnt = getenv ("DISHPARENT")) == NULLCP) {
(void) sprintf (parent, "%d", myppid);
(void) setenv ("DISHPARENT", prnt = parent);
}
if (sscanf (prnt, "%d", &pid) != 1) {
(void) fprintf (stderr,"DISHPARENT malformed");
return (-1);
}
if ((dp = index (ptr, ' ')) == NULLCP || sscanf (dp + 1, "%d", &portno) != 1) {
(void) fprintf (stderr,"DISHPROC malformed");
return (-1);
}
*dp = NULL;
if ((hp = gethostbystring (ptr)) == NULL) {
(void) fprintf (stderr,"%s: unknown host in DISHPROC", ptr);
return (-1);
}
*dp = ' ';
bzero ((char *) isock, sizeof *isock);
isock -> sin_family = hp -> h_addrtype;
isock -> sin_port = htons ((u_short) portno);
inaddr_copy (hp, isock);
return (0);
}
#else /* USE UNIX NAMED PIPES */
void dummy ()
{
;
}
#endif