4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.7 2008/02/28 22:00:42 james
14 * *** empty log message ***
16 * Revision 1.6 2008/02/28 16:57:51 james
17 * *** empty log message ***
19 * Revision 1.5 2008/02/28 15:37:06 james
20 * *** empty log message ***
22 * Revision 1.4 2008/02/28 11:27:48 james
23 * *** empty log message ***
25 * Revision 1.3 2008/02/22 17:07:00 james
26 * *** empty log message ***
28 * Revision 1.2 2008/02/15 23:52:12 james
29 * *** empty log message ***
31 * Revision 1.1 2008/02/15 15:14:19 james
32 * *** empty log message ***
40 cmd_parse (Cmd * c, Context * ctx,ANSI *a, char *buf)
42 if (!strcmp (buf, "quit"))
44 else if (!strcmp (buf, "flow"))
45 ctx->k->set_flow (ctx->k, ctx, 1);
46 else if (!strcmp (buf, "noflow"))
47 ctx->k->set_flow (ctx->k, ctx, 0);
48 else if (!strcmp (buf, "ansi"))
49 ctx->k->set_ansi (ctx->k, ctx, 0);
50 else if (!strcmp (buf, "noansi"))
51 ctx->k->set_ansi (ctx->k, ctx, 1);
52 else if (!strncmp (buf, "baud", 4))
53 ctx->k->set_baud (ctx->k, ctx, atoi (buf + 4));
54 else if (!strcmp (buf, "break"))
55 ctx->k->send_break (ctx->k, ctx);
56 else if (!strcmp (buf, "hangup"))
57 ctx->k->hangup (ctx->k, ctx);
58 else if (!strcmp (buf, "reset"))
59 ctx->k->reset (ctx->k, ctx);
60 else if (!strcmp (buf, "expand")) {
61 int w=a->terminal->size.x;
62 int h=a->terminal->size.y-1;
63 ctx->k->set_size (ctx->k, ctx, w,h);
65 else if (!strncmp (buf, "width", 5))
66 ctx->k->set_size (ctx->k, ctx, atoi (buf + 5), 0);
67 else if (!strncmp (buf, "height", 6))
68 ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6));
78 cmd_show_status (Cmd * c, Context * ctx)
84 vt102_status_line (ctx->v, "Command not recognized - press any key");
86 vt102_status_line (ctx->v, c->csl);
88 vt102_status_line (ctx->v, c->buf);
93 cmd_key (Cmd * c, Context * ctx,ANSI *a, int key)
100 cmd_show_status (c, ctx);
106 if (cmd_parse (c, ctx, a,c->buf + 1))
114 cmd_show_status (c, ctx);
118 if (((key == 8) || (key == 127)) && (c->ptr > 1))
124 if ((key >= 32) && (key < 127))
127 c->buf[c->ptr] = key;
133 cmd_show_status (c, ctx);
140 cmd_activate (Cmd * c, Context * ctx)
147 cmd_show_status (c, ctx);
153 cmd_new_status (Cmd * c, Context * ctx, char *msg)
155 strcpy (c->csl, msg);
156 cmd_show_status (c, ctx);
166 ret = (Cmd *) malloc (sizeof (Cmd));