* simpos.c (scm_getenv): return #f if string can't be found in the

environment instead of throwing an exception, for compatibility
with numerous other systems.
This commit is contained in:
Gary Houston 1996-12-11 19:06:31 +00:00
commit 9373b38711
2 changed files with 7 additions and 11 deletions

View file

@ -1,3 +1,9 @@
Tue Dec 10 23:38:43 1996 Gary Houston <ghouston@actrix.gen.nz>
* simpos.c (scm_getenv): return #f if string can't be found in the
environment instead of throwing an exception, for compatibility
with numerous other systems.
Mon Dec 9 23:23:35 1996 Tom Tromey <tromey@cygnus.com>
* Makefile.am (.c.x): Use guile-snarf.

View file

@ -90,17 +90,7 @@ scm_getenv(nam)
if (SCM_ROSTRINGP (nam))
nam = scm_makfromstr (SCM_ROCHARS (nam), SCM_ROLENGTH (nam), 0);
val = getenv(SCM_CHARS(nam));
if (!val)
{
/* This isn't a system error (errno won't be set), but is still
treated as an exceptional condition, since getenv normally
returns a string. Can easily do (false-if-exception (getenv ...))
to catch the exception.
*/
scm_misc_error (s_getenv, "%S not found in environment",
scm_listify (nam, SCM_UNDEFINED));
}
return scm_makfromstr(val, (scm_sizet)strlen(val), 0);
return (val) ? scm_makfromstr(val, (scm_sizet)strlen(val), 0) : SCM_BOOL_F;
}
#ifdef vms