4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.5 2008/02/28 15:37:06 james
14 * *** empty log message ***
16 * Revision 1.4 2008/02/28 11:27:48 james
17 * *** empty log message ***
19 * Revision 1.3 2008/02/22 17:07:00 james
20 * *** empty log message ***
22 * Revision 1.2 2008/02/15 23:52:12 james
23 * *** empty log message ***
25 * Revision 1.1 2008/02/15 15:14:19 james
26 * *** empty log message ***
34 cmd_parse (Cmd * c, Context * ctx, char *buf)
36 if (!strcmp (buf, "quit"))
38 else if (!strcmp (buf, "flow"))
39 ctx->k->set_flow (ctx->k, ctx, 1);
40 else if (!strcmp (buf, "noflow"))
41 ctx->k->set_flow (ctx->k, ctx, 0);
42 else if (!strcmp (buf, "ansi"))
43 ctx->k->set_ansi (ctx->k, ctx, 0);
44 else if (!strcmp (buf, "noansi"))
45 ctx->k->set_ansi (ctx->k, ctx, 1);
46 else if (!strncmp (buf, "baud", 4))
47 ctx->k->set_baud (ctx->k, ctx, atoi (buf + 4));
48 else if (!strcmp (buf, "break"))
49 ctx->k->send_break (ctx->k, ctx);
50 else if (!strcmp (buf, "hangup"))
51 ctx->k->hangup (ctx->k, ctx);
52 else if (!strcmp (buf, "reset"))
53 ctx->k->reset (ctx->k, ctx);
54 else if (!strncmp (buf, "width", 5))
55 ctx->k->set_size (ctx->k, ctx,atoi(buf+5),0);
56 else if (!strncmp (buf, "height", 6))
57 ctx->k->set_size (ctx->k, ctx,0,atoi(buf+6));
66 cmd_show_status (Cmd * c, Context * ctx)
72 vt102_status_line (ctx->v, "Command not recognized - press any key");
74 vt102_status_line (ctx->v, c->csl);
76 vt102_status_line (ctx->v, c->buf);
81 cmd_key (Cmd * c, Context * ctx, int key)
87 cmd_show_status (c, ctx);
93 if (cmd_parse (c, ctx, c->buf + 1)) {
98 cmd_show_status (c, ctx);
102 if (((key == 8) || (key == 127)) && (c->ptr > 1))
108 if ((key >= 32) && (key < 127))
111 c->buf[c->ptr] = key;
117 cmd_show_status (c, ctx);
124 cmd_activate (Cmd * c, Context * ctx)
131 cmd_show_status (c, ctx);
137 cmd_new_status (Cmd * c, Context * ctx, char *msg)
139 strcpy (c->csl, msg);
140 cmd_show_status (c, ctx);
150 ret = (Cmd *) malloc (sizeof (Cmd));