home *** CD-ROM | disk | FTP | other *** search
- /* vi:tabstop=4:shiftwidth=4:smartindent
- *
- * osgetenv.c - Get a variable value, using the OS calls, as
- * UnixLib maintains copies of the env. when it
- * starts up, so getenv can return wrong values.
- */
-
- #include <sys/os.h>
- #include "psh.h"
-
- char *osgetenv(char *var)
- {
- static char p[MAXLEN];
- int r[10];
-
- /* getenv isn't good enough, as Unixlib reads the env.
- * when it starts.
- */
- r[0] = (int) var;
- r[1] = (int) p;
- r[2] = MAXLEN;
- r[3] = 0;
- r[4] = 3;
-
- if (os_swi(OS_ReadVarVal, r))
- {
- return NULL;
- }
-
- p[r[2]] = '\0';
- return p;
- }
-