name = argv[1];
if (strchr(name, '=')) {
- printf("## Error: illegal character '='"
+ printf("## Error: illegal character '=' "
"in variable name \"%s\"\n", name);
return 1;
}
*/
char *env_get_default(const char *name)
{
- if (env_get_from_linear(default_environment, name,
- (char *)(gd->env_buf),
- sizeof(gd->env_buf)) >= 0)
+ int ret;
+
+ ret = env_get_default_into(name, (char *)(gd->env_buf),
+ sizeof(gd->env_buf));
+ if (ret >= 0)
return (char *)(gd->env_buf);
return NULL;
}
+/*
+ * Look up the variable from the default environment and store its value in buf
+ */
+int env_get_default_into(const char *name, char *buf, unsigned int len)
+{
+ return env_get_from_linear(default_environment, name, buf, len);
+}
+
void env_set_default(const char *s, int flags)
{
if (s) {