diff options
author | Roy Marples <roy@marples.name> | 2008-02-20 14:04:30 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-02-20 14:04:30 +0000 |
commit | 95a7985ea3acb886ea0b9861bf88abc5627a3cfd (patch) | |
tree | 778b8e27259193836b82522739910406d81a0180 /src/rc/rc-misc.c | |
parent | 2456a265ee26592df655ffe294158c49b15a0341 (diff) |
Simply our code - only set env vars when needed.
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r-- | src/rc/rc-misc.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index f1622fcf..cb7d2b12 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -245,7 +245,6 @@ char **env_config (void) FILE *fp; char buffer[PATH_MAX]; char *runlevel = rc_runlevel_get (); - char *p; /* One char less to drop the trailing / */ l = strlen ("RC_LIBDIR=") + strlen (RC_LIBDIR) + 1; @@ -304,25 +303,15 @@ char **env_config (void) } /* Be quiet or verbose as necessary */ - if ((p = rc_conf_value ("rc_quiet"))) { - l = strlen ("EINFO_QUIET=") + strlen (p) + 1; - line = xmalloc (sizeof (char) * l); - snprintf (line, l, "EINFO_QUIET=%s", p); - 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); - } + if (rc_conf_yesno ("rc_quiet")) + rc_strlist_add (&env, "EINFO_QUIET=YES"); + if (rc_conf_yesno ("rc_verbose")) + rc_strlist_add (&env, "EINFO_VERBOSE=YES"); errno = 0; if ((! rc_conf_yesno ("rc_color") && errno == 0) || rc_conf_yesno ("rc_nocolor")) - rc_strlist_add (&env, "EINFO_COLOR=no"); + rc_strlist_add (&env, "EINFO_COLOR=NO"); free (runlevel); return (env); |