Force pseudo-tty allocation option "-t"
Simon Epsteyn
seva at null.cc.uic.edu
Fri Aug 25 05:25:17 EST 2000
Please Cc: me on the reply as I am not on the list.
>From the ssh(1) man page:
-t Force pseudo-tty allocation. This can be used to execute arbi
trary screen-based programs on a remote machine, which can be
very useful, e.g., when implementing menu services.
This is similiar to what I am trying to do, use "-t" flag to ssh from my
application, however it just didn't seem to work.
>From the ssh.c source:
/* Do not allocate a tty if stdin is not a tty. */
if (!isatty(fileno(stdin))) {
if (tty_flag)
fprintf(stderr, "Pseudo-terminal will not be allocated because stdin is not a terminal.\n");
tty_flag = 0;
}
This seems like it doesn't allocate a pseudo-tty no matter what the command
line option set the tty_flag to, since it only check for isatty().
Could someone explain this to me if I am wrong, but does changing "if
(tty_flag)" to "if (!(tty_flag))" seems to work...
Please take a look at the attached patch and Cc: me on the reply.
/Simon
-------------- next part --------------
--- ssh.c.orig Thu Aug 24 13:17:30 2000
+++ ssh.c Thu Aug 24 14:16:47 2000
@@ -460,9 +460,8 @@
/* Do not allocate a tty if stdin is not a tty. */
if (!isatty(fileno(stdin))) {
- if (tty_flag)
+ if (!(tty_flag))
fprintf(stderr, "Pseudo-terminal will not be allocated because stdin is not a terminal.\n");
- tty_flag = 0;
}
/* force */
if (no_tty_flag)
More information about the openssh-unix-dev
mailing list