1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

(Linking Guile into Programs): Enhance example program,

change scm_str2string to scm_from_locale_string, since scm_str2string
is "discouraged".  And check for NULL from getenv since neither
scm_str2string nor scm_from_locale_string can cope with that.
Reported by Frithjof.
This commit is contained in:
Kevin Ryde 2006-05-09 22:51:55 +00:00
parent 8c86a8dee0
commit 3ce0e4f646

View file

@ -193,7 +193,11 @@ functions provided by Guile, it will also offer the function
static SCM
my_hostname (void)
@{
return scm_str2string (getenv ("HOSTNAME"));
char *s = getenv ("HOSTNAME");
if (s == NULL)
return SCM_BOOL_F;
else
return scm_from_locale_string (s);
@}
static void