Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ec314c95
Commit
ec314c95
authored
Nov 14, 2015
by
Paul Sokolovsky
Browse files
unix/modos: getenv(): Handle non-existing envvar correctly.
parent
16d42368
Changes
1
Hide whitespace changes
Inline
Side-by-side
unix/modos.c
View file @
ec314c95
...
...
@@ -137,6 +137,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system);
STATIC
mp_obj_t
mod_os_getenv
(
mp_obj_t
var_in
)
{
const
char
*
s
=
getenv
(
mp_obj_str_get_str
(
var_in
));
if
(
s
==
NULL
)
{
return
mp_const_none
;
}
return
mp_obj_new_str
(
s
,
strlen
(
s
),
false
);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mod_os_getenv_obj
,
mod_os_getenv
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment