diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sv.c | 20 | ||||
-rw-r--r-- | src/sv.dist | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/sv.c b/src/sv.c index 7d3ba19..9003142 100644 --- a/src/sv.c +++ b/src/sv.c @@ -41,6 +41,7 @@ unsigned int lsb; unsigned int verbose =0; unsigned long wait =7; unsigned int kll =0; +unsigned int islog =0; struct taia tstart, tnow, tdiff; struct tai tstatus; @@ -67,6 +68,7 @@ void fatal2(char *m1, char *m2) { void out(char *p, char *m1) { buffer_puts(buffer_1, p); buffer_puts(buffer_1, *service); + if (islog) buffer_puts(buffer_1, "/log"); buffer_puts(buffer_1, ": "); buffer_puts(buffer_1, m1); if (errno) { @@ -155,18 +157,20 @@ int status(char *unused) { rc =svstatus_get(); switch(rc) { case -1: if (lsb) done(4); case 0: return(0); } rc =svstatus_print(*service); + islog =1; if (chdir("log") == -1) { if (errno != error_noent) { - outs("; log: "); outs(WARN); - outs("unable to change to log service directory: "); - outs(error_str(errno)); + outs("; "); + warn("unable to change directory"); } + else outs("\n"); } - else - if (svstatus_get()) { - outs("; "); svstatus_print("log"); - } - flush("\n"); + else { + outs("; "); + if (svstatus_get()) { rc =svstatus_print("log"); outs("\n"); } + } + islog =0; + flush(""); if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); } return(rc); } diff --git a/src/sv.dist b/src/sv.dist index 7a2be45..5b6c3ee 100644 --- a/src/sv.dist +++ b/src/sv.dist @@ -1,7 +1,7 @@ usage: sv [-v] [-w sec] command service ... 100 -$Id: 7d3ba19cde56692911cf4b2d711774583b1b860f $ +$Id: 900314260c6d52c986c5357673bea2f3bd3f4698 $ usage: sv [-v] [-w sec] command service ... 100 |