Blame SOURCES/1.20.7...e82d1a653ca94aa4ed12441424da6ce780b1e530.diff

725064
diff --git a/.gitignore b/.gitignore
725064
index 87df93b..5f79b9d 100644
725064
--- a/.gitignore
725064
+++ b/.gitignore
725064
@@ -11,6 +11,7 @@ Makefile
725064
 Makefile.include
725064
 /aclocal.m4
725064
 /autom4te.cache
725064
+/config.cache
725064
 /config.log
725064
 /config.status
725064
 /configure
725064
@@ -29,7 +30,7 @@ Makefile.include
725064
 /src/gpm
725064
 /src/gpm2/tmp
725064
 /src/gpm2/out
725064
-/src/lib/libgpm.so.*
725064
+/src/lib/libgpm.so*
725064
 /src/prog/disable-paste
725064
 /src/prog/display-buttons
725064
 /src/prog/display-coords
725064
diff --git a/Makefile.in b/Makefile.in
725064
index 5412334..0aa6a78 100644
725064
--- a/Makefile.in
725064
+++ b/Makefile.in
725064
@@ -102,19 +102,24 @@ TAGS:	$(SRCS) $(HDRS) src/prog/gpm-root.y do-TAGS
725064
 
725064
 ### RELEASE STUFF
725064
 TARS  =../gpm-$(release).tar.gz
725064
-TARS +=../gpm-$(release).tar.bz2 ../gpm-$(release).tar.lzma
725064
+TARS +=../gpm-$(release).tar.bz2 ../gpm-$(release).tar.xz
725064
 
725064
 M_HOST=arcana.linux.it
725064
 M_DIR=gpm/
725064
 
725064
 tars: $(TARS)
725064
+	chmod a+r $<
725064
 
725064
 # configure headers, produce new configure script
725064
 distconf: Makefile.in Makefile.include.in configure acinclude.m4 $(versionfiles)
725064
 
725064
 ../gpm-$(release).tar: $(srcdir) distclean distconf
725064
 	# no exclude possible of .git with pax it seems, so the following is not possible:
725064
-	git archive --prefix "gpm-$(release)/" -o $@ HEAD
725064
+	rm -rf "gpm-$(release)/"
725064
+	git archive --prefix "gpm-$(release)/" HEAD | tar xf -
725064
+	cd "gpm-$(release)/" && ./autogen.sh && rm -rf autom4te.cache
725064
+	tar cf $@ "gpm-$(release)/"
725064
+	rm -rf "gpm-$(release)/"
725064
 
725064
 ../gpm-$(release).tar.gz:  ../gpm-$(release).tar
725064
 	gzip -9 -c $< > $@
725064
@@ -122,11 +127,11 @@ distconf: Makefile.in Makefile.include.in configure acinclude.m4 $(versionfiles)
725064
 ../gpm-$(release).tar.bz2:  ../gpm-$(release).tar
725064
 	bzip2 -9 -c $< > $@
725064
 
725064
-../gpm-$(release).tar.lzma:  ../gpm-$(release).tar
725064
-	lzma -9 -c $< > $@
725064
+../gpm-$(release).tar.xz:  ../gpm-$(release).tar
725064
+	xz -9 -c $< > $@
725064
 
725064
 # 3. Put package together into .tar.gz and .tar.bz2
725064
-dist: disttest distclean distconf $(TARS)
725064
+dist: disttest distclean distconf $(TARS) tars
725064
 	scp $(TARS) $(M_HOST):$(M_DIR)
725064
 	mv $(TARS) ~/niconetz/software/gpm/archives
725064
 
725064
diff --git a/configure.ac.footer b/configure.ac.footer
725064
index 89a4cd9..1e5e4da 100644
725064
--- a/configure.ac.footer
725064
+++ b/configure.ac.footer
725064
@@ -124,7 +124,7 @@ No|no|N|n) SHARED_LIBS=-lc ;;
725064
     done
725064
     TERMLIBS=$LIBS
725064
     LIBS=
725064
-    for i in ncurses curses; do
725064
+    for i in ncurses curses ncursesw; do
725064
         if test x$LIBS = x; then
725064
             AC_CHECK_LIB($i, wgetch,,,$TERMLIBS)
725064
         else :; fi
725064
diff --git a/doc/changelog b/doc/changelog
725064
index de64bcf..1581fd1 100644
725064
--- a/doc/changelog
725064
+++ b/doc/changelog
725064
@@ -1,3 +1,7 @@
725064
+1.20.8:
725064
+	* Remove lzma, use xz (Mike Frysinger)
725064
+	* Install shared lib with +x perms (Mike Frysinger)
725064
+
725064
 1.20.7: 2012-10-26
725064
 	* Fix inclusion of unwanted binary data
725064
 	* Even more cleanups (Mike Frysinger)
725064
@@ -5,7 +9,7 @@
725064
 	* Don't build static libgpm by default (Sean McGovern)
725064
 	* autogen.sh is now required to create setup version in autoconf (Nico Schottelius)
725064
 
725064
-1.20.5: 9th of February 2009
725064
+1.20.6: 9th of February 2009
725064
 	* Some cleanups (Mike Frysinger/Nico Schottelius)
725064
 	* Pull in fcntl.h rather than unistd.h for open() (Mike Frysinger)
725064
 	* Fix gcc warning "control reaches end of non-void function" (Mike Frysinger)
725064
diff --git a/doc/doc.gpm.in b/doc/doc.gpm.in
725064
index afd5a29..795b958 100644
725064
--- a/doc/doc.gpm.in
725064
+++ b/doc/doc.gpm.in
725064
@@ -88,7 +88,7 @@ by the Free Software Foundation.
725064
 @subtitle A general purpose mouse server for the Linux console
725064
 @subtitle @value{update-month}
725064
 
725064
-@author by Nico Schottelius <nico@@schottelius.org>
725064
+@author by Nico Schottelius <nico-gpm2008@@schottelius.org>
725064
 
725064
 @end titlepage
725064
 @setchapternewpage off
725064
@@ -525,7 +525,7 @@ security risks when using them.
725064
 Andrew Haylett <ajh@gec-mrc.co.uk> (the original selection code)
725064
 Ian Zimmerman <itz@speakeasy.org> (old maintainer)
725064
 Alessandro Rubini <rubini@linux.it> (old maintainer (still helps a lot))
725064
-Nico Schottelius <nico@schottelius.org> (maintainer)
725064
+Nico Schottelius <nico-gpm2008@schottelius.org> (maintainer)
725064
 
725064
 Many many contributors, to both selection and gpm.
725064
 .fi
725064
diff --git a/src/Makefile.in b/src/Makefile.in
725064
index d3b1dcd..2f92989 100644
725064
--- a/src/Makefile.in
725064
+++ b/src/Makefile.in
725064
@@ -79,7 +79,7 @@ prog/%:	prog/%.o
725064
 #		| $(SED) '\''s/\($*\)\.o\([ :]*\)/\1.o \1.lo\2/g'\'' > $(DEPDIR)/$@'
725064
 
725064
 # Do it all!
725064
-all:	gpm lib/libgpm.so.@abi_lev@ @LIBGPM_A@ $(PROG)
725064
+all:	gpm lib/libgpm.so.@abi_lev@ lib/libgpm.so @LIBGPM_A@ $(PROG)
725064
 
725064
 gpm:	$(GOBJ)
725064
 	$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $(GOBJ) @LIBS@ $(LIBS) -lm
725064
@@ -96,7 +96,7 @@ $(DEPFILE) dep: prog/gpm-root.c
725064
 
725064
 	# create dependencies
725064
 	for DEPS in `echo *.c */*.c`; do \
725064
-	$(CC) -I. -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \
725064
+	$(CC) -I. -I $(srcdir) -I $(srcdir)/headers -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \
725064
 	$(SED) 's/^\(.*\)\.o\([ :]+\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done
725064
 
725064
 ### INSTALL
725064
@@ -113,7 +113,7 @@ install:	check
725064
 	# 2.x goes along; unfortunately that means an additional
725064
 	# headache in cases like this
725064
 	if test "x@SHLIB@" != "x" ; then \
725064
-		$(INSTALL_DATA) -m 644 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@	;	\
725064
+		$(INSTALL_DATA) -m 755 lib/libgpm.so.@abi_full@ $(libdir)/libgpm.so.@abi_full@	;	\
725064
 		cd $(libdir) && $(LN_S) -f libgpm.so.@abi_full@ libgpm.so.@abi_lev@ 					;	\
725064
       echo "WARNING: We installed a lib, you should now call ldconfig" 						; 	\
725064
       echo "f.i.: ldconfig -n -l $(libdir)/libgpm.so.@abi_full@" 								;	\
725064
@@ -168,9 +168,8 @@ lib/libgpm.so.@abi_full@:	$(PICS)
725064
 	@LDFLAGS@ $(LDFLAGS) -o lib/libgpm.so.@abi_full@ $^ @LIBS@ @SHARED_LIBS@ $(LIBS)	
725064
 lib/libgpm.so.@abi_lev@:	lib/libgpm.so.@abi_full@
725064
 	$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so.@abi_lev@
725064
-# unneeded, isn't it?
725064
-#lib/libgpm.so:	lib/libgpm.so.@abi_full@
725064
-#	$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so
725064
+lib/libgpm.so:	lib/libgpm.so.@abi_full@
725064
+	$(LN_S) -f libgpm.so.@abi_full@ lib/libgpm.so
725064
 
725064
 include $(DEPFILE)
725064
 
725064
diff --git a/src/daemon/gpm.c b/src/daemon/gpm.c
725064
index 771da5c..6806dce 100644
725064
--- a/src/daemon/gpm.c
725064
+++ b/src/daemon/gpm.c
725064
@@ -29,7 +29,7 @@
725064
 #include <signal.h>        /* SIGPIPE */
725064
 #include <time.h>          /* time() */
725064
 #include <sys/param.h>
725064
-#include <sys/fcntl.h>     /* O_RDONLY */
725064
+#include <fcntl.h>         /* O_RDONLY */
725064
 #include <sys/wait.h>      /* wait()   */
725064
 #include <sys/stat.h>      /* mkdir()  */
725064
 #include <sys/time.h>      /* timeval */
725064
diff --git a/src/daemon/old_main.c b/src/daemon/old_main.c
725064
index 9cd4e56..ab7a87f 100644
725064
--- a/src/daemon/old_main.c
725064
+++ b/src/daemon/old_main.c
725064
@@ -25,6 +25,7 @@
725064
 #include <signal.h>                 /* guess again       */
725064
 #include <errno.h>                  /* guess again       */
725064
 #include <unistd.h>                 /* unlink            */
725064
+#include <string.h>                 /* strcpy, bzero     */
725064
 #include <sys/stat.h>               /* chmod             */
725064
 
725064
 #include <linux/kd.h>               /* linux hd*         */
725064
@@ -192,10 +193,11 @@ int old_main()
725064
                 * or to the default handler, if any
725064
                 * or to the selection handler
725064
                 */ /* FIXME -- check event.vc */
725064
-               /* can't we please rewrite the following a bit nicer?*/
725064
-               (cinfo[event.vc] && do_client(cinfo[event.vc], &event))
725064
-               || (cinfo[0]        && do_client(cinfo[0],        &event))
725064
-               ||  do_selection(&event);
725064
+               if(!cinfo[event.vc] || !do_client(cinfo[event.vc], &event)) {
725064
+                    if(!cinfo[0] || !do_client(cinfo[0],&event)) {
725064
+                        do_selection(&event);
725064
+                    }
725064
+	       }
725064
             }
725064
       }
725064
 
725064
diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c
725064
index 98297c9..6dd43e6 100644
725064
--- a/src/daemon/open_console.c
725064
+++ b/src/daemon/open_console.c
725064
@@ -21,8 +21,13 @@
725064
 
725064
 #include <fcntl.h>                  /* open and co.      */
725064
 #include <sys/stat.h>               /* stat()            */
725064
+#include <sys/types.h>              /* major()           */
725064
 #include <sys/ioctl.h>              /* ioctl             */
725064
 
725064
+#ifdef HAVE_SYS_SYSMACROS_H
725064
+#include <sys/sysmacros.h>          /* major() w/newer glibc */
725064
+#endif
725064
+
725064
 /* Linux specific (to be outsourced in gpm2 */
725064
 #include <linux/serial.h>           /* for serial console check */
725064
 #include <asm/ioctls.h>            /* for serial console check */
725064
diff --git a/src/daemon/processconn.c b/src/daemon/processconn.c
725064
index a5839a3..e92fa63 100644
725064
--- a/src/daemon/processconn.c
725064
+++ b/src/daemon/processconn.c
725064
@@ -67,7 +67,8 @@ int processConn(int fd)
725064
       return -1;
725064
    }
725064
 
725064
-   if((vc = request->vc) > MAX_VC) {
725064
+   vc = request->vc;
725064
+   if(vc > MAX_VC || vc < 0) {
725064
       gpm_report(GPM_PR_DEBUG, GPM_MESS_REQUEST_ON, vc, MAX_VC);
725064
       free(info);
725064
       close(newfd);
725064
diff --git a/src/headers/daemon.h b/src/headers/daemon.h
725064
index a8936ad..24a1a97 100644
725064
--- a/src/headers/daemon.h
725064
+++ b/src/headers/daemon.h
725064
@@ -180,7 +180,7 @@ extern struct mouse_features  mouse_table[3],
725064
 extern Gpm_Type         mice[];
725064
 extern Gpm_Type         *repeated_type;
725064
 
725064
-time_t                  last_selection_time;
725064
+extern time_t           last_selection_time;
725064
 
725064
 
725064
 
725064
diff --git a/src/headers/gpm.h b/src/headers/gpm.h
725064
index 57dc618..fe52e53 100644
725064
--- a/src/headers/gpm.h
725064
+++ b/src/headers/gpm.h
725064
@@ -280,10 +280,16 @@ int   Gpm_GetSnapshot(Gpm_Event *ePtr);
725064
 char *Gpm_get_console( void );
725064
 int Gpm_x_high_y(int base, int pot_y);
725064
 int Gpm_cnt_digits(int number);
725064
-void gpm_oops(int line, char *file, char *text, ... );
725064
+#ifdef __GNUC__
725064
+__attribute__((__format__(printf, 3, 4)))
725064
+#endif
725064
+void gpm_oops(int line, const char *file, const char *text, ... );
725064
 
725064
 /* report.c / report-lib.c */
725064
-void gpm_report(int line, char *file, int stat, char *text, ... );
725064
+#ifdef __GNUC__
725064
+__attribute__((__format__(printf, 4, 5)))
725064
+#endif
725064
+void gpm_report(int line, const char *file, int stat, const char *text, ... );
725064
 
725064
 #ifdef __cplusplus
725064
   };
725064
diff --git a/src/headers/message.h b/src/headers/message.h
725064
index a0fed0e..4b60291 100644
725064
--- a/src/headers/message.h
725064
+++ b/src/headers/message.h
725064
@@ -226,7 +226,10 @@
725064
 /* #define GPM_MESS_                   "" */
725064
 
725064
 /* functions */
725064
-void gpm_report(int line, char *file, int stat, char *text, ... );
725064
+#ifdef __GNUC__
725064
+__attribute__((__format__(printf, 4, 5)))
725064
+#endif
725064
+void gpm_report(int line, const char *file, int stat, const char *text, ... );
725064
 
725064
 /* rest of wd.h */
725064
 #ifdef HAVE_SYSLOG_H
725064
diff --git a/src/lib/liblow.c b/src/lib/liblow.c
725064
index e789d09..8b40b71 100644
725064
--- a/src/lib/liblow.c
725064
+++ b/src/lib/liblow.c
725064
@@ -29,11 +29,12 @@
725064
 #include <string.h>        /* strncmp */
725064
 #include <unistd.h>        /* select(); */
725064
 #include <errno.h>
725064
+#include <fcntl.h>         /* O_RDONLY */
725064
+
725064
 #include <sys/time.h>      /* timeval */
725064
 #include <sys/types.h>     /* socket() */
725064
 #include <sys/socket.h>    /* socket() */
725064
 #include <sys/un.h>        /* struct sockaddr_un */
725064
-#include <sys/fcntl.h>     /* O_RDONLY */
725064
 #include <sys/stat.h>      /* stat() */
725064
 
725064
 #ifdef  SIGTSTP         /* true if BSD system */
725064
@@ -173,7 +174,7 @@ static void gpm_suspend_hook (int signum)
725064
   /* Reincarnation. Prepare for another death early. */
725064
   sigemptyset(&sa.sa_mask);
725064
   sa.sa_handler = gpm_suspend_hook;
725064
-  sa.sa_flags = SA_NOMASK;
725064
+  sa.sa_flags = SA_NODEFER;
725064
   sigaction (SIGTSTP, &sa, 0);
725064
 
725064
   /* Pop the gpm stack by closing the useless connection */
725064
@@ -364,7 +365,7 @@ int Gpm_Open(Gpm_Connect *conn, int flag)
725064
 
725064
          /* if signal was originally ignored, job control is not supported */
725064
          if (gpm_saved_suspend_hook.sa_handler != SIG_IGN) {
725064
-            sa.sa_flags = SA_NOMASK;
725064
+            sa.sa_flags = SA_NODEFER;
725064
             sa.sa_handler = gpm_suspend_hook;
725064
             sigaction(SIGTSTP, &sa, 0);
725064
          }
725064
diff --git a/src/lib/report-lib.c b/src/lib/report-lib.c
725064
index c0ae086..03230b4 100644
725064
--- a/src/lib/report-lib.c
725064
+++ b/src/lib/report-lib.c
725064
@@ -24,9 +24,9 @@
725064
 
725064
 #include "headers/message.h"
725064
 
725064
-void gpm_report(int line, char *file, int stat, char *text, ... )
725064
+void gpm_report(int line, const char *file, int stat, const char *text, ... )
725064
 {
725064
-   char *string = NULL;
725064
+   const char *string = NULL;
725064
    int log_level;
725064
    va_list ap;
725064
 
725064
@@ -47,7 +47,7 @@ void gpm_report(int line, char *file, int stat, char *text, ... )
725064
                            log_level = LOG_CRIT; break;
725064
    }
725064
 #ifdef HAVE_VSYSLOG
725064
-   syslog(log_level, string);
725064
+   syslog(log_level, "%s", string);
725064
    vsyslog(log_level, text, ap);
725064
 #else
725064
    fprintf(stderr,"%s[%s(%d)]:\n",string,file,line);
725064
diff --git a/src/prog/display-buttons.c b/src/prog/display-buttons.c
725064
index de8e5b2..38d2f11 100644
725064
--- a/src/prog/display-buttons.c
725064
+++ b/src/prog/display-buttons.c
725064
@@ -36,6 +36,7 @@
725064
 #include <stdio.h>            /* printf()             */
725064
 #include <time.h>             /* time()               */
725064
 #include <errno.h>            /* errno                */
725064
+#include <sys/select.h>       /* fd_set and FD_*      */
725064
 #include <gpm.h>              /* gpm information      */
725064
 
725064
 /* display resulting data */
725064
diff --git a/src/prog/display-coords.c b/src/prog/display-coords.c
725064
index ed15c8a..82afd12 100644
725064
--- a/src/prog/display-coords.c
725064
+++ b/src/prog/display-coords.c
725064
@@ -33,10 +33,12 @@
725064
  */
725064
 
725064
 #include <unistd.h>           /* write, read, open    */
725064
+#include <stdint.h>
725064
 #include <stdlib.h>           /* strtol()             */
725064
 #include <stdio.h>            /* printf()             */
725064
 #include <time.h>             /* time()               */
725064
 #include <errno.h>            /* errno                */
725064
+#include <sys/select.h>       /* fd_set and FD_*      */
725064
 #include <gpm.h>              /* gpm information      */
725064
 
725064
 /* display resulting data */
725064
@@ -50,7 +52,7 @@ int display_data(Gpm_Event *event, void *data)
725064
    last  = now;
725064
 
725064
    /* display time, delta time */
725064
-   printf("[%d] delta: %ds",now,delta);
725064
+   printf("[%jd] delta: %ds",(intmax_t)now,delta);
725064
    
725064
    /* display mouse information */
725064
    printf(": x=%2i, y=%2i, dx=%2i, dy=%2i\n", event->x, event->y, event->dx, event->dy);
725064
diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y
725064
index 069d801..76c896c 100644
725064
--- a/src/prog/gpm-root.y
725064
+++ b/src/prog/gpm-root.y
725064
@@ -443,6 +443,7 @@ void f__fix(struct passwd *pass)
725064
 }
725064
 
725064
 /*---------------------------------------------------------------------*/
725064
+#if 0
725064
 static int f_debug_one(FILE *f, Draw *draw)
725064
 {
725064
    DrawItem *ip;
725064
@@ -465,6 +466,7 @@ static int f_debug_one(FILE *f, Draw *draw)
725064
 #undef LINE
725064
    return 0;
725064
 }
725064
+#endif
725064
 
725064
 int f_debug(int mode, DrawItem *self, int uid)
725064
 {
725064
@@ -960,10 +962,8 @@ static inline void scr_dump(int fd, FILE *f, unsigned char *buffer, int vc)
725064
 /*------------*/
725064
 static inline void scr_restore(int fd, FILE *f, unsigned char *buffer, int vc)
725064
 {
725064
-   int x,y, dumpfd;
725064
+   int dumpfd;
725064
    char dumpname[20];
725064
-
725064
-   x=buffer[2]; y=buffer[3];
725064
    
725064
    /* WILL NOT WORK WITH DEVFS! FIXME! */
725064
    sprintf(dumpname,"/dev/vcsa%i",vc);
725064
@@ -1196,12 +1196,8 @@ int main(int argc, char **argv)
725064
                                                         LOG_DAEMON : LOG_USER);
725064
    /* reap your zombies */
725064
    childaction.sa_handler=reap_children;
725064
-#if defined(__GLIBC__)
725064
-   __sigemptyset(&childaction.sa_mask);
725064
-#else /* __GLIBC__ */
725064
-   childaction.sa_mask=0;
725064
-#endif /* __GLIBC__ */
725064
-   childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
725064
+   sigemptyset(&childaction.sa_mask);
725064
+   childaction.sa_flags=0;
725064
    sigaction(SIGCHLD,&childaction,NULL);
725064
 
725064
    /*....................................... Connect and get your buffer */
725064
diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c
725064
index 0bb1982..d7d1027 100644
725064
--- a/src/prog/mouse-test.c
725064
+++ b/src/prog/mouse-test.c
725064
@@ -182,14 +182,14 @@ Gpm_Type *(*I_serial)(int fd, unsigned short flags, struct Gpm_Type *type,
725064
 /*----------------------------------------------------------------------------- 
725064
    Place the description here.
725064
  -----------------------------------------------------------------------------*/
725064
-int mousereopen(int oldfd, char *name, Gpm_Type *type)
725064
+int mousereopen(int oldfd, const char *name, Gpm_Type *type)
725064
 {
725064
    int fd;
725064
    if (!type) type=mice+1; /* ms */
725064
    close(oldfd);
725064
    usleep(100000);
725064
    fd=open(name,O_RDWR);
725064
-   if (fd < 0) gpm_report(GPM_PR_OOPS,name);
725064
+   if (fd < 0) gpm_report(GPM_PR_OOPS, "%s", name);
725064
    (*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */
725064
    return fd;
725064
 }
725064
diff --git a/src/report.c b/src/report.c
725064
index 6c7c2ee..286c1b7 100644
725064
--- a/src/report.c
725064
+++ b/src/report.c
725064
@@ -69,7 +69,7 @@
725064
  *
725064
  */
725064
 
725064
-void gpm_report(int line, char *file, int stat, char *text, ... )
725064
+void gpm_report(int line, const char *file, int stat, const char *text, ...)
725064
 {
725064
    FILE *console = NULL;
725064
    va_list ap, ap3;
725064
diff --git a/src/synaptics.c b/src/synaptics.c
725064
index 2418c75..a978ef0 100644
725064
--- a/src/synaptics.c
725064
+++ b/src/synaptics.c
725064
@@ -214,6 +214,7 @@
725064
 #include <stdlib.h>
725064
 #include <unistd.h>
725064
 #include <string.h>
725064
+#include <limits.h>
725064
 #include <sys/time.h>
725064
 #include <sys/ioctl.h>
725064
 
725064
@@ -2241,8 +2242,7 @@ static void syn_process_config (info_type ident,
725064
 
725064
 
725064
 
725064
-static unsigned char tp_hextoint (unsigned char byte1,
725064
-				  unsigned char byte2) 
725064
+static unsigned char tp_hextoint (unsigned byte1,unsigned byte2) 
725064
 {
725064
   unsigned char bytes [3];
725064
   int result;
725064
@@ -2250,7 +2250,7 @@ static unsigned char tp_hextoint (unsigned char byte1,
725064
   bytes [0] = byte1;
725064
   bytes [1] = byte2;
725064
   bytes [2] = '\0';
725064
-  sscanf (bytes, "%x", &result);
725064
+  sscanf ((char *)bytes, "%x", &result);
725064
   return result;
725064
 }
725064
 
725064
@@ -2311,8 +2311,7 @@ static void tp_serial_read (int fd,
725064
 }
725064
 
725064
 /* Write a string of commands */
725064
-static void tp_serial_send_cmd(int fd,
725064
-			       unsigned char *cmd) 
725064
+static void tp_serial_send_cmd(int fd, const char *cmd) 
725064
 {
725064
   unsigned char junk [15];
725064
 
725064
@@ -2329,7 +2328,7 @@ static void tp_serial_send_cmd(int fd,
725064
 static void syn_serial_set_mode (int fd,
725064
 				 unsigned char mode) 
725064
 {
725064
-  unsigned char bytes [15];
725064
+  char bytes [15];
725064
 
725064
   sprintf (bytes, "%%C3B%02X5555", mode);
725064
 #if DEBUG_SENT_DATA
725064
diff --git a/src/twiddler.c b/src/twiddler.c
725064
index 1d2bd50..972a616 100644
725064
--- a/src/twiddler.c
725064
+++ b/src/twiddler.c
725064
@@ -250,7 +250,6 @@ static inline int twiddler_use_item(char *item)
725064
 int twiddler_key(unsigned long message)
725064
 {
725064
    char **table = twiddler_get_table(message);
725064
-   char *val;
725064
   /*
725064
    * These two are needed to avoid transmitting single keys when typing
725064
    * chords. When the number of keys being held down decreases, data
725064
@@ -269,7 +268,6 @@ int twiddler_key(unsigned long message)
725064
 
725064
    if (!table) return 0;
725064
    message &= 0xff;
725064
-   val = table[message];
725064
 
725064
    if ((message < last_message) && !marked) { /* ok, do it */
725064
       marked++; /* don't retransmit on release */
725064
@@ -428,8 +426,11 @@ char *twiddler_rest_to_value(char *s)
725064
       buf[ibuf]='\0';
725064
       return strdup(buf);
725064
    }
725064
-   if (*ptr == '\\')
725064
-      return (char *)twiddler_escape_sequence(ptr+1, &len /* unused */);
725064
+   if (*ptr == '\\') {
725064
+      buf[ibuf++] = twiddler_escape_sequence(ptr+1, &len /* unused */);
725064
+      buf[ibuf] = '\0';
725064
+      return strdup(buf);
725064
+   }
725064
 
725064
    if (strlen(ptr)==1) return ((char *)((unsigned long)*ptr & 0xFF));
725064