chiark / gitweb /
@@
[sympathy.git] / apps / sympathy.c
index 29cf0ace8f1c5fffb29405b44020d99a069b554e..df351f3e9111f56c40082daeeeb5655cfd2e6937 100644 (file)
@@ -10,6 +10,15 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.10  2008/02/20 19:44:37  james
+ * @@
+ *
+ * Revision 1.9  2008/02/20 18:49:11  staffcvs
+ * *** empty log message ***
+ *
+ * Revision 1.8  2008/02/20 18:33:37  james
+ * *** empty log message ***
+ *
  * Revision 1.7  2008/02/20 18:31:44  james
  * *** empty log message ***
  *
@@ -40,6 +49,9 @@ static char rcsid[] = "$Id$";
 #include <sys/utsname.h>
 #include <sys/stat.h>
 #include <dirent.h>
+#include <string.h>
+#include <strings.h>
+#include <malloc.h>
 
 #include "mainloop.h"
 
@@ -303,11 +315,11 @@ main (int argc, char *argv[])
 
   if (oflags['n'])
     {
-      nhistory = safe_atoi (oargs['n']);
-      if (nhistory < 0)
+      history = safe_atoi (oargs['n']);
+      if (history < 0)
         fatal_moan ("cannot parse -n %s as an integer", oargs['n']);
 
-      if (!nhistory)
+      if (!history)
         fatal_moan ("agrument to -n must be greater than zero");
     }
 
@@ -393,6 +405,11 @@ main (int argc, char *argv[])
         oflags['p']++;
     }
 
+  if (oflags['s'] && !oflags['F'])
+    {
+      daemon (1, 0);            /*incase socket is relative path, unlink then will fail */
+    }
+
 
   if (oflags['s'] || oflags['t'])
     {
@@ -445,10 +462,6 @@ main (int argc, char *argv[])
 
     }
 
-  if (oflags['s'] && !oflags['F'])
-    {
-      daemon (1, 0);            /*incase socket is relative path, unlink then will fail */
-    }
 
   if (oflags['c'] || oflags['t'])
     {
@@ -464,15 +477,15 @@ main (int argc, char *argv[])
 
           terminal_register_handlers ();
           ansi->terminal = terminal_open (0, 1);
-          ansi_reset (ansi, NULL);
+          ansi->reset(ansi, NULL);
         }
     }
 
-  mainloop (tty, server_socket, client_socket, ansi, log, nhistory);
+  mainloop (tty, server_socket, client_socket, ansi, log, history);
 
   if (ansi)
     {
-      ansi_terminal_reset (ansi);
+       ansi->close(ansi);
       terminal_atexit ();
     }