From 95a7985ea3acb886ea0b9861bf88abc5627a3cfd Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 20 Feb 2008 14:04:30 +0000 Subject: Simply our code - only set env vars when needed. --- src/rc/rc-misc.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src') 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); -- cgit v1.2.3