chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / cmd.c
index 21a7909ff23bbaa7fd77a442c3e912ee7483157e..34dc2f4e54bd42db849423094d2deb3a86f239c3 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -10,6 +10,15 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.7  2008/02/28 22:00:42  james
+ * *** empty log message ***
+ *
+ * Revision 1.6  2008/02/28 16:57:51  james
+ * *** empty log message ***
+ *
+ * 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,8 +36,8 @@ static char rcsid[] = "$Id$";
 #include "project.h"
 
 
-void
-cmd_parse (Cmd * c, Context * ctx, char *buf)
+int
+cmd_parse (Cmd * c, Context * ctx,ANSI *a, char *buf)
 {
   if (!strcmp (buf, "quit"))
     c->disconnect++;
@@ -48,12 +57,20 @@ cmd_parse (Cmd * c, Context * ctx, char *buf)
     ctx->k->hangup (ctx->k, ctx);
   else if (!strcmp (buf, "reset"))
     ctx->k->reset (ctx->k, ctx);
+  else if (!strcmp (buf, "expand")) {
+       int w=a->terminal->size.x;
+       int h=a->terminal->size.y-1;
+    ctx->k->set_size (ctx->k, ctx, w,h);
+  }
   else if (!strncmp (buf, "width", 5))
-    ctx->k->set_size (ctx->k, ctx,atoi(buf+5),0);
+    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++;
+    ctx->k->set_size (ctx->k, ctx, 0, atoi (buf + 6));
+  else
+    return -1;
+
+  return 0;
+
 
 }
 
@@ -63,7 +80,7 @@ cmd_show_status (Cmd * c, Context * ctx)
   if (!ctx->v)
     return;
 
-  if (c->error) 
+  if (c->error)
     vt102_status_line (ctx->v, "Command not recognized - press any key");
   else if (!c->active)
     vt102_status_line (ctx->v, c->csl);
@@ -73,19 +90,27 @@ cmd_show_status (Cmd * c, Context * ctx)
 }
 
 int
-cmd_key (Cmd * c, Context * ctx, int key)
+cmd_key (Cmd * c, Context * ctx,ANSI *a, int key)
 {
 
-  if (c->error) {
-       c->error=0;
-        cmd_show_status (c, ctx);
-       return 0;
-  }
+  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);
-      c->active = 0;
+      if (cmd_parse (c, ctx, a,c->buf + 1))
+        {
+          c->error++;
+        }
+      else
+        {
+          c->active = 0;
+        }
       cmd_show_status (c, ctx);
       return 0;
     }