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