4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.8 2008/02/29 22:50:29 james
14 * *** empty log message ***
16 * Revision 1.7 2008/02/28 22:00:42 james
17 * *** empty log message ***
19 * Revision 1.6 2008/02/28 16:57:51 james
20 * *** empty log message ***
22 * Revision 1.5 2008/02/28 15:37:06 james
23 * *** empty log message ***
25 * Revision 1.4 2008/02/28 11:27:48 james
26 * *** empty log message ***
28 * Revision 1.3 2008/02/22 17:07:00 james
29 * *** empty log message ***
31 * Revision 1.2 2008/02/15 23:52:12 james
32 * *** empty log message ***
34 * Revision 1.1 2008/02/15 15:14:19 james
35 * *** empty log message ***
43 cmd_parse (Cmd * c, Context * ctx,ANSI *a, char *buf)
45 if (!strcmp (buf, "quit"))
47 else if (!strcmp (buf, "flow"))
48 ctx->k->set_flow (ctx->k, ctx, 1);
49 else if (!strcmp (buf, "noflow"))
50 ctx->k->set_flow (ctx->k, ctx, 0);
51 else if (!strcmp (buf, "ansi"))
52 ctx->k->set_ansi (ctx->k, ctx, 0);
53 else if (!strcmp (buf, "noansi"))
54 ctx->k->set_ansi (ctx->k, ctx, 1);
55 else if (!strncmp (buf, "baud", 4))
56 ctx->k->set_baud (ctx->k, ctx, atoi (buf + 4));
57 else if (!strcmp (buf, "break"))
58 ctx->k->send_break (ctx->k, ctx);
59 else if (!strcmp (buf, "hangup"))
60 ctx->k->hangup (ctx->k, ctx);
61 else if (!strcmp (buf, "reset"))
62 ctx->k->reset (ctx->k, ctx);
63 else if (!strcmp (buf, "expand")) {
64 int w=a->terminal->size.x;
65 int h=a->terminal->size.y-1;
66 ctx->k->set_size (ctx->k, ctx, w,h);
68 else if (!strncmp (buf, "width", 5))
69 ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0);
70 else if (!strncmp (buf, "height", 6))
71 ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6));
81 cmd_show_status (Cmd * c, Context * ctx)
87 vt102_status_line (ctx->v, "Command not recognized - press any key");
89 vt102_status_line (ctx->v, c->csl);
91 vt102_status_line (ctx->v, c->buf);
96 cmd_key (Cmd * c, Context * ctx,ANSI *a, int key)
103 cmd_show_status (c, ctx);
109 if (cmd_parse (c, ctx, a,c->buf + 1))
117 cmd_show_status (c, ctx);
121 if (((key == 8) || (key == 127)) && (c->ptr > 1))
127 if ((key >= 32) && (key < 127))
130 c->buf[c->ptr] = key;
136 cmd_show_status (c, ctx);
143 cmd_deactivate (Cmd * c, Context * ctx)
146 cmd_show_status (c, ctx);
151 cmd_activate (Cmd * c, Context * ctx)
158 cmd_show_status (c, ctx);
164 cmd_new_status (Cmd * c, Context * ctx, char *msg)
166 strcpy (c->csl, msg);
167 cmd_show_status (c, ctx);
177 ret = (Cmd *) malloc (sizeof (Cmd));