strip trailing newlines

This commit is contained in:
Mike Frysinger 2008-01-14 05:05:22 +00:00
parent b054a7251b
commit 6aab712cb4
31 changed files with 76 additions and 76 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2007-2008 Roy Marples
# Copyright 2007-2008 Roy Marples
SUBDIR= libeinfo librc rc

View File

@ -1,6 +1,6 @@
/*
/*
* Written by Mike Frysinger
* Placed in the Public Domain
* Placed in the Public Domain
*/
#ifndef _HIDDEN_VISIBILITY_H_

View File

@ -3,7 +3,7 @@
This is private to us and not for user consumption
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,10 +1,10 @@
/*
strlist.h
strlist.h
String list macros for making char ** arrays
Based on a previous implementation by Martin Schlemmer
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -3,7 +3,7 @@
Informational functions
*/
/*
/*
* Copyright 2007-2008 Roy Marples
* All rights reserved
@ -91,7 +91,7 @@ hidden_proto(ewendv)
#define INDENT_MAX 40
/* Default colours */
#define GOOD 2
#define GOOD 2
#define WARN 3
#define BAD 1
#define HILITE 6
@ -141,7 +141,7 @@ static char *goto_column = NULL;
static const char *term = NULL;
static bool term_is_cons25 = false;
/* Termcap buffers and pointers
/* Termcap buffers and pointers
* Static buffers suck hard, but some termcap implementations require them */
#ifdef HAVE_TERMCAP
static char termcapbuf[2048];

View File

@ -3,7 +3,7 @@
Finds PID for given daemon criteria
*/
/*
/*
* Copyright 2007 Roy Marples
* 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)
continue;
if (strcmp (*argv, exec) != 0)
if (strcmp (*argv, exec) != 0)
continue;
}

View File

@ -3,7 +3,7 @@
rc service dependency and ordering
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -77,7 +77,7 @@ void rc_deptree_free (rc_depinfo_t *deptree)
while (dt)
{
rc_deptype_t *dtp = dt->next;
free (dt->type);
free (dt->type);
rc_strlist_free (dt->services);
free (dt);
dt = dtp;
@ -280,7 +280,7 @@ static char **get_provided (const rc_depinfo_t *deptree,
const char *runlevel, int options)
{
rc_deptype_t *dt;
struct lhead providers;
struct lhead providers;
char *service;
int i;
@ -424,7 +424,7 @@ static void visit_service (const rc_depinfo_t *deptree,
di = get_depinfo (deptree, service);
if ((provides = get_provided (deptree, di, runlevel, options)))
{
STRLIST_FOREACH (provides, lp, k)
STRLIST_FOREACH (provides, lp, k)
{
di = get_depinfo (deptree, lp);
if (di && (strcmp (item, "ineed") == 0 ||
@ -750,7 +750,7 @@ bool rc_deptree_update (void)
depends = line;
service = strsep (&depends, " ");
if (! service)
goto next;
goto next;
type = strsep (&depends, " ");
for (depinfo = deptree; depinfo; depinfo = depinfo->next)
@ -775,7 +775,7 @@ bool rc_deptree_update (void)
/* We may not have any depends */
if (! type || ! depends)
goto next;
goto next;
/* Get the type */
if (strcmp (type, "config") != 0) {
@ -888,7 +888,7 @@ next:
fprintf (stderr,
"Service `%s' needs non existant service `%s'\n",
depinfo->service, service);
}
}
continue;
}

View File

@ -3,7 +3,7 @@
* Internal header file for dependency structures
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -3,7 +3,7 @@
rc misc functions
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -218,7 +218,7 @@ char **rc_config_load (const char *file)
any prior values we may already have */
STRLIST_FOREACH (config, line, i) {
char *tmp = xstrdup (line);
linep = tmp;
linep = tmp;
linetok = strsep (&linep, "=");
if (strcmp (linetok, entry) == 0) {
/* We have a match now - to save time we directly replace it */

View File

@ -5,7 +5,7 @@
Based on a previous implementation by Martin Schlemmer
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,9 +1,9 @@
/*
librc
librc
core RC functions
*/
/*
/*
* Copyright 2007-2008 Roy Marples
* All rights reserved
@ -71,7 +71,7 @@ static char **ls_dir (const char *dir, int options)
char **list = NULL;
struct stat buf;
if ((dp = opendir (dir)) == NULL)
if ((dp = opendir (dir)) == NULL)
return (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)
{
file = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
unlink (file);
unlink (file);
free (file);
}

View File

@ -3,7 +3,7 @@
* Internal header file to setup build env for files in librc.so
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* 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
* @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);
/*! Checks if a service in in a state
@ -241,7 +241,7 @@ bool rc_service_daemons_crashed (const char *service);
/*! @name Dependencies
* 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
/* 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
* for the given types and options.
* @param deptree to search
* @param types to use (ineed, iuse, etc)
* @param types to use (ineed, iuse, etc)
* @param services to check
* @param options to pass
* @return NULL terminated list of services in order */

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -4,7 +4,7 @@
if necessary. It can also correct its ownership.
*/
/*
/*
* Copyright 2007 Roy Marples
* 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));
return (-1);
}
close (fd);
close (fd);
} else {
einfo ("%s: creating directory", path);
if (! mode)
@ -139,7 +139,7 @@ static int parse_owner (struct passwd **user, struct group **group,
if (user && *u) {
if (sscanf (u, "%d", &id) == 1)
*user = getpwuid (id);
else
else
*user = getpwnam (u);
if (! *user)
retval = -1;

View File

@ -3,7 +3,7 @@
Gets information about /etc/fstab.
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -128,7 +128,7 @@ int fstabinfo (int argc, char **argv)
char *file;
bool filtered = false;
applet = basename_c (argv[0]);
applet = basename_c (argv[0]);
/* Ensure that we are only quiet when explicitly told to be */
unsetenv ("EINFO_QUIET");

View File

@ -3,7 +3,7 @@
Obtains information about mounted filesystems.
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -35,7 +35,7 @@
#if defined(__DragonFly__) || defined(__FreeBSD__)
# include <sys/ucred.h>
# include <sys/mount.h>
# define F_FLAGS f_flags
# define F_FLAGS f_flags
#elif defined(BSD)
# include <sys/statvfs.h>
# define statfs statvfs
@ -169,7 +169,7 @@ static int process_mount (char ***list, struct args *args,
return (-1);
}
#ifdef BSD
#ifdef BSD
/* Translate the mounted options to english
* This is taken directly from FreeBSD mount.c */
@ -195,7 +195,7 @@ static struct opt {
#endif
#ifdef MNT_NOCLUSTERW
{ MNT_NOCLUSTERW, "noclusterw" },
#endif
#endif
#ifdef MNT_SUIDDIR
{ MNT_SUIDDIR, "suiddir" },
#endif

View File

@ -3,7 +3,7 @@
rc service dependency and ordering
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -96,7 +96,7 @@ int rc_depend (int argc, char **argv)
int opt;
char *token;
applet = basename_c (argv[0]);
applet = basename_c (argv[0]);
while ((opt = getopt_long (argc, argv, getoptstring,
longopts, (int *) 0)) != -1)

View File

@ -4,7 +4,7 @@
them to a buffer and/or files.
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -227,7 +227,7 @@ void rc_logger_open (const char *level)
}
}
free (buffer);
if (logbuf) {
if (logbuf) {
if ((log = fopen (LOGFILE, "a"))) {
write_time (log, "started");
write_log (fileno (log), logbuf, logbuf_len);

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -3,7 +3,7 @@
rc misc functions
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,9 +1,9 @@
/*
librc-plugin.c
librc-plugin.c
Simple plugin handler
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -1,9 +1,9 @@
/*
librc-plugin.h
librc-plugin.h
Private instructions to use plugins
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -3,7 +3,7 @@
Display the status of the services in runlevels
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved

View File

@ -3,7 +3,7 @@
Manage init scripts and runlevels
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -84,7 +84,7 @@ static int delete (const char *runlevel, const char *service)
if (errno == ENOENT)
eerror ("%s: service `%s' is not in the runlevel `%s'",
applet, service, runlevel);
else
else
eerror ("%s: failed to remove service `%s' from runlevel `%s': %s",
applet, service, runlevel, strerror (errno));
@ -159,7 +159,7 @@ int rc_update (int argc, char **argv)
int opt;
int retval = EXIT_FAILURE;
applet = basename_c (argv[0]);
applet = basename_c (argv[0]);
while ((opt = getopt_long (argc, argv, getoptstring,
longopts, (int *) 0)) != -1)

View File

@ -8,7 +8,7 @@
einfo family of informational functions.
*/
/*
/*
* Copyright 2007-2008 Roy Marples
* All rights reserved
@ -252,7 +252,7 @@ static int do_e (int argc, char **argv)
message = xmalloc (l);
p = message;
for (i = 0; i < argc; i++) {
for (i = 0; i < argc; i++) {
if (i > 0)
*p++ = ' ';
memcpy (p, argv[i], strlen (argv[i]));
@ -264,11 +264,11 @@ static int do_e (int argc, char **argv)
if (! message)
message = xstrdup ("");
if (strcmp (applet, "einfo") == 0)
if (strcmp (applet, "einfo") == 0)
einfo ("%s", message);
else if (strcmp (applet, "einfon") == 0)
einfon ("%s", message);
else if (strcmp (applet, "ewarn") == 0)
else if (strcmp (applet, "ewarn") == 0)
ewarn ("%s", message);
else if (strcmp (applet, "ewarnn") == 0)
ewarnn ("%s", message);
@ -286,11 +286,11 @@ static int do_e (int argc, char **argv)
ewend (retval, "%s", message);
else if (strcmp (applet, "esyslog") == 0)
elog (level, "%s", message);
else if (strcmp (applet, "veinfo") == 0)
else if (strcmp (applet, "veinfo") == 0)
einfov ("%s", message);
else if (strcmp (applet, "veinfon") == 0)
einfovn ("%s", message);
else if (strcmp (applet, "vewarn") == 0)
else if (strcmp (applet, "vewarn") == 0)
ewarnv ("%s", message);
else if (strcmp (applet, "vewarnn") == 0)
ewarnvn ("%s", message);
@ -494,7 +494,7 @@ static char *proc_getent (const char *ent)
if ((proc = rc_getline (fp)) &&
(p = strstr (proc, ent)))
{
{
i = p - proc;
if (i == '\0' || proc[i - 1] == ' ') {
p += strlen (ent);

View File

@ -3,7 +3,7 @@
* Handle launching of init scripts.
*/
/*
/*
* Copyright 2007 Roy Marples
* All rights reserved
@ -181,7 +181,7 @@ static void handle_signal (int sig)
if (! signame[0])
snprintf (signame, sizeof (signame), "SIGQUIT");
/* Send the signal to our children too */
if (service_pid > 0)
if (service_pid > 0)
kill (service_pid, sig);
eerrorx ("%s: caught %s, aborting", applet, signame);
@ -511,7 +511,7 @@ static bool svc_wait (rc_depinfo_t *depinfo, const char *svc)
return (false);
/* 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) {
if (strcmp (s, "notimeout") == 0) {
forever = true;
@ -765,8 +765,8 @@ static void svc_start (bool deps)
STRLIST_FOREACH (tmplist, svc, i) {
rc_service_schedule_start (svc, service);
rc_strlist_free (providelist);
providelist = rc_deptree_depend (deptree, "iprovide", svc);
STRLIST_FOREACH (providelist, svc2, j)
providelist = rc_deptree_depend (deptree, "iprovide", svc);
STRLIST_FOREACH (providelist, svc2, j)
rc_service_schedule_start (svc2, service);
len += strlen (svc) + 2;
@ -856,7 +856,7 @@ static void svc_stop (bool deps)
exit (EXIT_FAILURE);
if (rc_yesno (getenv ("IN_HOTPLUG")) || in_background)
if (! (state & RC_SERVICE_STARTED) &&
if (! (state & RC_SERVICE_STARTED) &&
! (state & RC_SERVICE_INACTIVE))
exit (EXIT_FAILURE);
@ -900,12 +900,12 @@ static void svc_stop (bool deps)
rc_strlist_reverse (services);
STRLIST_FOREACH (services, svc, i) {
rc_service_state_t svcs = rc_service_state (svc);
if (svcs & RC_SERVICE_STARTED ||
if (svcs & RC_SERVICE_STARTED ||
svcs & RC_SERVICE_INACTIVE)
{
svc_wait (deptree, svc);
svcs = rc_service_state (svc);
if (svcs & RC_SERVICE_STARTED ||
if (svcs & RC_SERVICE_STARTED ||
svcs & RC_SERVICE_INACTIVE)
{
pid_t pid = rc_service_stop (svc);

View File

@ -7,7 +7,7 @@
system so we can monitor daemons a little.
*/
/*
/*
* Copyright 2007 Roy Marples
* 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,
bool quiet, bool verbose, bool test)
{
pid_t *pids;
pid_t *pids;
bool killed;
int nkilled = 0;
pid_t pid = 0;
@ -929,7 +929,7 @@ int start_stop_daemon (int argc, char **argv)
*np++ = ':';
memcpy (np, token, sizeof (char) * strlen (token));
np += t;
*np = '\0';
*np = '\0';
} else {
l = strlen ("PATH=") + t + 1;
newpath = xmalloc (sizeof (char) * l);