From cd45e5435762d8c6cd13287df7df16b97755176e Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 19 Dec 2007 12:46:08 +0000 Subject: Introduce cbasename so we don't have to strdup(basename) and free all the time. --- src/rc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/rc.c') diff --git a/src/rc.c b/src/rc.c index 507a1651..7a33e64e 100644 --- a/src/rc.c +++ b/src/rc.c @@ -36,8 +36,6 @@ const char copyright[] = "Copyright (c) 2007 Roy Marples"; -#define APPLET "rc" - #define SYSLOG_NAMES #include @@ -49,7 +47,6 @@ const char copyright[] = "Copyright (c) 2007 Roy Marples"; #include #include #include -#include #include #include #include @@ -93,7 +90,7 @@ extern char **environ; static char *RUNLEVEL = NULL; static char *PREVLEVEL = NULL; -static char *applet = NULL; +static const char *applet = NULL; static char *runlevel = NULL; static char **env = NULL; static char **newenv = NULL; @@ -150,9 +147,6 @@ static void cleanup (void) free (runlevel); } - - free (applet); - applet = NULL; } static int syslog_decode (char *name, CODE *codetab) @@ -815,10 +809,8 @@ int main (int argc, char **argv) bool parallel; int regen = 0; + applet = cbasename (argv[0]); atexit (cleanup); - if (argv[0]) - applet = xstrdup (basename (argv[0])); - if (! applet) eerrorx ("arguments required"); -- cgit v1.2.3