aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-03 14:22:45 +0000
committerRoy Marples <roy@marples.name>2007-10-03 14:22:45 +0000
commit4b7efeafa6a8db4e137dc9e34fce20590cb447c2 (patch)
treec81c9c908080c777068c6912fe9f4fc2c6b7801d
parent563c6f46c0439eeb3fcc90105264ae1043b7298f (diff)
rc_service_option_set -> rc_service_value_set, rc_service_option_get -> rc_service_value_get
-rw-r--r--src/librc.c14
-rw-r--r--src/librc.h4
-rw-r--r--src/rc.c4
-rw-r--r--src/rc.h56
4 files changed, 40 insertions, 38 deletions
diff --git a/src/librc.c b/src/librc.c
index fd069abc..c93c1ee9 100644
--- a/src/librc.c
+++ b/src/librc.c
@@ -131,7 +131,7 @@ bool rc_runlevel_exists (const char *runlevel)
}
librc_hidden_def(rc_runlevel_exists)
-/* Resolve a service name to it's full path */
+ /* Resolve a service name to it's full path */
char *rc_service_resolve (const char *service)
{
char buffer[PATH_MAX];
@@ -441,7 +441,7 @@ rc_service_state_t rc_service_state (const char *service)
}
librc_hidden_def(rc_service_state)
-char *rc_service_option_get (const char *service, const char *option)
+char *rc_service_value_get (const char *service, const char *option)
{
FILE *fp;
char buffer[RC_LINEBUFFER];
@@ -459,10 +459,10 @@ char *rc_service_option_get (const char *service, const char *option)
return (value);
}
-librc_hidden_def(rc_service_option_get)
+librc_hidden_def(rc_service_value_get)
-bool rc_service_option_set (const char *service, const char *option,
- const char *value)
+bool rc_service_value_set (const char *service, const char *option,
+ const char *value)
{
FILE *fp;
char *path = rc_strcatpaths (RC_SVCDIR, "options", service, (char *) NULL);
@@ -488,7 +488,7 @@ bool rc_service_option_set (const char *service, const char *option,
free (file);
return (retval);
}
-librc_hidden_def(rc_service_option_set)
+librc_hidden_def(rc_service_value_set)
static pid_t _exec_service (const char *service, const char *arg)
{
@@ -528,7 +528,7 @@ static pid_t _exec_service (const char *service, const char *arg)
if (pid == -1)
fprintf (stderr, "vfork: %s\n", strerror (errno));
-
+
return (pid);
}
diff --git a/src/librc.h b/src/librc.h
index bba06991..e71392a1 100644
--- a/src/librc.h
+++ b/src/librc.h
@@ -87,8 +87,6 @@ librc_hidden_proto(rc_service_description)
librc_hidden_proto(rc_service_exists)
librc_hidden_proto(rc_service_in_runlevel)
librc_hidden_proto(rc_service_mark)
-librc_hidden_proto(rc_service_option_get)
-librc_hidden_proto(rc_service_option_set)
librc_hidden_proto(rc_service_options)
librc_hidden_proto(rc_service_plugable)
librc_hidden_proto(rc_service_resolve)
@@ -103,6 +101,8 @@ librc_hidden_proto(rc_services_scheduled)
librc_hidden_proto(rc_services_scheduled_by)
librc_hidden_proto(rc_service_started_daemon)
librc_hidden_proto(rc_service_state)
+librc_hidden_proto(rc_service_value_get)
+librc_hidden_proto(rc_service_value_set)
librc_hidden_proto(rc_strcatpaths)
librc_hidden_proto(rc_strlist_add)
librc_hidden_proto(rc_strlist_addu)
diff --git a/src/rc.c b/src/rc.c
index ae08cfa8..76335df8 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -362,14 +362,14 @@ static int do_options (int argc, char **argv)
eerrorx ("%s: no option specified", applet);
if (strcmp (applet, "get_options") == 0) {
- char *option = rc_service_option_get (service, argv[0]);
+ char *option = rc_service_value_get (service, argv[0]);
if (option) {
printf ("%s", option);
free (option);
ok = true;
}
} else if (strcmp (applet, "save_options") == 0)
- ok = rc_service_option_set (service, argv[0], argv[1]);
+ ok = rc_service_value_set (service, argv[0], argv[1]);
else
eerrorx ("%s: unknown applet", applet);
diff --git a/src/rc.h b/src/rc.h
index a32ad811..11b7e582 100644
--- a/src/rc.h
+++ b/src/rc.h
@@ -87,26 +87,25 @@ bool rc_service_mark (const char *service, rc_service_state_t state);
* @return NULL terminated string list of options */
char **rc_service_options (const char *service);
+/*! Return a saved value for a service
+ * @param service to check
+ * @param option to load
+ * @return saved value */
+char *rc_service_value_get (const char *service, const char *option);
+
+/*! Save a persistent value for a service
+ * @param service to save for
+ * @param option to save
+ * @param value of the option
+ * @return true if saved, otherwise false */
+bool rc_service_value_set (const char *service, const char *option,
+ const char *value);
+
/*! Resolves a service name to its full path.
* @param service to check
* @return pointer to full path of service */
char *rc_service_resolve (const char *service);
-/*! Checks if a service in in a state
- * @param service to check
- * @return state of the service */
-rc_service_state_t rc_service_state (const char *service);
-
-/*! Start a service
- * @param service to start
- * @return pid of the service starting process */
-pid_t rc_service_start (const char *service);
-
-/*! Stop a service
- * @param service to stop
- * @return pid of service stopping process */
-pid_t rc_service_stop (const char *service);
-
/*! Schedule a service to be started when another service starts
* @param service that starts the scheduled service when started
* @param service_to_start service that will be started */
@@ -122,23 +121,26 @@ char **rc_services_scheduled_by (const char *service);
* @param service to clear */
void rc_service_schedule_clear (const char *service);
+/*! Checks if a service in in a state
+ * @param service to check
+ * @return state of the service */
+rc_service_state_t rc_service_state (const char *service);
+
+/*! Start a service
+ * @param service to start
+ * @return pid of the service starting process */
+pid_t rc_service_start (const char *service);
+
+/*! Stop a service
+ * @param service to stop
+ * @return pid of service stopping process */
+pid_t rc_service_stop (const char *service);
+
/*! Wait for a service to finish
* @param service to wait for
* @return true if service finished before timeout, otherwise false */
bool rc_service_wait (const char *service);
-/*! Return a saved value for a service
- * @param service to check
- * @param option to load
- * @return saved value */
-char *rc_service_option_get (const char *service, const char *option);
-/*! Save a persistent value for a service
- * @param service to save for
- * @param option to save
- * @param value of the option
- * @return true if saved, otherwise false */
-bool rc_service_option_set (const char *service, const char *option,
- const char *value);
/*! Save the arguments to find a running daemon
* @param service to save arguments for
* @param exec that we started