X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/786989941b7b4504f0234c4a318f929802e981ad..797cf76bc51a342ab680c9426a480bd544edf334:/client/tripectl.c diff --git a/client/tripectl.c b/client/tripectl.c index 4aece8d1..5bdc5025 100644 --- a/client/tripectl.c +++ b/client/tripectl.c @@ -163,6 +163,7 @@ static void cline(char *p, size_t len, void *b) } else if (strcmp(q, "INFO") == 0) { checkfg(); puts(p); + fflush(stdout); } else if (strcmp(q, "OK") == 0) { checkfg(); exit(0); @@ -176,6 +177,7 @@ static void cline(char *p, size_t len, void *b) } else if (strcmp(q, "BGINFO") == 0) { checkbg(&p); puts(p); + fflush(stdout); } else if (strcmp(q, "BGFAIL") == 0) { checkbg(&p); die(EXIT_FAILURE, "%s", p); @@ -191,6 +193,7 @@ static void sline(char *p, size_t len, void *b) exit(0); } puts(p); + fflush(stdout); } static void uline(char *p, size_t len, void *b) @@ -268,10 +271,7 @@ static void logfile(const char *name) } } -static void sighup(int sig, void *v) -{ - logfile(logname); -} +static void sighup(int sig, void *v) { logfile(logname); } static void cleanup(void) { @@ -287,9 +287,7 @@ static void sigdie(int sig) } static void version(FILE *fp) -{ - pquis(fp, "$, TrIPE version " VERSION "\n"); -} + { pquis(fp, "$, TrIPE version " VERSION "\n"); } static void usage(FILE *fp) { @@ -345,6 +343,8 @@ int main(int argc, char *argv[]) if ((p = getenv("TRIPEDIR")) != 0) dir = p; + if ((p = getenv("TRIPESOCK")) != 0) + sock = p; /* --- Parse the arguments --- */ @@ -537,11 +537,8 @@ int main(int argc, char *argv[]) if (optind < argc) { dstr d = DSTR_INIT; setup((f & f_warn) ? "WATCH -A+w" : "WATCH -A"); - dstr_puts(&d, argv[optind++]); - while (optind < argc) { - dstr_putc(&d, ' '); - dstr_puts(&d, argv[optind++]); - } + while (optind < argc) + u_quotify(&d, argv[optind++]); dstr_putc(&d, '\n'); errno = EIO; if (write(fd, d.buf, d.len) != d.len || shutdown(fd, 1))