mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 09:40:25 +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:
parent
8c86a8dee0
commit
3ce0e4f646
1 changed files with 5 additions and 1 deletions
|
@ -193,7 +193,11 @@ functions provided by Guile, it will also offer the function
|
||||||
static SCM
|
static SCM
|
||||||
my_hostname (void)
|
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
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue