X-Git-Url: https://git.distorted.org.uk/~mdw/sw-tools/blobdiff_plain/f5c398f37568c3c3cebd6e8365557d385cbb9ebd..165b3d5cd16b4c9995916ea40eea9efe3ae9c93e:/src/sw_rsh.c diff --git a/src/sw_rsh.c b/src/sw_rsh.c index 8720551..e054351 100644 --- a/src/sw_rsh.c +++ b/src/sw_rsh.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: sw_rsh.c,v 1.7 1999/09/24 13:16:22 mdw Exp $ + * $Id$ * * Run remote commands * @@ -26,35 +26,6 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: sw_rsh.c,v $ - * Revision 1.7 1999/09/24 13:16:22 mdw - * Fix typo in comment. - * - * Revision 1.6 1999/09/24 13:15:57 mdw - * Remove unnecessary assumptions about structure layouts. (The `pkhead' - * structure is no more.) - * - * Revision 1.5 1999/06/24 16:02:22 mdw - * Fix signal handling some more. - * - * Revision 1.4 1999/06/24 15:51:17 mdw - * Fix signal handlers so they don't corrupt `errno'. - * - * Revision 1.3 1999/06/18 18:58:54 mdw - * Signal handling fixes. - * - * Revision 1.2 1999/06/02 17:03:29 mdw - * Fix use of `octet' now that mLib includes `bits.h' (as of version 1.3.5 - * release). Also use the mLib load and store macros rather than doing it - * by hand. - * - * Revision 1.1.1.1 1999/06/02 16:53:34 mdw - * Initial import. - * - */ - /*----- Header files ------------------------------------------------------*/ #include "config.h" @@ -342,7 +313,7 @@ void swwait(sw_remote *r, int status) void swvprintf(sw_remote *r, const char *format, va_list ap) { dstr d = DSTR_INIT; - dstr_vputf(&d, format, ap); + dstr_vputf(&d, format, &ap); pksend(r, PKTYPE_DATA, d.buf, d.len); dstr_destroy(&d); } @@ -385,7 +356,7 @@ void swdie(sw_remote *r, int status, const char *format, ...) va_start(ap, format); dstr_putf(&d, "%s [remote]: ", QUIS); - dstr_vputf(&d, format, ap); + dstr_vputf(&d, format, &ap); dstr_putc(&d, '\n'); dstr_putz(&d); va_end(ap); @@ -425,7 +396,7 @@ static void remote(sw_remote *r, const char *cmd, char *argv[], char *env[]) sym_table t; sym_create(&t); env_import(&t, env); - if (env != environ) { + if (env[0] && env != environ) { free(env); env_import(&t, environ); } @@ -567,7 +538,15 @@ void swrsh_remote(const char *cmd) r.fdin = 0; r.fdout = 1; - /* --- Read packets from the remote host --- */ + /* --- Object if stdin is a terminal --- */ + + if (isatty(STDIN_FILENO)) { + die(EXIT_FAILURE, + "don't use the `--remote' option unless " + "you know what you're doing."); + } + + /* --- Read packets from the remote host --- */ for (;;) { int t = pkrecv(&r);