/**********************************************************************
 * ti library's routine for removing nodes
 *
 * $Author: brlewis $
 * $Source: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/remove.c,v $
 * $Header: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/remove.c,v 0.2 92/04/01 16:19:05 brlewis Exp $
 *
 * 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_ti_remove_c[] = "$Header: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/remove.c,v 0.2 92/04/01 16:19:05 brlewis Exp $";
#endif /* lint */

#include <stdio.h>
#include <string.h>
#include <ti/ti.h>

/**********************************************************************
 * ti_remove(TI_H hti, long nid)
 *	caller supplies node id of node to remove.
 *
 * - returns error code
 **********************************************************************/

/* jms 7/13/92 -- windows-izing completed, pending approval */

long
ti_remove(hti, nid)
     TI_H hti;
     long nid;
{
  long code;
  static char inbuf[BUFSIZ];

  /* send command and receive reply */
  if (code = _ti_talkf(hti, inbuf, BUFSIZ-1, "x:%ld\n", nid))
    return(code);

  /* success? */
  if (!atoi(inbuf)) return(0L);

  /* failure */
  sprintf(ti_context, "%ld", nid);
  return(_ti_srverr(inbuf));
}
