diff options
-rw-r--r-- | rtty.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -11,6 +11,8 @@ #include <termios.h> #include <unistd.h> +#define DPUTS(d, s) write(d, s, strlen(s)) + #define INIT "export TERM=tty43 EDITOR=ed PAGER=cat\n" #define IINIT "export EDITOR=ed PAGER=ul\n" @@ -105,9 +107,9 @@ main(int argc, char *argv[]) /* Initialize remote environment. */ if(interactive) - dprintf(fdin, IINIT); + DPUTS(fdin, IINIT); else - dprintf(fdin, INIT); + DPUTS(fdin, INIT); FD_ZERO(&rfds0); FD_ZERO(&rfds1); @@ -135,7 +137,7 @@ main(int argc, char *argv[]) || strcmp(bufout+strlen(bufout)-2, "# ") == 0)) goto escape; - dprintf(fdin, "%s", bufin); + DPUTS(fdin, bufin); continue; escape: @@ -143,7 +145,7 @@ escape: * Get remote working directory. (The response * looks like "pwd\n(directory)\n(prompt)".) */ - dprintf(fdin, "pwd\n"); + DPUTS(fdin, "pwd\n"); for(i = 0; i < MAXWD-1; i++){ read(fdout, wd, 1); if(*wd == '\n') break; @@ -199,7 +201,7 @@ found: execlp("scp", "scp", p, ".", NULL); err(1, "scp"); } - waitpid(child, &s, WALLSIG); + waitpid(child, &s, 0); if(WIFEXITED(s) && WEXITSTATUS(s)){ fprintf(stderr, "scp terminated abnormally\n"); fprintf(stderr, "file saved in %s\n", dir); @@ -212,7 +214,7 @@ found: execvp(eargv[0], eargv); err(1, "%s", eargv[0]); } - waitpid(child, &s, WALLSIG); + waitpid(child, &s, 0); if(WIFEXITED(s) && WEXITSTATUS(s)){ fprintf(stderr, "%s terminated abnormally\n", eargv[0]); @@ -225,7 +227,7 @@ found: execlp("scp", "scp", eargv[i], p, NULL); err(1, "scp"); } - waitpid(child, &s, WALLSIG); + waitpid(child, &s, 0); if(WIFEXITED(s) && WEXITSTATUS(s)){ fprintf(stderr, "scp terminated abnormally\n"); fprintf(stderr, "file saved in %s\n", dir); @@ -240,7 +242,7 @@ done: free(p); /* Trigger new remote shell prompt. */ - dprintf(fdin, "\n"); + DPUTS(fdin, "\n"); } /* @@ -299,12 +301,12 @@ done: || strstr(q, "pass phrase") || strstr(q, "Pass phrase")){ getpw(pw); - dprintf(fdin, "%s\n", pw); + DPUTS(fdin, pw); + DPUTS(fdin, "\n"); } } } } - } char * |