chiark / gitweb /
*** empty log message ***
authorjames <james>
Thu, 28 Feb 2008 15:37:06 +0000 (15:37 +0000)
committerjames <james>
Thu, 28 Feb 2008 15:37:06 +0000 (15:37 +0000)
src/cmd.c
src/prototypes.h
src/tty.c

index 21a7909ff23bbaa7fd77a442c3e912ee7483157e..a2cf7cd03f2040d96473193bf99df8110e1e4f89 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.5  2008/02/28 15:37:06  james
+ * *** empty log message ***
+ *
  * Revision 1.4  2008/02/28 11:27:48  james
  * *** empty log message ***
  *
@@ -27,7 +30,7 @@ static char rcsid[] = "$Id$";
 #include "project.h"
 
 
-void
+int
 cmd_parse (Cmd * c, Context * ctx, char *buf)
 {
   if (!strcmp (buf, "quit"))
@@ -52,8 +55,10 @@ cmd_parse (Cmd * c, Context * ctx, char *buf)
     ctx->k->set_size (ctx->k, ctx,atoi(buf+5),0);
   else if (!strncmp (buf, "height", 6))
     ctx->k->set_size (ctx->k, ctx,0,atoi(buf+6));
-  else 
-    c->error++;
+  else return -1;
+
+return 0;
+
 
 }
 
@@ -78,14 +83,18 @@ cmd_key (Cmd * c, Context * ctx, int key)
 
   if (c->error) {
        c->error=0;
+       c->active=0;
         cmd_show_status (c, ctx);
        return 0;
   }
 
   if (key == 13)
     {
-      cmd_parse (c, ctx, c->buf + 1);
+      if (cmd_parse (c, ctx, c->buf + 1))  {
+       c->error++;
+       } else{
       c->active = 0;
+       }
       cmd_show_status (c, ctx);
       return 0;
     }
index 7d90a8ebfaa7c21bc65ad10907326a4c06093503..07fd0df17a3c64de659f505d5f9198b8537d1c07 100644 (file)
@@ -65,6 +65,7 @@ extern void tty_set_baud(TTY *t, int rate);
 extern void tty_send_break(TTY *t);
 extern void tty_set_flow(TTY *t, int flow);
 extern void tty_hangup(TTY *t);
+extern void tty_winch(TTY *t, CRT_Pos size);
 extern void tty_parse_reset(Context *c);
 extern void tty_analyse(Context *c);
 extern TTY_Parser *tty_parser_new(void);
@@ -141,7 +142,7 @@ extern int socket_write(Socket *s, void *buf, int len);
 /* serial.c */
 extern TTY *serial_open(char *path, int lock_mode);
 /* cmd.c */
-extern void cmd_parse(Cmd *c, Context *ctx, char *buf);
+extern int cmd_parse(Cmd *c, Context *ctx, char *buf);
 extern void cmd_show_status(Cmd *c, Context *ctx);
 extern int cmd_key(Cmd *c, Context *ctx, int key);
 extern int cmd_activate(Cmd *c, Context *ctx);
index e165dd58d8a24b63438d36089010a8fd5a7b4865..6090af2ea15972d9f9f32d263ed2112644629346 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.17  2008/02/28 15:37:06  james
+ * *** empty log message ***
+ *
  * Revision 1.16  2008/02/28 12:12:25  james
  * *** empty log message ***
  *
@@ -341,6 +344,18 @@ tty_hangup (TTY * t)
 }
 
 
+void tty_winch(TTY * t,CRT_Pos size)
+{
+  struct winsize sz = { 0 };
+
+  sz.ws_col=size.x;
+  sz.ws_row=size.y;
+
+  ioctl (t->wfd, TIOCGWINSZ, &sz);
+}
+
+
+
 #if 0
 typedef struct
 {