chiark / gitweb /
*** empty log message ***
[sympathy.git] / src / util.c
index 0a74869144b5cc2ae69dd15d22985dd0c1c990eb..ea46e7727e9ee3f3f8cc0538c8f2eac328e7752a 100644 (file)
@@ -10,6 +10,15 @@ static char rcsid[] = "$Id$";
 
 /*
  * $Log$
+ * Revision 1.6  2008/02/27 00:54:16  james
+ * *** empty log message ***
+ *
+ * Revision 1.5  2008/02/24 00:42:53  james
+ * *** empty log message ***
+ *
+ * Revision 1.4  2008/02/23 13:05:58  staffcvs
+ * *** empty log message ***
+ *
  * Revision 1.3  2008/02/13 16:57:29  james
  * *** empty log message ***
  *
@@ -75,14 +84,15 @@ set_blocking (int fd)
   fcntl (fd, F_SETFL, arg);
 }
 
+
+
 void
-raw_termios (struct termios *termios)
+default_termios (struct termios *termios)
 {
-
-  termios->c_iflag = ICRNL | IXON;
-  termios->c_oflag = OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
-  termios->c_lflag =
-    ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
+  termios->c_iflag = PARMRK | INPCK;
+  termios->c_oflag = NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
+  termios->c_lflag = 0;
+  termios->c_cflag = CS8 | CREAD | CLOCAL;
 
   termios->c_cc[VINTR] = 003;
   termios->c_cc[VQUIT] = 034;
@@ -99,18 +109,47 @@ raw_termios (struct termios *termios)
   termios->c_cc[VREPRINT] = 022;
   termios->c_cc[VDISCARD] = 017;
 
+
 }
 
 void
-default_termios (struct termios *termios)
+client_termios (struct termios *termios)
 {
-
   memset (termios, 0, sizeof (termios));
 
-  raw_termios (termios);
-
+  termios->c_iflag = ICRNL | IXON | PARMRK | INPCK;
+  termios->c_oflag = OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0;
+  termios->c_lflag =
+    ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE;
   termios->c_cflag = CS8 | CREAD | CLOCAL;
 
+  termios->c_cc[VINTR] = 003;
+  termios->c_cc[VQUIT] = 034;
+  termios->c_cc[VERASE] = 0177;
+  termios->c_cc[VKILL] = 025;
+  termios->c_cc[VEOF] = 004;
+  termios->c_cc[VEOL] = 0;
+  termios->c_cc[VEOL2] = 0;
+  termios->c_cc[VSTART] = 021;
+  termios->c_cc[VSTOP] = 023;
+  termios->c_cc[VSUSP] = 032;
+  termios->c_cc[VLNEXT] = 026;
+  termios->c_cc[VWERASE] = 027;
+  termios->c_cc[VREPRINT] = 022;
+  termios->c_cc[VDISCARD] = 017;
+
+
   cfsetispeed (termios, B9600);
   cfsetospeed (termios, B9600);
 }
+
+int fput_cp(FILE *f,uint32_t ch)
+{
+char buf[4];
+int i;
+i=utf8_encode(buf,ch);
+
+if (!i) return 0;
+
+return fwrite(buf,i,1,f);
+}