aboutsummaryrefslogtreecommitdiffstats
path: root/src/libsympathy.c
diff options
context:
space:
mode:
authorjames <>2008-02-04 20:23:55 +0000
committerjames <>2008-02-04 20:23:55 +0000
commit28a52b2df7761bd97d74938d582b1f678d23c756 (patch)
tree731cb3fc7bfe081dd49264142def881b0adf2776 /src/libsympathy.c
parenta1b65048ff1a96b50d30d327c969e10b77856499 (diff)
downloadsympathy-28a52b2df7761bd97d74938d582b1f678d23c756.tar.gz
sympathy-28a52b2df7761bd97d74938d582b1f678d23c756.tar.bz2
sympathy-28a52b2df7761bd97d74938d582b1f678d23c756.zip
*** empty log message ***
Diffstat (limited to 'src/libsympathy.c')
-rw-r--r--src/libsympathy.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/libsympathy.c b/src/libsympathy.c
index 013afc7..e86c088 100644
--- a/src/libsympathy.c
+++ b/src/libsympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.4 2008/02/04 20:23:55 james
+ * *** empty log message ***
+ *
* Revision 1.3 2008/02/04 05:45:55 james
* ::
*
@@ -25,36 +28,37 @@ static char rcsid[] =
#include "project.h"
-struct termios old={0};
+struct termios old = { 0 };
-static void foo(int not)
+static void
+foo (int not)
{
- tcsetattr(0,TCSANOW,&old);
- exit(1);
+ tcsetattr (0, TCSANOW, &old);
+ exit (1);
}
void
testy (void)
{
- struct termios raw={0};
+ struct termios raw = { 0 };
VT102 v = { 0 };
ANSI a = { 0 };
fd_set rfd;
int fd;
char c;
-
- signal(SIGINT,foo);
- tcgetattr(0,&old);
- tcgetattr(0,&raw);
- cfmakeraw(&raw);
- tcsetattr(0,TCSANOW,&raw);
+ signal (SIGINT, foo);
+
+ tcgetattr (0, &old);
+ tcgetattr (0, &raw);
+ cfmakeraw (&raw);
+ tcsetattr (0, TCSANOW, &raw);
a.fd = 1;
-//vt102_reset(&v);
+ vt102_reset (&v);
ansi_reset (&a);
@@ -71,20 +75,20 @@ testy (void)
continue;
if (FD_ISSET (0, &rfd))
{
- read (0, &c, 1);
- if (c==3) {
- tcsetattr(0,TCSANOW,&old);
- exit(1);
- }
-
+ if ((read (0, &c, 1) <= 0) || (c == 3))
+ break;
+
write (fd, &c, 1);
}
if (FD_ISSET (fd, &rfd))
{
- read (fd, &c, 1);
+ if ((read (fd, &c, 1) <= 0))
+ break;
//write (1, &c, 1);
vt102_parse_char (&v, c);
ansi_draw (&a, &v.crt);
}
}
+ tcsetattr (0, TCSANOW, &old);
+ printf ("QUAT\n");
}