/**********************************************************************
 * 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_H hnode, LPSTR name, LPSTR value)
 *
 * - adds kw to hnode's ti_topic;
 * - returns error code
 **********************************************************************/

/* jms 7/24/92 -- windows-izing completed, pending approval */

long
ti_setenv(hnode, name, value)
     ti_node_H hnode;
     LPSTR name, value;
{
  register LPSTR ptr1, ptr2;
  static 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(hnode, newkeyword));
}
