home *** CD-ROM | disk | FTP | other *** search
- #ifdef __STDC__
- static char sccs_id[] = "@(#) putenv.c 1.1 " __DATE__ " HJR";
- #else
- static char sccs_id[] = "@(#) putenv.c 1.1 26/9/90 HJR";
- #endif
-
- /* putenv.c (c) Copyright 1990 H.Rogers */
-
- #include <stdlib.h>
- #include <string.h>
-
- #include "sys/os.h"
- #include "sys/unix.h"
-
- #ifdef __STDC__
- int
- putenv (register char *s)
- #else
- int
- putenv (s)
- register char *s;
- #endif
- {
- register char *v;
- int r[10];
- os_error *e;
-
- if (!(v = strchr (s, '=')))
- return (-1);
-
- __addenv (s, 0);
-
- *v++ = 0;
- r[0] = (int) s;
- r[1] = (int) v;
- r[2] = strlen (v);
- r[3] = 0;
- r[4] = 0;
- e = os_swi (0x24, r);
- *--v = '=';
- if (e)
- {
- __seterr (e);
- return (-1);
- }
- return (0);
- }
-