/**********************************************************************
 * ti library's routine for adding an environment variable to a node
 *
 * $Author: brlewis $
 * $Source: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/ti_setenv.c,v $
 * $Header: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/ti_setenv.c,v 0.1 92/03/12 15:27:57 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_setenv_c[] = "$Header: /afs/net.mit.edu/project/net_dev/brlewis/src/lib/RCS/ti_setenv.c,v 0.1 92/03/12 15:27:57 brlewis Exp $";
#endif /* lint */

#include <stdio.h>
#include <ti/ti.h>

/**********************************************************************
 * ti_setenv(ti_node *np, char *name, char *value)
 *
 * - adds kw to the ti_topic(np);
 * - returns error code
 **********************************************************************/

long
ti_setenv(np, name, value)
     ti_node *np;
     char *name, *value;
{
  register char *ptr1, *ptr2;
  char newkeyword[BUFSIZ];

  /* copy keywords so far */
  for (ptr1=name, ptr2=newkeyword;
       *ptr1;
       ptr1++, ptr2++) *ptr2 = *ptr1;

  /* add = separator */
  *(ptr2++) = '=';

  /* copy new keyword */
  for (ptr1=value; *ptr1; ptr1++, ptr2++) *ptr2 = *ptr1;

  /* end string */
  *ptr2 = '\0';

  return(ti_kwadd(np, newkeyword));
}
