aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-19 13:53:52 +0000
committerRoy Marples <roy@marples.name>2007-12-19 13:53:52 +0000
commit4022522a81852d845ec8479d229b915d293c97d6 (patch)
tree82467d52f34f90dec0dfbc4a28375f8416467aa3 /src
parentb3df16a03e169741e6e6fefa0d7d52c1482be599 (diff)
cbasename -> basename_c
Diffstat (limited to 'src')
-rw-r--r--src/checkown.c2
-rw-r--r--src/fstabinfo.c2
-rw-r--r--src/librc-daemon.c6
-rw-r--r--src/librc.c20
-rw-r--r--src/rc-depend.c2
-rw-r--r--src/rc-misc.h12
-rw-r--r--src/rc-update.c2
-rw-r--r--src/rc.c2
-rw-r--r--src/runscript.c4
-rw-r--r--src/start-stop-daemon.c2
10 files changed, 27 insertions, 27 deletions
diff --git a/src/checkown.c b/src/checkown.c
index f7dd9e6e..23ae3c44 100644
--- a/src/checkown.c
+++ b/src/checkown.c
@@ -187,7 +187,7 @@ int checkown (int argc, char **argv)
struct group *gr = NULL;
bool file = 0;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
int retval = EXIT_SUCCESS;
while ((opt = getopt_long (argc, argv, getoptstring,
diff --git a/src/fstabinfo.c b/src/fstabinfo.c
index 56957c47..5f8e469a 100644
--- a/src/fstabinfo.c
+++ b/src/fstabinfo.c
@@ -128,7 +128,7 @@ int fstabinfo (int argc, char **argv)
char *file;
bool filtered = false;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
/* Ensure that we are only quiet when explicitly told to be */
unsetenv ("EINFO_QUIET");
diff --git a/src/librc-daemon.c b/src/librc-daemon.c
index cc8e93ff..fe9509de 100644
--- a/src/librc-daemon.c
+++ b/src/librc-daemon.c
@@ -331,7 +331,7 @@ bool rc_service_daemon_set (const char *service, const char *exec,
}
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons",
- cbasename (service), (char *) NULL);
+ basename_c (service), (char *) NULL);
if (exec) {
i = strlen (exec) + 6;
@@ -421,7 +421,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,
if (! service || ! exec)
return (false);
- dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", cbasename (service),
+ dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename_c (service),
(char *) NULL);
i = strlen (exec) + 6;
@@ -473,7 +473,7 @@ bool rc_service_daemons_crashed (const char *service)
if (! service)
return (false);
- dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", cbasename (service),
+ dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename_c (service),
(char *) NULL);
if (! (dp = opendir (dirpath))) {
diff --git a/src/librc.c b/src/librc.c
index 8380ebd9..c891bdcc 100644
--- a/src/librc.c
+++ b/src/librc.c
@@ -382,7 +382,7 @@ bool rc_service_in_runlevel (const char *service, const char *runlevel)
if (! runlevel || ! service)
return (false);
- file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, cbasename (service),
+ file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename_c (service),
(char *) NULL);
retval = exists (file);
free (file);
@@ -403,7 +403,7 @@ bool rc_service_mark (const char *service, const rc_service_state_t state)
if (! init)
return (false);
- base = cbasename (service);
+ base = basename_c (service);
if (state != RC_SERVICE_STOPPED) {
if (! exists (init)) {
@@ -520,7 +520,7 @@ rc_service_state_t rc_service_state (const char *service)
for (i = 0; rc_service_state_names[i].name; i++) {
char *file = rc_strcatpaths (RC_SVCDIR, rc_service_state_names[i].name,
- cbasename (service), (char*) NULL);
+ basename_c (service), (char*) NULL);
if (exists (file)) {
if (rc_service_state_names[i].state <= 0x10)
state = rc_service_state_names[i].state;
@@ -601,7 +601,7 @@ static pid_t _exec_service (const char *service, const char *arg)
}
/* We create a fifo so that other services can wait until we complete */
- fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", cbasename (service),
+ fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename_c (service),
(char *) NULL);
if (mkfifo (fifo, 0600) != 0 && errno != EEXIST) {
@@ -666,7 +666,7 @@ bool rc_service_schedule_start (const char *service,
if (! service || ! rc_service_exists (service_to_start))
return (false);
- dir = rc_strcatpaths (RC_SVCDIR, "scheduled", cbasename (service),
+ dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename_c (service),
(char *) NULL);
if (mkdir (dir, 0755) != 0 && errno != EEXIST) {
free (dir);
@@ -674,7 +674,7 @@ bool rc_service_schedule_start (const char *service,
}
init = rc_service_resolve (service_to_start);
- file = rc_strcatpaths (dir, cbasename (service_to_start), (char *) NULL);
+ file = rc_strcatpaths (dir, basename_c (service_to_start), (char *) NULL);
retval = (exists (file) || symlink (init, file) == 0);
free (init);
free (file);
@@ -686,7 +686,7 @@ librc_hidden_def(rc_service_schedule_start)
bool rc_service_schedule_clear (const char *service)
{
- char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", cbasename (service),
+ char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename_c (service),
(char *) NULL);
bool retval;
@@ -792,7 +792,7 @@ bool rc_service_add (const char *runlevel, const char *service)
}
}
- file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, cbasename (service),
+ file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename_c (service),
(char *) NULL);
retval = (symlink (init, file) == 0);
free (init);
@@ -809,7 +809,7 @@ bool rc_service_delete (const char *runlevel, const char *service)
if (! runlevel || ! service)
return (false);
- file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, cbasename (service),
+ file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename_c (service),
(char *) NULL);
if (unlink (file) == 0)
retval = true;
@@ -841,7 +841,7 @@ librc_hidden_def(rc_services_scheduled_by)
char **rc_services_scheduled (const char *service)
{
- char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", cbasename (service),
+ char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename_c (service),
(char *) NULL);
char **list = NULL;
diff --git a/src/rc-depend.c b/src/rc-depend.c
index 9c870448..c5e9e662 100644
--- a/src/rc-depend.c
+++ b/src/rc-depend.c
@@ -96,7 +96,7 @@ int rc_depend (int argc, char **argv)
int opt;
char *token;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
while ((opt = getopt_long (argc, argv, getoptstring,
longopts, (int *) 0)) != -1)
diff --git a/src/rc-misc.h b/src/rc-misc.h
index bcc6b544..c9f699eb 100644
--- a/src/rc-misc.h
+++ b/src/rc-misc.h
@@ -119,14 +119,14 @@ bool rc_conf_yesno (const char *var);
char **env_filter (void);
char **env_config (void);
-/* cbasename never modifies the argument. As such, if there is a trailing
+/* basename_c never modifies the argument. As such, if there is a trailing
* slash then an empty string is returned. */
-static inline const char *cbasename (const char *argv0) {
- char *l = strrchr (argv0, '/');
+static inline const char *basename_c (const char *path) {
+ const char *slash = strrchr (path, '/');
- if (l)
- return (++l);
- return (argv0);
+ if (slash)
+ return (++slash);
+ return (path);
}
#endif
diff --git a/src/rc-update.c b/src/rc-update.c
index 3c366be4..eb383ba8 100644
--- a/src/rc-update.c
+++ b/src/rc-update.c
@@ -159,7 +159,7 @@ int rc_update (int argc, char **argv)
int opt;
int retval = EXIT_FAILURE;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
while ((opt = getopt_long (argc, argv, getoptstring,
longopts, (int *) 0)) != -1)
diff --git a/src/rc.c b/src/rc.c
index 7a33e64e..001e2cc9 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -809,7 +809,7 @@ int main (int argc, char **argv)
bool parallel;
int regen = 0;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
atexit (cleanup);
if (! applet)
eerrorx ("arguments required");
diff --git a/src/runscript.c b/src/runscript.c
index 6839497e..5c4a2a5e 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -519,7 +519,7 @@ static bool svc_wait (rc_depinfo_t *depinfo, const char *svc)
}
rc_strlist_free (keywords);
- fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", cbasename (svc), (char *) NULL);
+ fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename_c (svc), (char *) NULL);
ts.tv_sec = 0;
ts.tv_nsec = WAIT_INTERVAL;
@@ -1046,7 +1046,7 @@ int runscript (int argc, char **argv)
exit (EXIT_FAILURE);
}
- applet = cbasename (argv[1]);
+ applet = basename_c (argv[1]);
if (argc < 3)
usage (EXIT_FAILURE);
diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c
index ba93a29e..bf03dbec 100644
--- a/src/start-stop-daemon.c
+++ b/src/start-stop-daemon.c
@@ -572,7 +572,7 @@ int start_stop_daemon (int argc, char **argv)
char *svcname = getenv ("SVCNAME");
char *env;
- applet = cbasename (argv[0]);
+ applet = basename_c (argv[0]);
atexit (cleanup);
signal (SIGINT, handle_signal);