From 6aab712cb4220c5a8471ba581c06676af19fae07 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 14 Jan 2008 05:05:22 +0000 Subject: [PATCH] strip trailing newlines --- src/Makefile | 2 +- src/includes/hidden-visibility.h | 4 ++-- src/includes/rc-misc.h | 2 +- src/includes/strlist.h | 4 ++-- src/libeinfo/einfo.h | 2 +- src/libeinfo/libeinfo.c | 6 +++--- src/librc/librc-daemon.c | 4 ++-- src/librc/librc-depend.c | 14 +++++++------- src/librc/librc-depend.h | 2 +- src/librc/librc-misc.c | 4 ++-- src/librc/librc-strlist.c | 2 +- src/librc/librc.c | 8 ++++---- src/librc/librc.h | 2 +- src/librc/rc.h | 8 ++++---- src/rc/_usage.c | 2 +- src/rc/_usage.h | 2 +- src/rc/builtins.h | 2 +- src/rc/checkpath.c | 6 +++--- src/rc/fstabinfo.c | 4 ++-- src/rc/mountinfo.c | 8 ++++---- src/rc/rc-depend.c | 4 ++-- src/rc/rc-logger.c | 4 ++-- src/rc/rc-logger.h | 2 +- src/rc/rc-misc.c | 2 +- src/rc/rc-plugin.c | 4 ++-- src/rc/rc-plugin.h | 4 ++-- src/rc/rc-status.c | 2 +- src/rc/rc-update.c | 6 +++--- src/rc/rc.c | 14 +++++++------- src/rc/runscript.c | 16 ++++++++-------- src/rc/start-stop-daemon.c | 6 +++--- 31 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/Makefile b/src/Makefile index 36a3b8e1..6cc6872d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -# Copyright 2007-2008 Roy Marples +# Copyright 2007-2008 Roy Marples SUBDIR= libeinfo librc rc diff --git a/src/includes/hidden-visibility.h b/src/includes/hidden-visibility.h index bc7e338a..9d397c23 100644 --- a/src/includes/hidden-visibility.h +++ b/src/includes/hidden-visibility.h @@ -1,6 +1,6 @@ -/* +/* * Written by Mike Frysinger - * Placed in the Public Domain + * Placed in the Public Domain */ #ifndef _HIDDEN_VISIBILITY_H_ diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h index 8052dff3..68ebc803 100644 --- a/src/includes/rc-misc.h +++ b/src/includes/rc-misc.h @@ -3,7 +3,7 @@ This is private to us and not for user consumption */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/includes/strlist.h b/src/includes/strlist.h index 3abe44ff..0669e22f 100644 --- a/src/includes/strlist.h +++ b/src/includes/strlist.h @@ -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 diff --git a/src/libeinfo/einfo.h b/src/libeinfo/einfo.h index 2720e458..ca2487b4 100644 --- a/src/libeinfo/einfo.h +++ b/src/libeinfo/einfo.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c index 50d84c60..8f1b73f6 100644 --- a/src/libeinfo/libeinfo.c +++ b/src/libeinfo/libeinfo.c @@ -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]; diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c index 28c5adcf..e5fb2d53 100644 --- a/src/librc/librc-daemon.c +++ b/src/librc/librc-daemon.c @@ -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; } diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index cfc887ea..b472c8a1 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -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; } diff --git a/src/librc/librc-depend.h b/src/librc/librc-depend.h index 238f70d1..1dfed166 100644 --- a/src/librc/librc-depend.h +++ b/src/librc/librc-depend.h @@ -3,7 +3,7 @@ * Internal header file for dependency structures */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c index da52f980..7b3c3dfa 100644 --- a/src/librc/librc-misc.c +++ b/src/librc/librc-misc.c @@ -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 */ diff --git a/src/librc/librc-strlist.c b/src/librc/librc-strlist.c index ed3f10a6..b7dad736 100644 --- a/src/librc/librc-strlist.c +++ b/src/librc/librc-strlist.c @@ -5,7 +5,7 @@ Based on a previous implementation by Martin Schlemmer */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/librc/librc.c b/src/librc/librc.c index 436aa47f..0e35c8b8 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -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); } diff --git a/src/librc/librc.h b/src/librc/librc.h index 5907e62e..6b1e0314 100644 --- a/src/librc/librc.h +++ b/src/librc/librc.h @@ -3,7 +3,7 @@ * Internal header file to setup build env for files in librc.so */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/librc/rc.h b/src/librc/rc.h index 465e5153..95247785 100644 --- a/src/librc/rc.h +++ b/src/librc/rc.h @@ -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 */ diff --git a/src/rc/_usage.c b/src/rc/_usage.c index 32b4bbc1..b6e2bebb 100644 --- a/src/rc/_usage.c +++ b/src/rc/_usage.c @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/_usage.h b/src/rc/_usage.h index e4a5fa3b..ea2d52ab 100644 --- a/src/rc/_usage.h +++ b/src/rc/_usage.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/builtins.h b/src/rc/builtins.h index 43a4d9f9..7d05fa76 100644 --- a/src/rc/builtins.h +++ b/src/rc/builtins.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c index db81a631..ffefc884 100644 --- a/src/rc/checkpath.c +++ b/src/rc/checkpath.c @@ -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; diff --git a/src/rc/fstabinfo.c b/src/rc/fstabinfo.c index e67d8313..6dba903b 100644 --- a/src/rc/fstabinfo.c +++ b/src/rc/fstabinfo.c @@ -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"); diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 989dcbdc..8a847b8f 100644 --- a/src/rc/mountinfo.c +++ b/src/rc/mountinfo.c @@ -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 # include -# define F_FLAGS f_flags +# define F_FLAGS f_flags #elif defined(BSD) # include # 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 diff --git a/src/rc/rc-depend.c b/src/rc/rc-depend.c index 4a5d64e1..be998c40 100644 --- a/src/rc/rc-depend.c +++ b/src/rc/rc-depend.c @@ -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) diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index 0d9c514c..46093433 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -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); diff --git a/src/rc/rc-logger.h b/src/rc/rc-logger.h index c15e73f8..2ac8ddc6 100644 --- a/src/rc/rc-logger.h +++ b/src/rc/rc-logger.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index fe6022e2..d85126da 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -3,7 +3,7 @@ rc misc functions */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c index f50b4343..635e52fb 100644 --- a/src/rc/rc-plugin.c +++ b/src/rc/rc-plugin.c @@ -1,9 +1,9 @@ /* - librc-plugin.c + librc-plugin.c Simple plugin handler */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/rc-plugin.h b/src/rc/rc-plugin.h index 412a47e7..77873717 100644 --- a/src/rc/rc-plugin.h +++ b/src/rc/rc-plugin.h @@ -1,9 +1,9 @@ /* - librc-plugin.h + librc-plugin.h Private instructions to use plugins */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c index f57584ab..445e6e72 100644 --- a/src/rc/rc-status.c +++ b/src/rc/rc-status.c @@ -3,7 +3,7 @@ Display the status of the services in runlevels */ -/* +/* * Copyright 2007 Roy Marples * All rights reserved diff --git a/src/rc/rc-update.c b/src/rc/rc-update.c index 463c0cfe..7181ac1a 100644 --- a/src/rc/rc-update.c +++ b/src/rc/rc-update.c @@ -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) diff --git a/src/rc/rc.c b/src/rc/rc.c index 6fcbd981..567da725 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -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); diff --git a/src/rc/runscript.c b/src/rc/runscript.c index e136e944..a80e25f6 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -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); diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 901194e9..045080ea 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -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);