runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit bdd6e8ca2ae0437f9b05ff2d8863808032e103e6
parent 71cf02e4a8b15b0df229fe9aa04fc82e1dfcb74b
Author: Gerrit Pape <pape@smarden.org>
Date:   Thu, 13 Sep 2007 13:25:27 +0000

s/\t/        /g

Diffstat:
Msrc/pathexec_env.c | 14+++++++-------
Msrc/pmatch.c | 16++++++++--------
Msrc/runsvdir.c | 78+++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc/runsvstat.c | 30+++++++++++++++---------------
Msrc/subgetopt.c | 2+-
Msrc/svwaitdown.c | 64++++++++++++++++++++++++++++++++--------------------------------
Msrc/svwaitup.c | 12++++++------
Msrc/utmpset.c | 4++--
8 files changed, 110 insertions(+), 110 deletions(-)

diff --git a/src/pathexec_env.c b/src/pathexec_env.c @@ -52,14 +52,14 @@ void pathexec(const char *const *argv) if (!plus.s[i]) { split = str_chr(plus.s + j,'='); for (t = 0;t < elen;++t) - if (byte_equal(plus.s + j,split,e[t])) - if (e[t][split] == '=') { - --elen; - e[t] = e[elen]; - break; - } + if (byte_equal(plus.s + j,split,e[t])) + if (e[t][split] == '=') { + --elen; + e[t] = e[elen]; + break; + } if (plus.s[j + split]) - e[elen++] = plus.s + j; + e[elen++] = plus.s + j; j = i + 1; } e[elen] = 0; diff --git a/src/pmatch.c b/src/pmatch.c @@ -7,24 +7,24 @@ int pmatch(const char *p, const char *s, unsigned int len) { case '*': if (! (c =*p)) return(1); for (;;) { - if (! len) return(0); - if (*s == c) break; - ++s; --len; + if (! len) return(0); + if (*s == c) break; + ++s; --len; } continue; case '+': if ((c =*p++) != *s) return(0); for (;;) { - if (! len) return(1); - if (*s != c) break; - ++s; --len; + if (! len) return(1); + if (*s != c) break; + ++s; --len; } continue; /* case '?': if (*p == '?') { - if (*s != '?') return(0); - ++p; + if (*s != '?') return(0); + ++p; } ++s; --len; continue; diff --git a/src/runsvdir.c b/src/runsvdir.c @@ -99,16 +99,16 @@ void runsvdir() { if (! S_ISDIR(s.st_mode)) continue; for (i =0; i < svnum; i++) { if ((sv[i].ino == s.st_ino) && (sv[i].dev == s.st_dev)) { - sv[i].isgone =0; - if (! sv[i].pid) runsv(i, d->d_name); - break; + sv[i].isgone =0; + if (! sv[i].pid) runsv(i, d->d_name); + break; } } if (i == svnum) { /* new service */ if (svnum >= MAXSERVICES) { - warn3x("unable to start runsv ", d->d_name, ": too many services."); - continue; + warn3x("unable to start runsv ", d->d_name, ": too many services."); + continue; } sv[i].ino =s.st_ino; sv[i].dev =s.st_dev; @@ -202,12 +202,12 @@ int main(int argc, char **argv) { for (;;) { if ((pid =wait_nohang(&wstat)) <= 0) break; for (i =0; i < svnum; i++) { - if (pid == sv[i].pid) { - /* runsv has gone */ - sv[i].pid =0; - check =1; - break; - } + if (pid == sv[i].pid) { + /* runsv has gone */ + sv[i].pid =0; + check =1; + break; + } } } @@ -225,35 +225,35 @@ int main(int argc, char **argv) { taia_add(&stampcheck, &now, &deadline); if (stat(svdir, &s) != -1) { - if (check || \ - s.st_mtime != mtime || s.st_ino != ino || s.st_dev != dev) { - /* svdir modified */ - if (chdir(svdir) != -1) { - mtime =s.st_mtime; - dev =s.st_dev; - ino =s.st_ino; - check =0; - if (now.sec.x <= (4611686018427387914ULL +(uint64)mtime)) - sleep(1); - runsvdir(); - while (fchdir(curdir) == -1) { - warn("unable to change directory, pausing", 0); - sleep(5); - } - } - else - warn("unable to change directory to ", svdir); - } + if (check || \ + s.st_mtime != mtime || s.st_ino != ino || s.st_dev != dev) { + /* svdir modified */ + if (chdir(svdir) != -1) { + mtime =s.st_mtime; + dev =s.st_dev; + ino =s.st_ino; + check =0; + if (now.sec.x <= (4611686018427387914ULL +(uint64)mtime)) + sleep(1); + runsvdir(); + while (fchdir(curdir) == -1) { + warn("unable to change directory, pausing", 0); + sleep(5); + } + } + else + warn("unable to change directory to ", svdir); + } } else - warn("unable to stat ", svdir); + warn("unable to stat ", svdir); } if (rplog) if (taia_less(&now, &stamplog) == 0) { - write(logpipe[1], ".", 1); - taia_uint(&deadline, 900); - taia_add(&stamplog, &now, &deadline); + write(logpipe[1], ".", 1); + taia_uint(&deadline, 900); + taia_add(&stamplog, &now, &deadline); } taia_uint(&deadline, check ? 1 : 5); taia_add(&deadline, &now, &deadline); @@ -267,11 +267,11 @@ int main(int argc, char **argv) { if (rplog && (io[0].revents | IOPAUSE_READ)) while (read(logpipe[0], &ch, 1) > 0) - if (ch) { - for (i =6; i < rploglen; i++) - rplog[i -1] =rplog[i]; - rplog[rploglen -1] =ch; - } + if (ch) { + for (i =6; i < rploglen; i++) + rplog[i -1] =rplog[i]; + rplog[rploglen -1] =ch; + } switch(exitsoon) { case 1: diff --git a/src/runsvstat.c b/src/runsvstat.c @@ -139,21 +139,21 @@ int main(int argc, char **argv) { } if (show_status(*dir) == 1) { if (showlog) { - if (stat("log", &s) == -1) { - if (errno != error_noent) - warn("unable to stat()", "./log"); - } - else { - if (! S_ISDIR(s.st_mode)) - warnx("./log", "not a directory."); - else { - if (chdir("log") == -1) { - warn(*dir, "unable to change directory"); - continue; - } - show_status("\n log"); - } - } + if (stat("log", &s) == -1) { + if (errno != error_noent) + warn("unable to stat()", "./log"); + } + else { + if (! S_ISDIR(s.st_mode)) + warnx("./log", "not a directory."); + else { + if (chdir("log") == -1) { + warn(*dir, "unable to change directory"); + continue; + } + show_status("\n log"); + } + } } buffer_puts(buffer_1, "\n"); buffer_flush(buffer_1); } diff --git a/src/subgetopt.c b/src/subgetopt.c @@ -54,7 +54,7 @@ int sgopt(int argc,const char *const *argv,const char *opts) optproblem = c; return '?'; } - ++optind; + ++optind; } } return c; diff --git a/src/svwaitdown.c b/src/svwaitdown.c @@ -89,11 +89,11 @@ int main(int argc, const char * const *argv) { } if ((fd =open_write("supervise/ok")) == -1) { if (errno == error_nodevice) { - if (verbose) strerr_warn3(INFO, *dir, ": runsv not running.", 0); - dir++; + if (verbose) strerr_warn3(INFO, *dir, ": runsv not running.", 0); + dir++; } else - warn(*dir, ": unable to open supervise/ok: ", &strerr_sys); + warn(*dir, ": unable to open supervise/ok: ", &strerr_sys); continue; } close(fd); @@ -106,9 +106,9 @@ int main(int argc, const char * const *argv) { close(fd); if ((r < 18) || (r == 19)) { /* supervise compatibility */ if (r == -1) - warn(*dir, "unable to read supervise/status: ", &strerr_sys); + warn(*dir, "unable to read supervise/status: ", &strerr_sys); else - warn(*dir, ": unable to read supervise/status: bad format.", 0); + warn(*dir, ": unable to read supervise/status: bad format.", 0); continue; } pid =(unsigned char)status[15]; @@ -125,13 +125,13 @@ int main(int argc, const char * const *argv) { if (status[17] != 'd') { /* catch previous failures */ if ((fd =open_write("supervise/control")) == -1) { - warn(*dir, ": unable to open supervise/control: ", &strerr_sys); - continue; + warn(*dir, ": unable to open supervise/control: ", &strerr_sys); + continue; } if (write(fd, "dx", 1 +doexit) != (1 +doexit)) { - warn(*dir, ": unable to write to supervise/control: ", &strerr_sys); - close(fd); - continue; + warn(*dir, ": unable to write to supervise/control: ", &strerr_sys); + close(fd); + continue; } close(fd); } @@ -142,28 +142,28 @@ int main(int argc, const char * const *argv) { /* timeout */ if (verbose) strerr_warn2(INFO, "timeout.", 0); if (dokill) { - if (chdir(*dir) == -1) { - warn(*dir, ": unable to change directory: ", &strerr_sys); - continue; - } - if ((fd =open_write("supervise/control")) == -1) { - if (errno == error_nodevice) { - if (verbose) - strerr_warn3(INFO, *dir, ": runsv not running.", 0); - dir++; - } - else - warn(*argv, ": unable to open supervise/control: ", &strerr_sys); - continue; - } - if (write(fd, "k", 1) != 1) - warn(*argv, ": unable to write to supervise/control: ", &strerr_sys); - else - strerr_warn3(INFO, *dir, ": killed.", 0); - close(fd); - dir++; - if (! *dir) _exit(111); - continue; + if (chdir(*dir) == -1) { + warn(*dir, ": unable to change directory: ", &strerr_sys); + continue; + } + if ((fd =open_write("supervise/control")) == -1) { + if (errno == error_nodevice) { + if (verbose) + strerr_warn3(INFO, *dir, ": runsv not running.", 0); + dir++; + } + else + warn(*argv, ": unable to open supervise/control: ", &strerr_sys); + continue; + } + if (write(fd, "k", 1) != 1) + warn(*argv, ": unable to write to supervise/control: ", &strerr_sys); + else + strerr_warn3(INFO, *dir, ": killed.", 0); + close(fd); + dir++; + if (! *dir) _exit(111); + continue; } _exit(111); } diff --git a/src/svwaitup.c b/src/svwaitup.c @@ -71,9 +71,9 @@ int main(int argc, const char * const *argv) { } if ((fd =open_write("supervise/ok")) == -1) { if (errno == error_nodevice) - warn(*dir, ": runsv not running.", 0); + warn(*dir, ": runsv not running.", 0); else - warn(*dir, ": unable to open supervise/ok: ", &strerr_sys); + warn(*dir, ": unable to open supervise/ok: ", &strerr_sys); continue; } close(fd); @@ -86,9 +86,9 @@ int main(int argc, const char * const *argv) { close(fd); if (r < sizeof status) { if (r == -1) - warn(*dir, "unable to read supervise/status: ", &strerr_sys); + warn(*dir, "unable to read supervise/status: ", &strerr_sys); else - warn(*dir, ": unable to read supervise/status: bad format.", 0); + warn(*dir, ": unable to read supervise/status: bad format.", 0); continue; } @@ -110,8 +110,8 @@ int main(int argc, const char * const *argv) { if (is >= sec) { /* ok */ if (verbose) { - sulong[fmt_ulong(sulong, is)] =0; - strerr_warn5(INFO, *dir, ": is up (", sulong, " seconds)", 0); + sulong[fmt_ulong(sulong, is)] =0; + strerr_warn5(INFO, *dir, ": is up (", sulong, " seconds)", 0); } dir++; continue; diff --git a/src/utmpset.c b/src/utmpset.c @@ -103,10 +103,10 @@ int main (int argc, const char * const *argv, const char * const *envp) { if (! argv || ! *argv) usage(); if (utmp_logout(*argv) == -1) strerr_die4x(111, WARNING, "unable to logout line ", *argv, - " in utmp: no such entry"); + " in utmp: no such entry"); if (wtmp) if (wtmp_logout(*argv) == -1) strerr_die4sys(111, WARNING, - "unable to logout line ", *argv, " in wtmp: "); + "unable to logout line ", *argv, " in wtmp: "); _exit(0); }