[SOLVED] Re: What magic did openssh do to handle programs like VIM?

Aaron Lewis the.warl0ck.1989 at gmail.com
Tue Feb 11 22:13:32 EST 2014


Hi Darren,

As you suggested, I've incorporated pty and enabled raw mode in my
client program.
VIM runs fine ;-P

Now I only need to pass in the terminal window size and handle several signals

Thanks for the heads up!






On Mon, Feb 10, 2014 at 4:59 PM, Darren Tucker <dtucker at zip.com.au> wrote:
> On Mon, Feb 10, 2014 at 7:39 PM, Aaron Lewis <the.warl0ck.1989 at gmail.com> wrote:
>> I'm trying to write my own remote shell program,
> [...]
>> 2. If I run command like VIM, it doesn't run.
>>     And buttons like "<ESC>:q" won't work
>>
>> Can someone enlighten me about what SSH did, so it all works perfectly?
>
> Pseudo terminals: http://en.wikipedia.org/wiki/Pseudo_terminal.  ssh
> asks sshd for one when you run an interactive shell (eg "ssh
> yourserver") or you use the -t flag.  You can run vim via ssh without
> a pty and it'll behave like your application: "ssh server vim
> somefile".
>
> If you can find a copy of Stevens' Advanced Programming in the Unix
> Environment it's got a chapter on PTYs that's pretty good.  Failing
> that, take a look at the openpty man page and the code in openssh's
> sshpty.c.
>
> if you don't have openpty then your task just got harder because it's
> quite platform-specific; take a look in openbsd-compat/bsd-openpty.c.
>
> --
> Darren Tucker (dtucker at zip.com.au)
> GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
>     Good judgement comes with experience. Unfortunately, the experience
> usually comes from bad judgement.



-- 
Best Regards,
Aaron Lewis - PGP: 0x13714D33 - http://pgp.mit.edu/
Finger Print:   9F67 391B B770 8FF6 99DC  D92D 87F6 2602 1371 4D33


More information about the openssh-unix-dev mailing list