Lots and lots of whitespace and code style fixes

This commit is contained in:
2017-05-17 17:54:37 +03:00
parent 2442ceaee2
commit ff8546bf66
7 changed files with 191 additions and 180 deletions

30
main.c
View File

@@ -10,9 +10,8 @@
static void usage(char *argv)
{
log( ERROR,
"Usage:\n%s start|stop|restart [--daemonize=yes|no]\n",
argv );
log(ERROR,
"Usage:\n%s start|stop|restart [--daemonize=yes|no]\n", argv);
}
int main(int argc, char *argv[])
@@ -36,7 +35,8 @@ int main(int argc, char *argv[])
}
if (argc == 3) {
if (!strcmp("--daemonize=yes", argv[2]));
if (!strcmp("--daemonize=yes", argv[2]))
fork_flag = 1;
else if (!strcmp("--daemonize=no", argv[2]))
fork_flag = 0;
else {
@@ -45,16 +45,17 @@ int main(int argc, char *argv[])
}
}
if (confparse() != 0) {
log(ERROR, "Failed to parse the conf!");
exit(EXIT_FAILURE);
log(ERROR, "Failed to parse the conf!");
exit(EXIT_FAILURE);
}
log(VERBOSE, "Conf parser finished successfully");
//confexport();
if (task == 2 || task == 3) {
char buf[10];
int pid;
FILE *fp;
if (task == 2)
log(VERBOSE, "We got a stop signal!");
else if (task == 3)
@@ -65,7 +66,8 @@ int main(int argc, char *argv[])
switch (errno) {
case EEXIST:
if (!fgets(buf, 10, fp)) {
log(ERROR, "Failed to read %s!", conf.rmps.pidfile);
log(ERROR, "Failed to read %s!",
conf.rmps.pidfile);
exit(EXIT_FAILURE);
}
pid = strtol(buf, NULL, 10);
@@ -80,16 +82,14 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
break;
default:
log( ERROR,
"Unhandled errno while opening PID: %d. Exiting!",
errno
);
log(ERROR,
"Failed to open PID file (errno: %d. Exiting!",
errno);
exit(EXIT_FAILURE);
}
}
if (task == 1 || task == 3) {
if (task == 1 || task == 3)
launch_rmps(&conf, fork_flag);
}
return 0;
}