diff options
| author | Roy Marples <roy@marples.name> | 2007-12-19 12:46:08 +0000 | 
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2007-12-19 12:46:08 +0000 | 
| commit | cd45e5435762d8c6cd13287df7df16b97755176e (patch) | |
| tree | ef0c7fb0a96e103e2a0dd79ee8c0f47f62ae7174 /src/rc.c | |
| parent | 2f7218c9849e667ba20d76e4dfe46b4bb195063a (diff) | |
| download | openrc-cd45e5435762d8c6cd13287df7df16b97755176e.tar.xz | |
Introduce cbasename so we don't have to strdup(basename) and free all the time.
Diffstat (limited to 'src/rc.c')
| -rw-r--r-- | src/rc.c | 12 | 
1 files changed, 2 insertions, 10 deletions
| @@ -36,8 +36,6 @@  const char copyright[] = "Copyright (c) 2007 Roy Marples"; -#define APPLET "rc" -  #define SYSLOG_NAMES  #include <sys/types.h> @@ -49,7 +47,6 @@ const char copyright[] = "Copyright (c) 2007 Roy Marples";  #include <dirent.h>  #include <ctype.h>  #include <getopt.h> -#include <libgen.h>  #include <limits.h>  #include <stdbool.h>  #include <stdio.h> @@ -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"); | 
