4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.6 2008/02/28 16:57:51 james
14 * *** empty log message ***
16 * Revision 1.5 2008/02/28 15:37:06 james
17 * *** empty log message ***
19 * Revision 1.4 2008/02/28 11:27:48 james
20 * *** empty log message ***
22 * Revision 1.3 2008/02/22 17:07:00 james
23 * *** empty log message ***
25 * Revision 1.2 2008/02/15 23:52:12 james
26 * *** empty log message ***
28 * Revision 1.1 2008/02/15 15:14:19 james
29 * *** empty log message ***
37 cmd_parse (Cmd * c, Context * ctx, char *buf)
39 if (!strcmp (buf, "quit"))
41 else if (!strcmp (buf, "flow"))
42 ctx->k->set_flow (ctx->k, ctx, 1);
43 else if (!strcmp (buf, "noflow"))
44 ctx->k->set_flow (ctx->k, ctx, 0);
45 else if (!strcmp (buf, "ansi"))
46 ctx->k->set_ansi (ctx->k, ctx, 0);
47 else if (!strcmp (buf, "noansi"))
48 ctx->k->set_ansi (ctx->k, ctx, 1);
49 else if (!strncmp (buf, "baud", 4))
50 ctx->k->set_baud (ctx->k, ctx, atoi (buf + 4));
51 else if (!strcmp (buf, "break"))
52 ctx->k->send_break (ctx->k, ctx);
53 else if (!strcmp (buf, "hangup"))
54 ctx->k->hangup (ctx->k, ctx);
55 else if (!strcmp (buf, "reset"))
56 ctx->k->reset (ctx->k, ctx);
57 else if (!strncmp (buf, "width", 5))
58 ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0);
59 else if (!strncmp (buf, "height", 6))
60 ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6));
70 cmd_show_status (Cmd * c, Context * ctx)
76 vt102_status_line (ctx->v, "Command not recognized - press any key");
78 vt102_status_line (ctx->v, c->csl);
80 vt102_status_line (ctx->v, c->buf);
85 cmd_key (Cmd * c, Context * ctx, int key)
92 cmd_show_status (c, ctx);
98 if (cmd_parse (c, ctx, c->buf + 1))
106 cmd_show_status (c, ctx);
110 if (((key == 8) || (key == 127)) && (c->ptr > 1))
116 if ((key >= 32) && (key < 127))
119 c->buf[c->ptr] = key;
125 cmd_show_status (c, ctx);
132 cmd_activate (Cmd * c, Context * ctx)
139 cmd_show_status (c, ctx);
145 cmd_new_status (Cmd * c, Context * ctx, char *msg)
147 strcpy (c->csl, msg);
148 cmd_show_status (c, ctx);
158 ret = (Cmd *) malloc (sizeof (Cmd));