/**********************************************************************
 * luc_ping.c -- ask server when daemon started running
 *
 * $Author: brlewis $
 * $Source$
 * $Header$
 *
 * Copyright 1991 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 **********************************************************************/
#include <mit-copyright.h>

#ifndef lint
static char rcsid_luc_ping_c[] = "$Header$";
#endif /* lint */

#include <stdio.h>
#ifdef POSIX
#include <time.h>
#else /* POSIX */
#include <sys/types.h>
#endif /* POSIX */
#include <strings.h>
#include <lucy/lucy.h>

/**********************************************************************
 * luc_ping(time_t *tp)
 *
 * - sends request to server
 * - puts lucyd start time in *tp
 * - returns error code
 **********************************************************************/

long
luc_ping(tp)
     time_t *tp;
{
  enum clnt_stat retval;

  retval=callrpc(luv_host, luv_prog, LUCY_RPC_VERS, LUCY_RPC_UPTIME,
		 xdr_void, NULL, xdr_long, (char *)tp);
  if (retval) {
    strcpy(luv_context, luv_host);
    return(LUC_RPC_SUCCESS + (long) retval);
  }

  return(0L);
}
