Simply our code - only set env vars when needed.
This commit is contained in:
parent
2456a265ee
commit
95a7985ea3
@ -245,7 +245,6 @@ char **env_config (void)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
char *runlevel = rc_runlevel_get ();
|
char *runlevel = rc_runlevel_get ();
|
||||||
char *p;
|
|
||||||
|
|
||||||
/* One char less to drop the trailing / */
|
/* One char less to drop the trailing / */
|
||||||
l = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR) + 1;
|
l = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR) + 1;
|
||||||
@ -304,25 +303,15 @@ char **env_config (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Be quiet or verbose as necessary */
|
/* Be quiet or verbose as necessary */
|
||||||
if ((p = rc_conf_value ("rc_quiet"))) {
|
if (rc_conf_yesno ("rc_quiet"))
|
||||||
l = strlen ("EINFO_QUIET=") + strlen (p) + 1;
|
rc_strlist_add (&env, "EINFO_QUIET=YES");
|
||||||
line = xmalloc (sizeof (char) * l);
|
if (rc_conf_yesno ("rc_verbose"))
|
||||||
snprintf (line, l, "EINFO_QUIET=%s", p);
|
rc_strlist_add (&env, "EINFO_VERBOSE=YES");
|
||||||
rc_strlist_add (&env, line);
|
|
||||||
free (line);
|
|
||||||
}
|
|
||||||
if ((p = rc_conf_value ("rc_verbose"))) {
|
|
||||||
l = strlen ("EINFO_VERBOSE=") + strlen (p) + 1;
|
|
||||||
line = xmalloc (sizeof (char) * l);
|
|
||||||
snprintf (line, l, "EINFO_VERBOSE=%s", p);
|
|
||||||
rc_strlist_add (&env, line);
|
|
||||||
free (line);
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((! rc_conf_yesno ("rc_color") && errno == 0) ||
|
if ((! rc_conf_yesno ("rc_color") && errno == 0) ||
|
||||||
rc_conf_yesno ("rc_nocolor"))
|
rc_conf_yesno ("rc_nocolor"))
|
||||||
rc_strlist_add (&env, "EINFO_COLOR=no");
|
rc_strlist_add (&env, "EINFO_COLOR=NO");
|
||||||
|
|
||||||
free (runlevel);
|
free (runlevel);
|
||||||
return (env);
|
return (env);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user