Commit 5084f5a2 authored by Niels Möller's avatar Niels Möller
Browse files

Work in progress.

Rev: src/client_pty.c:1.4
Rev: src/command.c:1.18
Rev: src/command.h:1.21
Rev: src/lsh.c:1.50
parent 500e4599
......@@ -23,12 +23,10 @@
#include "client_pty.h"
#warning client_pty.c is currently not used.
/* GABA:
(class
(name pty_request)
(super request_info)
(super channel_request_command)
(vars
(term string)
(width . UINT32)
......@@ -38,11 +36,69 @@
(modes string)))
*/
struct do_format_pty_request(struct request_info *r)
static struct lsh_string *
do_format_pty_request(struct channel_request_command *s,
struct ssh_channel *channel,
int want_reply)
{
CAST(pty_request, req, s);
verbose("lsh: Requesting a remote pty.\n");
return format_channel_request(ATOM_PTY_REQ, channel, req->super.want_reply,
"%S%i%i%i%i%S",
req->term,
req->width, req->height,
req->width_p, req->height_p,
req->modes);
}
struct command *make_pty_request(int tty)
{
CAST(pty_request, req, r);
NEW(pty_request, req);
struct termios ios;
char *term = getenv("TERM");
if (!tty_getwinsize(fd, &req->width, &req->height,
&req->width_p, &req->height_p))
req->width = req->height = req->width_p = req->height_p = 0;
if (tty_getattr(fd, &ios))
req->modes = tty_encode_term_mode(&req->ios);
else
{
KILL(req);
return NULL;
}
req->super.format = do_format_pty_request;
req->super.super.call = do_channel_request_command;
req->tty = fd;
req->term = term ? format_cstring(term) : ssh_format("");
return &req->super;
}
/* GABA:
(class
(name raw_mode_command)
(super command)
(vars
(fd . int)))
*/
static int do_raw_mode(struct command *s,
struct lsh_object *x,
struct command_continuation *c)
{
CAST(raw_mode_command, self, s);
verbose("lsh: pty request %z.\n", x ? "successful" : "failed");
if (x)
{
#if 0
struct lsh_string *
format_pty_req(struct ssh_channel *channel, int want_reply,
UINT8 *term, UINT32 width, UINT32 height, UINT32 width_p,
......@@ -56,5 +112,5 @@ format_pty_req(struct ssh_channel *channel, int want_reply,
width_p, height_p,
term_modes);
}
#endif
......@@ -261,3 +261,14 @@ struct command *make_parallell_progn(struct object_list *body)
return &self->super;
}
}
static struct lsh_object *do_progn(struct command_simple *s UNUSED,
struct lsh_object *x)
{
CAST(object_list, body, x);
return make_parallell_progn(body);
}
struct command_simple progn_command =
STATIC_COMMAND_SIMPLE(do_progn);
......@@ -78,6 +78,7 @@ int do_call_simple_command(struct command *s,
{ { STATIC_HEADER, do_call_simple_command }, f}
struct command *make_parallell_progn(struct object_list *body);
extern struct command_simple progn_command;
/* GABA:
(class
......
......@@ -114,16 +114,43 @@ static struct lookup_verifier *make_fake_host_db(struct signature_algorithm *a)
/* GABA:
(expr
(name make_client_connect)
;; (globals (connect connect_command))
(globals
(connect connect_command)
(progn "&progn_command->super"))
(params
(connect object command)
(handshake object command)
(userauth object command)
(login object command))
(userauth_service object command)
(login object command)
(requests object object_list))
(expr (lambda (port)
(login (userauth (handshake (connect port)))))))
((progn requests) (open_session (login (userauth_service
(handshake (connect port)))))))))
*/
/* Requests a shell, and connects the channel to our stdio. */
/* GABA:
(expr
(name start_shell)
(super command)
(globals )
(params )
(expr
(lambda (session)
(start_io (shell_request session)))))
*/
/* GABA
(expr
(name do_pty)
(super command)
(params
(pty object ...))
(expr
(lambda (session)
(raw_mode (request_pty session)))))
*/
int main(int argc, char **argv)
{
......@@ -276,12 +303,6 @@ int main(int argc, char **argv)
werror("lsh: Invalid port or service\n");
exit (EXIT_FAILURE);
}
#if 0
if (!get_inaddr(&remote, host, port, "tcp"))
{
werror("No such host or service\n");
exit(1);
}
/* This is the final request. */
requests = make_shell_request(NULL);
......@@ -304,7 +325,6 @@ int main(int argc, char **argv)
requests = make_pty_request(tty, 0, 1, requests);
}
#endif /* WITH_PTY_SUPPORT */
#endif
in = STDIN_FILENO;
out = STDOUT_FILENO;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment