diff --git a/finit.h b/finit.h index b768fcc5..4e0748de 100644 --- a/finit.h +++ b/finit.h @@ -35,34 +35,34 @@ /* Distribution specific configuration */ #if defined EMBEDDED_SYSTEM -# define CONSOLE "/dev/console" -# define SETUP_DEVFS "/sbin/mdev -s" -# define GETTY "/sbin/getty -L 115200 %s vt100" -# define RUNLEVEL 2 +# define CONSOLE "/dev/console" +# define SETUP_DEVFS "/sbin/mdev -s" +# define GETTY "/sbin/getty -L 115200 %s vt100" +# define RUNLEVEL 2 #else /* Debian/Ubuntu based distributions */ -# define CONSOLE "/dev/tty1" -# define SETUP_DEVFS "/sbin/udevd --daemon" -# define GETTY "/sbin/getty -8 38400 %s" -# define RUNLEVEL 2 -# define RANDOMSEED "/var/lib/urandom/random-seed" +# define CONSOLE "/dev/tty1" +# define SETUP_DEVFS "/sbin/udevd --daemon" +# define GETTY "/sbin/getty -8 38400 %s" +# define RUNLEVEL 2 +# define RANDOMSEED "/var/lib/urandom/random-seed" # define REMOUNT_ROOTFS_RW # define HAVE_DBUS #endif #ifndef DEFUSER -# define DEFUSER "root" +# define DEFUSER "root" #endif #ifndef DEFHOST -# define DEFHOST "noname" +# define DEFHOST "noname" #endif -#define CMD_SIZE 256 -#define LINE_SIZE 1024 -#define BUF_SIZE 4096 +#define CMD_SIZE 256 +#define LINE_SIZE 1024 +#define BUF_SIZE 4096 -#define INIT_MAGIC 0x03091969 -#define INIT_CMD_RUNLVL 1 -#define INIT_CMD_DEBUG 2 +#define INIT_MAGIC 0x03091969 +#define INIT_CMD_RUNLVL 1 +#define INIT_CMD_DEBUG 2 struct init_request { int magic; /* Magic number */ diff --git a/helpers.c b/helpers.c index f661ebc8..f1ae7113 100644 --- a/helpers.c +++ b/helpers.c @@ -262,7 +262,7 @@ char *pid_get_name(pid_t pid, char *name, size_t len) * Returns: * Number of signals sent, i.e. number of processes who have received the signal. */ -int procname_kill (char *name, int signo) +int procname_kill(char *name, int signo) { int result = 0; char path[32], line[64]; @@ -276,17 +276,17 @@ int procname_kill (char *name, int signo) return 0; } - while ((entry = readdir (dir)) != NULL) { + while ((entry = readdir(dir)) != NULL) { /* Skip non-process entries in /proc */ - if (!isdigit (*entry->d_name)) + if (!isdigit(*entry->d_name)) continue; - snprintf (path, sizeof(path), "/proc/%s/status", entry->d_name); + snprintf(path, sizeof(path), "/proc/%s/status", entry->d_name); /* Skip non-readable files (protected?) */ - if ((fp = fopen (path, "r")) == NULL) + if ((fp = fopen(path, "r")) == NULL) continue; - if (fgets (line, sizeof (line), fp)) { + if (fgets(line, sizeof (line), fp)) { char *pname = line + 6; /* Skip first part of line --> "Name:\t" */ if (strncmp(pname, name, strlen(pname) - 1) == 0) { diff --git a/helpers.h b/helpers.h index 492fef50..269f5359 100644 --- a/helpers.h +++ b/helpers.h @@ -69,10 +69,10 @@ /* Esc[?25h (lower case H) Show Cursor */ #define showcursor() fputs("\e[?25h", stderr) -#define echo(fmt, args...) do { fprintf(stderr, fmt "\n", ##args); } while (0) -#define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } } while (0) -#define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0) -#define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0) +#define echo(fmt, args...) do { fprintf(stderr, fmt "\n", ##args); } while (0) +#define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } } while (0) +#define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0) +#define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0) extern int debug; extern int verbose; @@ -89,7 +89,7 @@ char *pid_get_name (pid_t pid, char *name, size_t len); void procname_set (char *name, char *args[]); int procname_kill (char *name, int signo); -void print_desc (char *action, char *desc); +void print_desc (char *action, char *desc); int print_result (int fail); int start_process (char *cmd, char *args[], int console); void chomp (char *str);