aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames <>2008-02-24 00:42:53 +0000
committerjames <>2008-02-24 00:42:53 +0000
commit3240b828391da405d093356eae0b90af5abc7a32 (patch)
treef4dff70c3bc9ca1da2d855fe512571ff4a6ea29d
parent667353b64b552aff9e785a20ee915fb343a0dac9 (diff)
downloadsympathy-3240b828391da405d093356eae0b90af5abc7a32.tar.gz
sympathy-3240b828391da405d093356eae0b90af5abc7a32.tar.bz2
sympathy-3240b828391da405d093356eae0b90af5abc7a32.zip
*** empty log message ***
-rw-r--r--Makefile.am12
-rw-r--r--apps/Makefile.am14
-rw-r--r--apps/sympathy.c7
-rw-r--r--apps/usage.c20
-rw-r--r--src/Makefile.am4
-rw-r--r--src/ansi.c21
-rw-r--r--src/ansi.h5
-rw-r--r--src/crt.h7
-rw-r--r--src/prototypes.h9
-rw-r--r--src/ptty.c22
-rw-r--r--src/serial.c6
11 files changed, 99 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am
index 778ebd9..5191691 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,9 @@
# $Id$
#
# $Log$
+# Revision 1.2 2008/02/24 00:42:52 james
+# *** empty log message ***
+#
# Revision 1.1 2008/02/03 16:20:23 james
# *** empty log message ***
#
@@ -40,3 +43,12 @@ version.sed: $(VFD)/version-files $(VFD)/version-major \
echo "s/%VERSION%/${VNUM}/g" > version.sed; \
fi
+protos:
+ (cd src && ${MAKE} protos)
+
+tidy:
+ cvs commit -m ""
+ (cd src && ${MAKE} tidy)
+ (cd apps && ${MAKE} tidy)
+
+
diff --git a/apps/Makefile.am b/apps/Makefile.am
index 513e8ad..51a39e4 100644
--- a/apps/Makefile.am
+++ b/apps/Makefile.am
@@ -7,6 +7,9 @@
# $Id$
#
# $Log$
+# Revision 1.11 2008/02/24 00:42:53 james
+# *** empty log message ***
+#
# Revision 1.10 2008/02/20 18:35:10 james
# *** empty log message ***
#
@@ -44,11 +47,18 @@ INCLUDES = -I$(srcdir)/../src
bin_PROGRAMS = sympathy
-noinst_HEADERS=clients.h mainloop.h
+HDRS=clients.h mainloop.h
+SRCS=sympathy.c usage.c clients.c mainloop.c
-sympathy_SOURCES = sympathy.c usage.c clients.c mainloop.c
+noinst_HEADERS=${HDRS}
+
+sympathy_SOURCES = ${SRCS}
sympathy_LDADD = ../src/libsympathy.la -lutil
+tidy: ${SRCS} ${HDRS}
+ indent -i2 -ts0 ${SRCS} ${HDRS}
+ /bin/rm -f *~
+
AM_CFLAGS=-g -Werror
diff --git a/apps/sympathy.c b/apps/sympathy.c
index b24e6d0..b92dbe4 100644
--- a/apps/sympathy.c
+++ b/apps/sympathy.c
@@ -11,6 +11,9 @@ static char rcsid[] =
/*
* $Log$
+ * Revision 1.13 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.12 2008/02/23 11:48:52 james
* *** empty log message ***
*
@@ -258,7 +261,7 @@ main (int argc, char *argv[])
"sympathy -c [-H] -k skt\n"
"sympathy -r id [-H]\n" "sympathy {-l|-ls}\n"
#endif
- while ((c = getopt (argc, argv, "tscr:lKHd:pb:fL:Fk:n:")) != EOF)
+ while ((c = getopt (argc, argv, "utscr:lKHd:pb:fL:Fk:n:")) != EOF)
{
switch (c)
{
@@ -480,7 +483,7 @@ main (int argc, char *argv[])
else
{
terminal_register_handlers ();
- ansi = ansi_new_from_terminal (terminal_open (0, 1));
+ ansi = ansi_new_from_terminal (terminal_open (0, 1),oflags['u'] ? 0:1);
ansi->reset (ansi, NULL);
}
}
diff --git a/apps/usage.c b/apps/usage.c
index b0893d2..114f81d 100644
--- a/apps/usage.c
+++ b/apps/usage.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.8 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.7 2008/02/23 11:48:52 james
* *** empty log message ***
*
@@ -41,13 +44,13 @@ usage (void)
{
fprintf (stderr, "Usage:\n"
- "sympathy -t [-K] [-d serialdev|-p] [-b baud] [-f] [-L log]\n"
- "sympathy -s [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-F] [-k skt]\n"
- " [-n hlines]\n"
- "sympathy [-s -c] [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-k skt]\n"
+ "sympathy -t [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u]\n"
+ "sympathy -s [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u] [-F]\n"
+ " [-k skt] [-n hlines]\n"
+ "sympathy [-s -c] [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-u] [-k skt]\n"
" [-n hlines]\n"
- "sympathy -c [-H] -k skt\n"
- "sympathy -r id [-H]\n"
+ "sympathy -c [-H] [-u] -k skt\n"
+ "sympathy -r id [-H] [-u]\n"
"sympathy {-l|-ls}\n"
"sympathy -h\n"
"\n"
@@ -85,7 +88,10 @@ usage (void)
" emit HTML of the current state of the screen on stdout\n"
" -L log activity on the device to the file log\n"
" -n hlines the number of lines of history to store in the\n"
- " server, that are replayed on connexion\n");
+ " server, that are replayed on connexion\n"
+ " -u don't emit utf-8 instead map all non ascii characters as ?\n"
+);
+
exit (1);
}
diff --git a/src/Makefile.am b/src/Makefile.am
index ad3e0ad..7e0a3b9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,9 @@
# $Id$
#
# $Log$
+# Revision 1.17 2008/02/24 00:42:53 james
+# *** empty log message ***
+#
# Revision 1.16 2008/02/22 23:39:27 james
# *** empty log message ***
#
@@ -113,6 +116,7 @@ protos:
tidy: ${SRCS} ${HDRS}
indent -i2 -ts0 ${SRCS} ${HDRS}
+ /bin/rm -f *~
sympathy.h: ${PROJECTHDRS} sympathy.h.head sympathy.h.tail
cat sympathy.h.head ${PROJECTHDRS} sympathy.h.tail > $@ || /bin/rm -f $@
diff --git a/src/ansi.c b/src/ansi.c
index 256f7fb..7a0d630 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.30 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.29 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -316,21 +319,30 @@ ansi_set_attr (ANSI * a, int attr)
}
+static void
+ansi_emit_noutf8 (TTY * t, uint32_t ch)
+{
+ uint8_t c = (ch > 0x7f) ? '?' : ch;
+ t->xmit (t, &c, 1);
+}
static void
ansi_render (ANSI * a, CRT_CA ca)
{
int dif;
- if (ca.chr < 32)
+ if (ca.chr < 0x20)
ca.chr = ' ';
- if (ca.chr > 126)
+ if ((ca.chr > 0x7e) && (ca.chr < 0xa0))
ca.chr = ' ';
ansi_set_attr (a, ca.attr);
ansi_set_color (a, ca.color);
- a->terminal->xmit (a->terminal, &ca.chr, 1);
+ if (a->utf8)
+ utf8_emit (a->terminal, ca.chr);
+ else
+ ansi_emit_noutf8 (a->terminal, ca.chr);
a->pos.x++;
@@ -883,7 +895,7 @@ ansi_free (ANSI * a)
}
ANSI *
-ansi_new_from_terminal (TTY * t)
+ansi_new_from_terminal (TTY * t, int utf8)
{
ANSI *ret;
@@ -892,6 +904,7 @@ ansi_new_from_terminal (TTY * t)
ret->terminal = t;
+ ret->utf8 = utf8;
ret->update = ansi_update;
ret->reset = ansi_reset;
ret->terminal_reset = ansi_terminal_reset;
diff --git a/src/ansi.h b/src/ansi.h
index 8895a82..61ffff0 100644
--- a/src/ansi.h
+++ b/src/ansi.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.13 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.12 2008/02/23 11:48:37 james
* *** empty log message ***
*
@@ -82,6 +85,8 @@ typedef struct ANSI_struct
int attr;
int color;
+ int utf8;
+
int history_ptr;
FILE *file;
diff --git a/src/crt.h b/src/crt.h
index 933dc7b..d2119a3 100644
--- a/src/crt.h
+++ b/src/crt.h
@@ -12,6 +12,9 @@
/*
* $Log$
+ * Revision 1.10 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.9 2008/02/20 19:25:09 james
* *** empty log message ***
*
@@ -84,9 +87,9 @@
#define CRT_COLOR_NORMAL CRT_MAKE_COLOR(CRT_FGCOLOR_NORMAL,CRT_BGCOLOR_NORMAL)
-typedef struct
+typedef struct __attribute__ ((packed))
{
- uint8_t chr;
+ uint32_t chr;
uint8_t attr;
uint8_t color;
} CRT_CA;
diff --git a/src/prototypes.h b/src/prototypes.h
index 9c5eec4..a084d32 100644
--- a/src/prototypes.h
+++ b/src/prototypes.h
@@ -1,6 +1,6 @@
/* ansi.c */
extern int ansi_dispatch(ANSI *a, Context *c);
-extern ANSI *ansi_new_from_terminal(TTY *t);
+extern ANSI *ansi_new_from_terminal(TTY *t, int utf8);
/* crt.c */
extern void crt_erase(CRT *c, CRT_Pos s, CRT_Pos e, int ea, int color);
extern void crt_cls(CRT *c);
@@ -37,7 +37,7 @@ extern void vt102_change_attr(VT102 *v, char *na);
extern void vt102_parse_attr_string(VT102 *v, char *buf, int len);
extern void vt102_save_state(VT102 *v);
extern void vt102_restore_state(VT102 *v);
-extern void vt102_regular_char(Context *c, VT102 *v, char ch);
+extern void vt102_regular_char(Context *c, VT102 *v, int ch);
extern void vt102_scs(Context *c, int g, int s);
extern void vt102_parse_esc(Context *c, int ch);
extern void vt102_parse_csi(Context *c, char *buf, int len);
@@ -90,8 +90,8 @@ extern int wrap_read(int fd, void *buf, int len);
extern int wrap_write(int fd, void *buf, int len);
extern void set_nonblocking(int fd);
extern void set_blocking(int fd);
-extern void raw_termios(struct termios *termios);
extern void default_termios(struct termios *termios);
+extern void client_termios(struct termios *termios);
/* log.c */
extern Log *file_log_new(char *fn);
extern void log_f(Log *log, char *fmt, ...);
@@ -158,5 +158,6 @@ extern void serial_lock_free(Serial_lock *l);
extern Serial_lock *serial_lock_new(char *dev, int mode);
/* utf8.c */
extern void utf8_flush(Context *c);
-extern void utf8_parse(Context *c, int ch);
+extern void utf8_parse(Context *c, uint32_t ch);
extern UTF8 *utf8_new(void);
+extern void utf8_emit(TTY *t, int ch);
diff --git a/src/ptty.c b/src/ptty.c
index e268825..bddc56e 100644
--- a/src/ptty.c
+++ b/src/ptty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.10 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.9 2008/02/23 13:05:58 staffcvs
* *** empty log message ***
*
@@ -137,19 +140,16 @@ ptty_open (char *path, char *argv[])
pid_t child;
char name[1024];
struct winsize winsize = { 0 };
- struct termios termios = { 0 };
+ struct termios ctermios = { 0 };
int fd;
char *default_argv[] = { "-", (char *) 0 };
- default_termios (&termios);
- cfsetispeed (&termios, B9600);
- cfsetospeed (&termios, B9600);
-
+ client_termios (&ctermios);
winsize.ws_row = VT102_ROWS;
winsize.ws_col = VT102_COLS;
- child = forkpty (&fd, name, &termios, &winsize);
+ child = forkpty (&fd, name, &ctermios, &winsize);
switch (child)
{
@@ -169,6 +169,16 @@ ptty_open (char *path, char *argv[])
set_nonblocking (fd);
+#if 0
+ {
+ struct termios termios = { 0 };
+
+ tcgetattr (fd, &termios);
+ default_termios (&termios);
+ tcsetattr (fd, TCSANOW, &termios);
+ }
+#endif
+
t = (PTTY *) malloc (sizeof (PTTY));
strncpy (t->name, name, sizeof (t->name));
diff --git a/src/serial.c b/src/serial.c
index 3784573..1044bb2 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -6,10 +6,14 @@
*
*/
-static char rcsid[] = "$Id$";
+static char rcsid[] =
+ "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/24 00:42:53 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/23 13:05:58 staffcvs
* *** empty log message ***
*