strip trailing newlines
This commit is contained in:
parent
b054a7251b
commit
6aab712cb4
@ -1,4 +1,4 @@
|
|||||||
# Copyright 2007-2008 Roy Marples
|
# Copyright 2007-2008 Roy Marples
|
||||||
|
|
||||||
SUBDIR= libeinfo librc rc
|
SUBDIR= libeinfo librc rc
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Written by Mike Frysinger
|
* Written by Mike Frysinger
|
||||||
* Placed in the Public Domain
|
* Placed in the Public Domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _HIDDEN_VISIBILITY_H_
|
#ifndef _HIDDEN_VISIBILITY_H_
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
This is private to us and not for user consumption
|
This is private to us and not for user consumption
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
strlist.h
|
strlist.h
|
||||||
String list macros for making char ** arrays
|
String list macros for making char ** arrays
|
||||||
Based on a previous implementation by Martin Schlemmer
|
Based on a previous implementation by Martin Schlemmer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Informational functions
|
Informational functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2008 Roy Marples
|
* Copyright 2007-2008 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ hidden_proto(ewendv)
|
|||||||
#define INDENT_MAX 40
|
#define INDENT_MAX 40
|
||||||
|
|
||||||
/* Default colours */
|
/* Default colours */
|
||||||
#define GOOD 2
|
#define GOOD 2
|
||||||
#define WARN 3
|
#define WARN 3
|
||||||
#define BAD 1
|
#define BAD 1
|
||||||
#define HILITE 6
|
#define HILITE 6
|
||||||
@ -141,7 +141,7 @@ static char *goto_column = NULL;
|
|||||||
static const char *term = NULL;
|
static const char *term = NULL;
|
||||||
static bool term_is_cons25 = false;
|
static bool term_is_cons25 = false;
|
||||||
|
|
||||||
/* Termcap buffers and pointers
|
/* Termcap buffers and pointers
|
||||||
* Static buffers suck hard, but some termcap implementations require them */
|
* Static buffers suck hard, but some termcap implementations require them */
|
||||||
#ifdef HAVE_TERMCAP
|
#ifdef HAVE_TERMCAP
|
||||||
static char termcapbuf[2048];
|
static char termcapbuf[2048];
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Finds PID for given daemon criteria
|
Finds PID for given daemon criteria
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ pid_t *rc_find_pids (const char *exec, const char *cmd,
|
|||||||
if ((argv = _KVM_GETARGV (kd, &kp[i], argc)) == NULL || ! *argv)
|
if ((argv = _KVM_GETARGV (kd, &kp[i], argc)) == NULL || ! *argv)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp (*argv, exec) != 0)
|
if (strcmp (*argv, exec) != 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
rc service dependency and ordering
|
rc service dependency and ordering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ void rc_deptree_free (rc_depinfo_t *deptree)
|
|||||||
while (dt)
|
while (dt)
|
||||||
{
|
{
|
||||||
rc_deptype_t *dtp = dt->next;
|
rc_deptype_t *dtp = dt->next;
|
||||||
free (dt->type);
|
free (dt->type);
|
||||||
rc_strlist_free (dt->services);
|
rc_strlist_free (dt->services);
|
||||||
free (dt);
|
free (dt);
|
||||||
dt = dtp;
|
dt = dtp;
|
||||||
@ -280,7 +280,7 @@ static char **get_provided (const rc_depinfo_t *deptree,
|
|||||||
const char *runlevel, int options)
|
const char *runlevel, int options)
|
||||||
{
|
{
|
||||||
rc_deptype_t *dt;
|
rc_deptype_t *dt;
|
||||||
struct lhead providers;
|
struct lhead providers;
|
||||||
char *service;
|
char *service;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ static void visit_service (const rc_depinfo_t *deptree,
|
|||||||
di = get_depinfo (deptree, service);
|
di = get_depinfo (deptree, service);
|
||||||
if ((provides = get_provided (deptree, di, runlevel, options)))
|
if ((provides = get_provided (deptree, di, runlevel, options)))
|
||||||
{
|
{
|
||||||
STRLIST_FOREACH (provides, lp, k)
|
STRLIST_FOREACH (provides, lp, k)
|
||||||
{
|
{
|
||||||
di = get_depinfo (deptree, lp);
|
di = get_depinfo (deptree, lp);
|
||||||
if (di && (strcmp (item, "ineed") == 0 ||
|
if (di && (strcmp (item, "ineed") == 0 ||
|
||||||
@ -750,7 +750,7 @@ bool rc_deptree_update (void)
|
|||||||
depends = line;
|
depends = line;
|
||||||
service = strsep (&depends, " ");
|
service = strsep (&depends, " ");
|
||||||
if (! service)
|
if (! service)
|
||||||
goto next;
|
goto next;
|
||||||
type = strsep (&depends, " ");
|
type = strsep (&depends, " ");
|
||||||
|
|
||||||
for (depinfo = deptree; depinfo; depinfo = depinfo->next)
|
for (depinfo = deptree; depinfo; depinfo = depinfo->next)
|
||||||
@ -775,7 +775,7 @@ bool rc_deptree_update (void)
|
|||||||
|
|
||||||
/* We may not have any depends */
|
/* We may not have any depends */
|
||||||
if (! type || ! depends)
|
if (! type || ! depends)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
/* Get the type */
|
/* Get the type */
|
||||||
if (strcmp (type, "config") != 0) {
|
if (strcmp (type, "config") != 0) {
|
||||||
@ -888,7 +888,7 @@ next:
|
|||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Service `%s' needs non existant service `%s'\n",
|
"Service `%s' needs non existant service `%s'\n",
|
||||||
depinfo->service, service);
|
depinfo->service, service);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Internal header file for dependency structures
|
* Internal header file for dependency structures
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
rc misc functions
|
rc misc functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ char **rc_config_load (const char *file)
|
|||||||
any prior values we may already have */
|
any prior values we may already have */
|
||||||
STRLIST_FOREACH (config, line, i) {
|
STRLIST_FOREACH (config, line, i) {
|
||||||
char *tmp = xstrdup (line);
|
char *tmp = xstrdup (line);
|
||||||
linep = tmp;
|
linep = tmp;
|
||||||
linetok = strsep (&linep, "=");
|
linetok = strsep (&linep, "=");
|
||||||
if (strcmp (linetok, entry) == 0) {
|
if (strcmp (linetok, entry) == 0) {
|
||||||
/* We have a match now - to save time we directly replace it */
|
/* We have a match now - to save time we directly replace it */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Based on a previous implementation by Martin Schlemmer
|
Based on a previous implementation by Martin Schlemmer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
librc
|
librc
|
||||||
core RC functions
|
core RC functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2008 Roy Marples
|
* Copyright 2007-2008 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ static char **ls_dir (const char *dir, int options)
|
|||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
|
||||||
if ((dp = opendir (dir)) == NULL)
|
if ((dp = opendir (dir)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
while (((d = readdir (dp)) != NULL)) {
|
while (((d = readdir (dp)) != NULL)) {
|
||||||
@ -452,7 +452,7 @@ bool rc_service_mark (const char *service, const rc_service_state_t state)
|
|||||||
state == RC_SERVICE_INACTIVE)
|
state == RC_SERVICE_INACTIVE)
|
||||||
{
|
{
|
||||||
file = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
|
file = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
|
||||||
unlink (file);
|
unlink (file);
|
||||||
free (file);
|
free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Internal header file to setup build env for files in librc.so
|
* Internal header file to setup build env for files in librc.so
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ char **rc_services_scheduled_by (const char *service);
|
|||||||
|
|
||||||
/*! Clear the list of services scheduled to be started by this service
|
/*! Clear the list of services scheduled to be started by this service
|
||||||
* @param service to clear
|
* @param service to clear
|
||||||
* @return true if no errors, otherwise false */
|
* @return true if no errors, otherwise false */
|
||||||
bool rc_service_schedule_clear (const char *service);
|
bool rc_service_schedule_clear (const char *service);
|
||||||
|
|
||||||
/*! Checks if a service in in a state
|
/*! Checks if a service in in a state
|
||||||
@ -241,7 +241,7 @@ bool rc_service_daemons_crashed (const char *service);
|
|||||||
|
|
||||||
/*! @name Dependencies
|
/*! @name Dependencies
|
||||||
* We analyse each init script and cache the resultant dependency tree.
|
* We analyse each init script and cache the resultant dependency tree.
|
||||||
* This tree can be accessed using the below functions. */
|
* This tree can be accessed using the below functions. */
|
||||||
|
|
||||||
#ifndef _IN_LIBRC
|
#ifndef _IN_LIBRC
|
||||||
/* Handles to internal structures */
|
/* Handles to internal structures */
|
||||||
@ -276,7 +276,7 @@ char **rc_deptree_depend (const rc_depinfo_t *deptree,
|
|||||||
/*! List all the services in order that the given services have
|
/*! List all the services in order that the given services have
|
||||||
* for the given types and options.
|
* for the given types and options.
|
||||||
* @param deptree to search
|
* @param deptree to search
|
||||||
* @param types to use (ineed, iuse, etc)
|
* @param types to use (ineed, iuse, etc)
|
||||||
* @param services to check
|
* @param services to check
|
||||||
* @param options to pass
|
* @param options to pass
|
||||||
* @return NULL terminated list of services in order */
|
* @return NULL terminated list of services in order */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
if necessary. It can also correct its ownership.
|
if necessary. It can also correct its ownership.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ static int do_check (char *path, uid_t uid, gid_t gid, mode_t mode, int file)
|
|||||||
eerror ("%s: open: %s", applet, strerror (errno));
|
eerror ("%s: open: %s", applet, strerror (errno));
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
close (fd);
|
close (fd);
|
||||||
} else {
|
} else {
|
||||||
einfo ("%s: creating directory", path);
|
einfo ("%s: creating directory", path);
|
||||||
if (! mode)
|
if (! mode)
|
||||||
@ -139,7 +139,7 @@ static int parse_owner (struct passwd **user, struct group **group,
|
|||||||
if (user && *u) {
|
if (user && *u) {
|
||||||
if (sscanf (u, "%d", &id) == 1)
|
if (sscanf (u, "%d", &id) == 1)
|
||||||
*user = getpwuid (id);
|
*user = getpwuid (id);
|
||||||
else
|
else
|
||||||
*user = getpwnam (u);
|
*user = getpwnam (u);
|
||||||
if (! *user)
|
if (! *user)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Gets information about /etc/fstab.
|
Gets information about /etc/fstab.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ int fstabinfo (int argc, char **argv)
|
|||||||
char *file;
|
char *file;
|
||||||
bool filtered = false;
|
bool filtered = false;
|
||||||
|
|
||||||
applet = basename_c (argv[0]);
|
applet = basename_c (argv[0]);
|
||||||
|
|
||||||
/* Ensure that we are only quiet when explicitly told to be */
|
/* Ensure that we are only quiet when explicitly told to be */
|
||||||
unsetenv ("EINFO_QUIET");
|
unsetenv ("EINFO_QUIET");
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Obtains information about mounted filesystems.
|
Obtains information about mounted filesystems.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
#if defined(__DragonFly__) || defined(__FreeBSD__)
|
#if defined(__DragonFly__) || defined(__FreeBSD__)
|
||||||
# include <sys/ucred.h>
|
# include <sys/ucred.h>
|
||||||
# include <sys/mount.h>
|
# include <sys/mount.h>
|
||||||
# define F_FLAGS f_flags
|
# define F_FLAGS f_flags
|
||||||
#elif defined(BSD)
|
#elif defined(BSD)
|
||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
# define statfs statvfs
|
# define statfs statvfs
|
||||||
@ -169,7 +169,7 @@ static int process_mount (char ***list, struct args *args,
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BSD
|
#ifdef BSD
|
||||||
|
|
||||||
/* Translate the mounted options to english
|
/* Translate the mounted options to english
|
||||||
* This is taken directly from FreeBSD mount.c */
|
* This is taken directly from FreeBSD mount.c */
|
||||||
@ -195,7 +195,7 @@ static struct opt {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef MNT_NOCLUSTERW
|
#ifdef MNT_NOCLUSTERW
|
||||||
{ MNT_NOCLUSTERW, "noclusterw" },
|
{ MNT_NOCLUSTERW, "noclusterw" },
|
||||||
#endif
|
#endif
|
||||||
#ifdef MNT_SUIDDIR
|
#ifdef MNT_SUIDDIR
|
||||||
{ MNT_SUIDDIR, "suiddir" },
|
{ MNT_SUIDDIR, "suiddir" },
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
rc service dependency and ordering
|
rc service dependency and ordering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ int rc_depend (int argc, char **argv)
|
|||||||
int opt;
|
int opt;
|
||||||
char *token;
|
char *token;
|
||||||
|
|
||||||
applet = basename_c (argv[0]);
|
applet = basename_c (argv[0]);
|
||||||
|
|
||||||
while ((opt = getopt_long (argc, argv, getoptstring,
|
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
them to a buffer and/or files.
|
them to a buffer and/or files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void rc_logger_open (const char *level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free (buffer);
|
free (buffer);
|
||||||
if (logbuf) {
|
if (logbuf) {
|
||||||
if ((log = fopen (LOGFILE, "a"))) {
|
if ((log = fopen (LOGFILE, "a"))) {
|
||||||
write_time (log, "started");
|
write_time (log, "started");
|
||||||
write_log (fileno (log), logbuf, logbuf_len);
|
write_log (fileno (log), logbuf, logbuf_len);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
rc misc functions
|
rc misc functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
librc-plugin.c
|
librc-plugin.c
|
||||||
Simple plugin handler
|
Simple plugin handler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
librc-plugin.h
|
librc-plugin.h
|
||||||
Private instructions to use plugins
|
Private instructions to use plugins
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Display the status of the services in runlevels
|
Display the status of the services in runlevels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
Manage init scripts and runlevels
|
Manage init scripts and runlevels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ static int delete (const char *runlevel, const char *service)
|
|||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
eerror ("%s: service `%s' is not in the runlevel `%s'",
|
eerror ("%s: service `%s' is not in the runlevel `%s'",
|
||||||
applet, service, runlevel);
|
applet, service, runlevel);
|
||||||
else
|
else
|
||||||
eerror ("%s: failed to remove service `%s' from runlevel `%s': %s",
|
eerror ("%s: failed to remove service `%s' from runlevel `%s': %s",
|
||||||
applet, service, runlevel, strerror (errno));
|
applet, service, runlevel, strerror (errno));
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ int rc_update (int argc, char **argv)
|
|||||||
int opt;
|
int opt;
|
||||||
int retval = EXIT_FAILURE;
|
int retval = EXIT_FAILURE;
|
||||||
|
|
||||||
applet = basename_c (argv[0]);
|
applet = basename_c (argv[0]);
|
||||||
|
|
||||||
while ((opt = getopt_long (argc, argv, getoptstring,
|
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
|
14
src/rc/rc.c
14
src/rc/rc.c
@ -8,7 +8,7 @@
|
|||||||
einfo family of informational functions.
|
einfo family of informational functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2008 Roy Marples
|
* Copyright 2007-2008 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ static int do_e (int argc, char **argv)
|
|||||||
message = xmalloc (l);
|
message = xmalloc (l);
|
||||||
p = message;
|
p = message;
|
||||||
|
|
||||||
for (i = 0; i < argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
memcpy (p, argv[i], strlen (argv[i]));
|
memcpy (p, argv[i], strlen (argv[i]));
|
||||||
@ -264,11 +264,11 @@ static int do_e (int argc, char **argv)
|
|||||||
if (! message)
|
if (! message)
|
||||||
message = xstrdup ("");
|
message = xstrdup ("");
|
||||||
|
|
||||||
if (strcmp (applet, "einfo") == 0)
|
if (strcmp (applet, "einfo") == 0)
|
||||||
einfo ("%s", message);
|
einfo ("%s", message);
|
||||||
else if (strcmp (applet, "einfon") == 0)
|
else if (strcmp (applet, "einfon") == 0)
|
||||||
einfon ("%s", message);
|
einfon ("%s", message);
|
||||||
else if (strcmp (applet, "ewarn") == 0)
|
else if (strcmp (applet, "ewarn") == 0)
|
||||||
ewarn ("%s", message);
|
ewarn ("%s", message);
|
||||||
else if (strcmp (applet, "ewarnn") == 0)
|
else if (strcmp (applet, "ewarnn") == 0)
|
||||||
ewarnn ("%s", message);
|
ewarnn ("%s", message);
|
||||||
@ -286,11 +286,11 @@ static int do_e (int argc, char **argv)
|
|||||||
ewend (retval, "%s", message);
|
ewend (retval, "%s", message);
|
||||||
else if (strcmp (applet, "esyslog") == 0)
|
else if (strcmp (applet, "esyslog") == 0)
|
||||||
elog (level, "%s", message);
|
elog (level, "%s", message);
|
||||||
else if (strcmp (applet, "veinfo") == 0)
|
else if (strcmp (applet, "veinfo") == 0)
|
||||||
einfov ("%s", message);
|
einfov ("%s", message);
|
||||||
else if (strcmp (applet, "veinfon") == 0)
|
else if (strcmp (applet, "veinfon") == 0)
|
||||||
einfovn ("%s", message);
|
einfovn ("%s", message);
|
||||||
else if (strcmp (applet, "vewarn") == 0)
|
else if (strcmp (applet, "vewarn") == 0)
|
||||||
ewarnv ("%s", message);
|
ewarnv ("%s", message);
|
||||||
else if (strcmp (applet, "vewarnn") == 0)
|
else if (strcmp (applet, "vewarnn") == 0)
|
||||||
ewarnvn ("%s", message);
|
ewarnvn ("%s", message);
|
||||||
@ -494,7 +494,7 @@ static char *proc_getent (const char *ent)
|
|||||||
|
|
||||||
if ((proc = rc_getline (fp)) &&
|
if ((proc = rc_getline (fp)) &&
|
||||||
(p = strstr (proc, ent)))
|
(p = strstr (proc, ent)))
|
||||||
{
|
{
|
||||||
i = p - proc;
|
i = p - proc;
|
||||||
if (i == '\0' || proc[i - 1] == ' ') {
|
if (i == '\0' || proc[i - 1] == ' ') {
|
||||||
p += strlen (ent);
|
p += strlen (ent);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Handle launching of init scripts.
|
* Handle launching of init scripts.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ static void handle_signal (int sig)
|
|||||||
if (! signame[0])
|
if (! signame[0])
|
||||||
snprintf (signame, sizeof (signame), "SIGQUIT");
|
snprintf (signame, sizeof (signame), "SIGQUIT");
|
||||||
/* Send the signal to our children too */
|
/* Send the signal to our children too */
|
||||||
if (service_pid > 0)
|
if (service_pid > 0)
|
||||||
kill (service_pid, sig);
|
kill (service_pid, sig);
|
||||||
eerrorx ("%s: caught %s, aborting", applet, signame);
|
eerrorx ("%s: caught %s, aborting", applet, signame);
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ static bool svc_wait (rc_depinfo_t *depinfo, const char *svc)
|
|||||||
return (false);
|
return (false);
|
||||||
|
|
||||||
/* Some services don't have a timeout, like checkroot and checkfs */
|
/* Some services don't have a timeout, like checkroot and checkfs */
|
||||||
keywords = rc_deptree_depend (depinfo, svc, "keywords");
|
keywords = rc_deptree_depend (depinfo, svc, "keywords");
|
||||||
STRLIST_FOREACH (keywords, s, i) {
|
STRLIST_FOREACH (keywords, s, i) {
|
||||||
if (strcmp (s, "notimeout") == 0) {
|
if (strcmp (s, "notimeout") == 0) {
|
||||||
forever = true;
|
forever = true;
|
||||||
@ -765,8 +765,8 @@ static void svc_start (bool deps)
|
|||||||
STRLIST_FOREACH (tmplist, svc, i) {
|
STRLIST_FOREACH (tmplist, svc, i) {
|
||||||
rc_service_schedule_start (svc, service);
|
rc_service_schedule_start (svc, service);
|
||||||
rc_strlist_free (providelist);
|
rc_strlist_free (providelist);
|
||||||
providelist = rc_deptree_depend (deptree, "iprovide", svc);
|
providelist = rc_deptree_depend (deptree, "iprovide", svc);
|
||||||
STRLIST_FOREACH (providelist, svc2, j)
|
STRLIST_FOREACH (providelist, svc2, j)
|
||||||
rc_service_schedule_start (svc2, service);
|
rc_service_schedule_start (svc2, service);
|
||||||
|
|
||||||
len += strlen (svc) + 2;
|
len += strlen (svc) + 2;
|
||||||
@ -856,7 +856,7 @@ static void svc_stop (bool deps)
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
if (rc_yesno (getenv ("IN_HOTPLUG")) || in_background)
|
if (rc_yesno (getenv ("IN_HOTPLUG")) || in_background)
|
||||||
if (! (state & RC_SERVICE_STARTED) &&
|
if (! (state & RC_SERVICE_STARTED) &&
|
||||||
! (state & RC_SERVICE_INACTIVE))
|
! (state & RC_SERVICE_INACTIVE))
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
@ -900,12 +900,12 @@ static void svc_stop (bool deps)
|
|||||||
rc_strlist_reverse (services);
|
rc_strlist_reverse (services);
|
||||||
STRLIST_FOREACH (services, svc, i) {
|
STRLIST_FOREACH (services, svc, i) {
|
||||||
rc_service_state_t svcs = rc_service_state (svc);
|
rc_service_state_t svcs = rc_service_state (svc);
|
||||||
if (svcs & RC_SERVICE_STARTED ||
|
if (svcs & RC_SERVICE_STARTED ||
|
||||||
svcs & RC_SERVICE_INACTIVE)
|
svcs & RC_SERVICE_INACTIVE)
|
||||||
{
|
{
|
||||||
svc_wait (deptree, svc);
|
svc_wait (deptree, svc);
|
||||||
svcs = rc_service_state (svc);
|
svcs = rc_service_state (svc);
|
||||||
if (svcs & RC_SERVICE_STARTED ||
|
if (svcs & RC_SERVICE_STARTED ||
|
||||||
svcs & RC_SERVICE_INACTIVE)
|
svcs & RC_SERVICE_INACTIVE)
|
||||||
{
|
{
|
||||||
pid_t pid = rc_service_stop (svc);
|
pid_t pid = rc_service_stop (svc);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
system so we can monitor daemons a little.
|
system so we can monitor daemons a little.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2007 Roy Marples
|
* Copyright 2007 Roy Marples
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ static int do_stop (const char *exec, const char *cmd,
|
|||||||
const char *pidfile, uid_t uid,int sig,
|
const char *pidfile, uid_t uid,int sig,
|
||||||
bool quiet, bool verbose, bool test)
|
bool quiet, bool verbose, bool test)
|
||||||
{
|
{
|
||||||
pid_t *pids;
|
pid_t *pids;
|
||||||
bool killed;
|
bool killed;
|
||||||
int nkilled = 0;
|
int nkilled = 0;
|
||||||
pid_t pid = 0;
|
pid_t pid = 0;
|
||||||
@ -929,7 +929,7 @@ int start_stop_daemon (int argc, char **argv)
|
|||||||
*np++ = ':';
|
*np++ = ':';
|
||||||
memcpy (np, token, sizeof (char) * strlen (token));
|
memcpy (np, token, sizeof (char) * strlen (token));
|
||||||
np += t;
|
np += t;
|
||||||
*np = '\0';
|
*np = '\0';
|
||||||
} else {
|
} else {
|
||||||
l = strlen ("PATH=") + t + 1;
|
l = strlen ("PATH=") + t + 1;
|
||||||
newpath = xmalloc (sizeof (char) * l);
|
newpath = xmalloc (sizeof (char) * l);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user