/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* rtime - get time from remote machine
*
* gets time, obtaining value from host
* with time of day in seconds since Jan 1, 1900, must
* subtract seconds before Jan 1, 1970 to get
* what unix uses.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <malloc.h>
extern int _socket(int, int, int);
extern int _sendto(int, const char *, int, int,
const struct sockaddr *, int);
extern int _recvfrom(int, char *, int, int,
struct sockaddr *, int *);
extern int __rpc_dtbsize();
extern int close(int);
static void do_close();
int
struct sockaddr_in *addrp;
{
int s;
int res;
int fromlen;
int type;
type = SOCK_STREAM;
} else {
type = SOCK_DGRAM;
}
if (s < 0) {
return (-1);
}
if (type == SOCK_DGRAM) {
if (res < 0) {
do_close(s);
return (-1);
}
do {
if (res <= 0) {
if (res == 0) {
}
do_close(s);
return (-1);
}
do_close(s);
if (res < 0) {
return (-1);
}
} else {
sizeof (*addrp)) < 0) {
do_close(s);
return (-1);
}
do_close(s);
if (res < 0) {
return (-1);
}
}
return (-1);
}
#ifdef _ILP32
#endif
return (0);
}
static void
do_close(s)
int s;
{
int save;
(void) close(s);
}