1998-04-30 06:30:03 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Objective Caml */
|
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1998 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
|
|
|
/* under the terms of the GNU Library General Public License. */
|
1998-04-30 06:30:03 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1998-05-23 07:10:37 -07:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
1998-04-30 06:30:03 -07:00
|
|
|
#include <memory.h>
|
|
|
|
#include <mlvalues.h>
|
1998-05-23 07:10:37 -07:00
|
|
|
|
1998-04-30 06:30:03 -07:00
|
|
|
#include "unixsupport.h"
|
|
|
|
|
|
|
|
#ifdef HAS_PUTENV
|
|
|
|
|
|
|
|
value unix_putenv(value name, value val) /* ML */
|
|
|
|
{
|
|
|
|
mlsize_t namelen = string_length(name);
|
|
|
|
mlsize_t vallen = string_length(val);
|
|
|
|
char * s = (char *) stat_alloc(namelen + 1 + vallen + 1);
|
|
|
|
|
|
|
|
bcopy(String_val(name), s, namelen);
|
|
|
|
s[namelen] = '=';
|
|
|
|
bcopy(String_val(val), s + namelen + 1, vallen);
|
|
|
|
s[namelen + 1 + vallen] = 0;
|
|
|
|
if (putenv(s) == -1) uerror("putenv", name);
|
|
|
|
return Val_unit;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2000-04-05 11:30:22 -07:00
|
|
|
value unix_putenv(value name, value val)
|
1998-04-30 06:30:03 -07:00
|
|
|
{ invalid_argument("putenv not implemented"); }
|
|
|
|
|
|
|
|
#endif
|