diff --git a/src/includes/helpers.h b/src/includes/helpers.h index 1a3e2cfe..44d76552 100644 --- a/src/includes/helpers.h +++ b/src/includes/helpers.h @@ -38,7 +38,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #ifdef __GLIBC__ -# if ! defined (__UCLIBC__) && ! defined (__dietlibc__) +# if !defined (__UCLIBC__) && !defined (__dietlibc__) # define strlcpy(dst, src, size) snprintf(dst, size, "%s", src) # endif #endif @@ -85,7 +85,7 @@ _unused static char *xstrdup(const char *str) { char *value; - if (! str) + if (!str) return (NULL); value = strdup(str); diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c index cde2ea8e..aa49e0d0 100644 --- a/src/libeinfo/libeinfo.c +++ b/src/libeinfo/libeinfo.c @@ -152,7 +152,7 @@ static const char *const color_terms[] = { /* strlcat and strlcpy are nice, shame glibc does not define them */ #ifdef __GLIBC__ -# if ! defined (__UCLIBC__) && ! defined (__dietlibc__) +# if !defined (__UCLIBC__) && !defined (__dietlibc__) static size_t strlcat(char *dst, const char *src, size_t size) { diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c index 4abe02fb..ec02e8b7 100644 --- a/src/librc/librc-daemon.c +++ b/src/librc/librc-daemon.c @@ -129,7 +129,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) if (exists("/proc/self/status")) { fp = fopen("/proc/self/status", "r"); if (fp) { - while (! feof(fp)) { + while (!feof(fp)) { rc_getline(&line, &len, fp); if (strncmp(line, "envID:\t0", 8) == 0) { openvz_host = true; @@ -183,12 +183,12 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) if (exists(buffer)) { fp = fopen(buffer, "r"); free(buffer); - if (! fp) + if (!fp) continue; - while (! feof(fp)) { + while (!feof(fp)) { rc_getline(&line, &len, fp); if (strncmp(line, "envID:", 6) == 0) { - container_pid = ! (strncmp(line, "envID:\t0", 8) == 0); + container_pid = !(strncmp(line, "envID:\t0", 8) == 0); break; } } diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index f91c2a8b..e240cba0 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -32,7 +32,7 @@ get_shell_value(char *string) char *p = string; char *e; - if (! string) + if (!string) return NULL; if (*p == '\'') @@ -142,7 +142,7 @@ rc_deptree_load_file(const char *deptree_file) if (strcmp(type, "service") == 0) { /* Sanity */ e = get_shell_value(p); - if (! e || *e == '\0') + if (!e || *e == '\0') continue; depinfo = xmalloc(sizeof(*depinfo)); TAILQ_INIT(&depinfo->depends); @@ -493,7 +493,7 @@ rc_deptree_order(const RC_DEPTREE *deptree, const char *runlevel, int options) RC_STRINGLIST *services; bootlevel = getenv("RC_BOOTLEVEL"); - if (! bootlevel) + if (!bootlevel) bootlevel = RC_LEVEL_BOOT; /* When shutting down, list all running services */ diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c index c625a379..b0edb942 100644 --- a/src/librc/librc-misc.c +++ b/src/librc/librc-misc.c @@ -210,11 +210,11 @@ static void rc_config_set_value(RC_STRINGLIST *config, char *value) bool replaced; char *token; - if (! p) + if (!p) return; if (strncmp(p, "export ", 7) == 0) p += 7; - if (! (token = strsep(&p, "="))) + if (!(token = strsep(&p, "="))) return; entry = xstrdup(token); @@ -338,7 +338,7 @@ static RC_STRINGLIST * rc_config_directory(RC_STRINGLIST *config) if (rc_conf_d_files) { rc_stringlist_sort(&rc_conf_d_files); TAILQ_FOREACH(fname, rc_conf_d_files, entries) { - if (! fname->value) + if (!fname->value) continue; sprintf(path, "%s/%s", RC_CONF_D, fname->value); rc_conf_d_list = rc_config_list(path); @@ -405,7 +405,7 @@ rc_conf_value(const char *setting) RC_STRING *s; char *p; - if (! rc_conf) { + if (!rc_conf) { rc_conf = rc_config_load(RC_CONF); atexit(_free_rc_conf); diff --git a/src/librc/librc.c b/src/librc/librc.c index 453bd005..8fad0fa7 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -538,10 +538,10 @@ rc_service_resolve(const char *service) /* First check started services */ snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s", "started", service); - if (lstat(file, &buf) || ! S_ISLNK(buf.st_mode)) { + if (lstat(file, &buf) || !S_ISLNK(buf.st_mode)) { snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s", "inactive", service); - if (lstat(file, &buf) || ! S_ISLNK(buf.st_mode)) + if (lstat(file, &buf) || !S_ISLNK(buf.st_mode)) *file = '\0'; } @@ -742,7 +742,7 @@ rc_service_mark(const char *service, const RC_SERVICE state) s != RC_SERVICE_STOPPED && s != RC_SERVICE_HOTPLUGGED && s != RC_SERVICE_SCHEDULED) && - (! skip_wasinactive || s != RC_SERVICE_WASINACTIVE)) + (!skip_wasinactive || s != RC_SERVICE_WASINACTIVE)) { snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s", rc_service_state_names[i].name, base); @@ -901,7 +901,7 @@ rc_service_schedule_start(const char *service, const char *service_to_start) bool retval; /* service may be a provided service, like net */ - if (! service || ! rc_service_exists(service_to_start)) + if (!service || !rc_service_exists(service_to_start)) return false; p += snprintf(file, sizeof(file), RC_SVCDIR "/scheduled/%s", @@ -1000,7 +1000,7 @@ rc_services_in_state(RC_SERVICE state) dirs = ls_dir(dir, 0); list = rc_stringlist_new(); - if (! dirs) + if (!dirs) return list; TAILQ_FOREACH(d, dirs, entries) { diff --git a/src/rc/do_e.c b/src/rc/do_e.c index fb109501..1778efe4 100644 --- a/src/rc/do_e.c +++ b/src/rc/do_e.c @@ -43,7 +43,7 @@ static int syslog_decode(char *name, const CODE *codetab) return atoi(name); for (c = codetab; c->c_name; c++) - if (! strcasecmp(name, c->c_name)) + if (!strcasecmp(name, c->c_name)) return c->c_val; return -1; diff --git a/src/rc/do_value.c b/src/rc/do_value.c index 2758b8e8..9ec5facf 100644 --- a/src/rc/do_value.c +++ b/src/rc/do_value.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) if (service == NULL) eerrorx("%s: no service specified", applet); - if (argc < 2 || ! argv[1] || *argv[1] == '\0') + if (argc < 2 || !argv[1] || *argv[1] == '\0') eerrorx("%s: no option specified", applet); if (strcmp(applet, "service_get_value") == 0 || diff --git a/src/rc/kill_all.c b/src/rc/kill_all.c index d80df19e..551572b7 100644 --- a/src/rc/kill_all.c +++ b/src/rc/kill_all.c @@ -78,7 +78,7 @@ static int mount_proc(void) syslog(LOG_ERR, "mount returned non-zero exit status"); break; } - if (! exists("/proc/version")) { + if (!exists("/proc/version")) { syslog(LOG_ERR, "Could not mount /proc"); return -1; } @@ -113,7 +113,7 @@ static bool is_user_process(pid_t pid) continue; } temp_pid = -1; - while (! feof(fp)) { + while (!feof(fp)) { buf = NULL; if (getline(&buf, &size, fp) != -1) { sscanf(buf, "PPid: %d", &temp_pid); diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 8cb2945f..6652760d 100644 --- a/src/rc/mountinfo.c +++ b/src/rc/mountinfo.c @@ -161,7 +161,7 @@ process_mount(RC_STRINGLIST *list, struct args *args, TAILQ_FOREACH(s, args->mounts, entries) if (strcmp(s->value, to) == 0) break; - if (! s) + if (!s) return -1; } @@ -260,7 +260,7 @@ find_mounts(struct args *args) if (flags & o->o_opt) { if (o->o_opt == MNT_LOCAL) netdev = 1; - if (! options) + if (!options) options = xstrdup(o->o_name); else { xasprintf(&tmp, "%s,%s", options, o->o_name); @@ -475,7 +475,7 @@ int main(int argc, char **argv) if (skip_point_regex && regexec(skip_point_regex, s->value, 0, NULL, 0) == 0) continue; - if (! rc_yesno(getenv("EINFO_QUIET"))) + if (!rc_yesno(getenv("EINFO_QUIET"))) printf("%s\n", s->value); result = EXIT_SUCCESS; } diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c index 7e82c44c..5bc53434 100644 --- a/src/rc/openrc-init.c +++ b/src/rc/openrc-init.c @@ -295,7 +295,7 @@ int main(int argc, char **argv) /* set default path */ setenv("PATH", path_default, 1); - if (! reexec) + if (!reexec) init(default_runlevel); if (mkfifo(RC_INIT_FIFO, 0600) == -1 && errno != EEXIST) diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c index 1db60959..4b1b9189 100644 --- a/src/rc/rc-logger.c +++ b/src/rc/rc-logger.c @@ -94,7 +94,7 @@ write_log(int logfd, const char *buffer, size_t bytes) continue; } - if (! in_term || isalpha((unsigned char)*p)) + if (!in_term || isalpha((unsigned char)*p)) in_escape = in_term = false; cont: p++; diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index a252a6c0..99a60fe4 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -138,7 +138,7 @@ env_config(void) /* Ensure our PATH is prefixed with the system locations first for a little extra security */ path = getenv("PATH"); - if (! path) + if (!path) setenv("PATH", RC_PATH_PREFIX, 1); else if (strncmp (RC_PATH_PREFIX, path, pplen) != 0) { l = strlen(path) + pplen + 3; @@ -152,7 +152,7 @@ env_config(void) while ((tok = strsep(&npp, ":"))) if (strcmp(tok, token) == 0) break; - if (! tok) + if (!tok) p += snprintf(p, l - (p - e), ":%s", token); free (np); } @@ -203,7 +203,7 @@ env_config(void) setenv("EINFO_VERBOSE", "YES", 1); errno = 0; - if ((! rc_conf_yesno("rc_color") && errno == 0) || + if ((!rc_conf_yesno("rc_color") && errno == 0) || rc_conf_yesno("rc_nocolor")) setenv("EINFO_COLOR", "NO", 1); } @@ -472,7 +472,7 @@ pid_t get_pid(const char *applet,const char *pidfile) FILE *fp; pid_t pid; - if (! pidfile) + if (!pidfile) return -1; if ((fp = fopen(pidfile, "r")) == NULL) { diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index fdf52f19..5938086d 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -279,7 +279,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, errno = 0; killed = (kill(pi->pid, sig) == 0 || errno == ESRCH ? true : false); - if (! quiet) + if (!quiet) eendv(killed ? 0 : 1, "%s: failed to send signal %d to PID %d: %s", applet, sig, pi->pid, strerror(errno)); @@ -422,7 +422,7 @@ int run_stop_schedule(const char *applet, if (progressed) printf("\n"); - if (! quiet) { + if (!quiet) { if (nrunning == 1) eerror("%s: %d process refused to stop", applet, nrunning); else diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c index 85bccd17..44651cc6 100644 --- a/src/rc/rc-service.c +++ b/src/rc/rc-service.c @@ -154,15 +154,15 @@ int main(int argc, char **argv) eerrorx("%s: service `%s' does not exist", applet, *argv); } state = rc_service_state(*argv); - if (if_crashed && ! (rc_service_daemons_crashed(*argv) && errno != EACCES)) + if (if_crashed && !(rc_service_daemons_crashed(*argv) && errno != EACCES)) return 0; - if (if_inactive && ! (state & RC_SERVICE_INACTIVE)) + if (if_inactive && !(state & RC_SERVICE_INACTIVE)) return 0; if (if_notstarted && (state & RC_SERVICE_STARTED)) return 0; - if (if_started && ! (state & RC_SERVICE_STARTED)) + if (if_started && !(state & RC_SERVICE_STARTED)) return 0; - if (if_stopped && ! (state & RC_SERVICE_STOPPED)) + if (if_stopped && !(state & RC_SERVICE_STOPPED)) return 0; *argv = service; execv(*argv, argv); diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c index 5f80f242..7eb152ec 100644 --- a/src/rc/rc-status.c +++ b/src/rc/rc-status.c @@ -412,7 +412,7 @@ int main(int argc, char **argv) state = rc_service_state(s->value); if ((rc_stringlist_find(sservices, s->value) || (state & ( RC_SERVICE_STOPPED | RC_SERVICE_HOTPLUGGED)))) { - if (! (state & RC_SERVICE_FAILED)) { + if (!(state & RC_SERVICE_FAILED)) { TAILQ_REMOVE(services, s, entries); free(s->value); free(s); diff --git a/src/rc/shell_var.c b/src/rc/shell_var.c index 218a2faf..70750245 100644 --- a/src/rc/shell_var.c +++ b/src/rc/shell_var.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) putchar(' '); while (*p) { c = (unsigned char)*p++; - if (! isalnum(c)) + if (!isalnum(c)) c = '_'; putchar(c); } diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 47ecea10..656ae9fa 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -800,7 +800,7 @@ int main(int argc, char **argv) if (makepidfile && pidfile) { fp = fopen(pidfile, "w"); - if (! fp) + if (!fp) eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); fprintf(fp, "%d\n", mypid); diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 9a3d5111..49b09c04 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -1037,7 +1037,7 @@ int main(int argc, char **argv) /* Make sure we can write a pid file */ fp = fopen(pidfile, "w"); - if (! fp) + if (!fp) eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); fclose(fp);