diff options
author | Gerrit Pape <pape@smarden.org> | 2007-09-13 13:46:07 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2007-09-13 13:46:07 +0000 |
commit | d7cf21b8b5fe627eaf2d5d23bda9293c76e28266 (patch) | |
tree | 561abc41b2ce4f8207b3ffb073cea90be753beed | |
parent | e227125c69befc2e72803e133d3d1c8baf3410fa (diff) | |
download | runit-d7cf21b8b5fe627eaf2d5d23bda9293c76e28266.tar.gz runit-d7cf21b8b5fe627eaf2d5d23bda9293c76e28266.tar.xz runit-d7cf21b8b5fe627eaf2d5d23bda9293c76e28266.zip |
sv.c: whitespace fixups.
-rw-r--r-- | src/sv.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/sv.c b/src/sv.c index 738a471..246bbb5 100644 --- a/src/sv.c +++ b/src/sv.c @@ -58,7 +58,8 @@ void usage() { void done(unsigned int e) { if (curdir != -1) fchdir(curdir); _exit(e); } void fatal(char *m1) { strerr_warn3(FATAL, m1, ": ", &strerr_sys); - done(lsb ? 151 : 100); } + done(lsb ? 151 : 100); +} void fatal2(char *m1, char *m2) { strerr_warn4(FATAL, m1, m2, ": ", &strerr_sys); done(lsb ? 151 : 100); @@ -127,16 +128,16 @@ unsigned int svstatus_print(char *m) { pid <<=8; pid +=(unsigned char)svstatus[13]; pid <<=8; pid +=(unsigned char)svstatus[12]; tai_unpack(svstatus, &tstatus); - switch (svstatus[19]) { - case 0: outs(DOWN); break; - case 1: outs(RUN); break; - case 2: outs(FINISH); break; - } - outs(m); outs(": "); - if (svstatus[19]) { - outs("(pid "); sulong[fmt_ulong(sulong, pid)] =0; - outs(sulong); outs(") "); - } + switch (svstatus[19]) { + case 0: outs(DOWN); break; + case 1: outs(RUN); break; + case 2: outs(FINISH); break; + } + outs(m); outs(": "); + if (svstatus[19]) { + outs("(pid "); sulong[fmt_ulong(sulong, pid)] =0; + outs(sulong); outs(") "); + } buffer_put(buffer_1, sulong, fmt_ulong(sulong, tnow.sec.x < tstatus.x ? 0 : tnow.sec.x -tstatus.x)); outs("s"); @@ -208,30 +209,30 @@ int check(char *a) { if ((r =svstatus_get()) == -1) return(-1); while (*a) { - if (r == 0) { if (*a == 'x') return(1); return(-1); } - pid =(unsigned char)svstatus[15]; - pid <<=8; pid +=(unsigned char)svstatus[14]; - pid <<=8; pid +=(unsigned char)svstatus[13]; - pid <<=8; pid +=(unsigned char)svstatus[12]; - switch (*a) { - case 'x': return(0); - case 'u': - if (!pid || svstatus[19] != 1) return(0); - if (!checkscript()) return(0); - break; - case 'd': if (pid || svstatus[19] != 0) return(0); break; + if (r == 0) { if (*a == 'x') return(1); return(-1); } + pid =(unsigned char)svstatus[15]; + pid <<=8; pid +=(unsigned char)svstatus[14]; + pid <<=8; pid +=(unsigned char)svstatus[13]; + pid <<=8; pid +=(unsigned char)svstatus[12]; + switch (*a) { + case 'x': return(0); + case 'u': + if (!pid || svstatus[19] != 1) return(0); + if (!checkscript()) return(0); + break; + case 'd': if (pid || svstatus[19] != 0) return(0); break; case 'C': if (pid) if (!checkscript()) return(0); break; - case 't': + case 't': case 'k': - if (!pid && svstatus[17] == 'd') break; - tai_unpack(svstatus, &tstatus); - if ((tstart.sec.x > tstatus.x) || !pid || svstatus[18] || !checkscript()) - return(0); - break; - case 'o': - tai_unpack(svstatus, &tstatus); - if ((!pid && tstart.sec.x > tstatus.x) || (pid && svstatus[17] != 'd')) - return(0); + if (!pid && svstatus[17] == 'd') break; + tai_unpack(svstatus, &tstatus); + if ((tstart.sec.x > tstatus.x) || !pid || svstatus[18] || !checkscript()) + return(0); + break; + case 'o': + tai_unpack(svstatus, &tstatus); + if ((!pid && tstart.sec.x > tstatus.x) || (pid && svstatus[17] != 'd')) + return(0); break; case 'p': if (pid && !svstatus[16]) return(0); break; case 'c': if (pid && svstatus[16]) return(0); break; @@ -277,8 +278,7 @@ int main(int argc, char **argv) { switch(i) { case 'w': scan_ulong(optarg, &wait); case 'v': verbose =1; break; - case 'V': - strerr_warn1("$Id$", 0); + case 'V': strerr_warn1("$Id$", 0); case '?': usage(); } } |