# Patches inspired from Debian's maintainer:
#   - enabling of shared libarary build
#   - rename of config.h to gsm_config.h
#   - compile warning fixes
#   - man page fixes
diff -urNad gsm-1.0-pl13-orig/Makefile gsm-1.0-pl13/Makefile
--- gsm-1.0-pl13-orig/Makefile	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/Makefile	2015-05-17 12:49:18.000000000 +0300
@@ -44,7 +44,7 @@
 # CCFLAGS 	= -c -O
 
 CC		= gcc -ansi -pedantic
-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1
+CCFLAGS 	= -O2 -DNeedFunctionPrototypes=1 $(MYCFLAGS)
 
 LD 		= $(CC)
 
@@ -96,11 +96,11 @@
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
-RMFLAGS		=
+RMFLAGS		= -f
 FIND		= find
 COMPRESS 	= compress
 COMPRESSFLAGS 	= 
@@ -140,6 +140,7 @@
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO= $(LIB)/libgsm.so
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -151,7 +152,7 @@
 
 HEADERS	=	$(INC)/proto.h		\
 		$(INC)/unproto.h	\
-		$(INC)/config.h		\
+		$(INC)/gsm_config.h	\
 		$(INC)/private.h	\
 		$(INC)/gsm.h		\
 		$(INC)/toast.h		\
@@ -258,6 +259,7 @@
 
 GSM_INSTALL_TARGETS =	\
 		$(GSM_INSTALL_LIB)/libgsm.a		\
+		$(GSM_INSTALL_LIB)/libgsm.so.1.0.13	\
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
@@ -274,12 +276,12 @@
 # Default rules
 
 .c.o:
-		$(CC) $(CFLAGS) $?
+		$(CC) -c -fPIC $(CFLAGS) $?
 		@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,7 +301,12 @@
 
 # The basic API: libgsm
 
-$(LIBGSM):	$(LIB) $(GSM_OBJECTS)
+$(LIBGSMSO):	$(GSM_OBJECTS)
+		$(LD) -shared -Wl,-soname,libgsm.so.1 -o $@.1.0.13 $(GSM_OBJECTS) -lc
+		$(LN) libgsm.so.1.0.13 $@.1
+		$(LN) libgsm.so.1.0.13 $@
+
+$(LIBGSM):	$(GSM_OBJECTS)
 		-rm $(RMFLAGS) $(LIBGSM)
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
 		$(RANLIB) $(LIBGSM)
@@ -307,23 +314,22 @@
 
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
-$(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+$(TOAST):	$(TOAST_OBJECTS) $(LIBGSM)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
 
-$(UNTOAST):	$(BIN) $(TOAST)
+$(UNTOAST):	$(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
-		$(LN) $(TOAST) $(UNTOAST)
+		$(LN) toast $(UNTOAST)
 
-$(TCAT):	$(BIN) $(TOAST)
+$(TCAT):	$(TOAST)
 		-rm $(RMFLAGS) $(TCAT)
-		$(LN) $(TOAST) $(TCAT)
+		$(LN) toast $(TCAT)
 
 
 # The local bin and lib directories
 
 $(BIN):
 		if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
-
 $(LIB):
 		if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
 
@@ -351,53 +357,55 @@
 		fi
 
 $(TOAST_INSTALL_BIN)/toast:	$(TOAST)
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $(TOAST) $@
 		chmod 755 $@
 
 $(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
-		-rm $@
+		-rm $(RMFLAGS) $@
 		ln $? $@
 
 $(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTALL_BIN)/toast
-		-rm $@
+		-rm $(RMFLAGS) $@
 		ln $? $@
 
 $(TOAST_INSTALL_MAN)/toast.1:	$(MAN)/toast.1
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm.3:	$(MAN)/gsm.3
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_option.3:	$(MAN)/gsm_option.3
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_explode.3:	$(MAN)/gsm_explode.3
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_MAN)/gsm_print.3:	$(MAN)/gsm_print.3
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_INC)/gsm.h:	$(INC)/gsm.h
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
 $(GSM_INSTALL_LIB)/libgsm.a:	$(LIBGSM)
-		-rm $@
+		-rm $(RMFLAGS) $@
 		cp $? $@
 		chmod 444 $@
 
+$(GSM_INSTALL_LIB)/libgsm.so.1.0.13: $(LIBGSMSO)
+		install -m 755 $(LIBGSMSO).1.0.13 $@
 
 # Distribution
 
@@ -426,7 +434,9 @@
 
 clean:	semi-clean
 		-rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add		\
-			$(TOAST) $(TCAT) $(UNTOAST)	\
+			$(LIBGSMSO) $(LIB)/libgsm.so.1.0.13	\
+			$(LIB)libgsm.so.1			\
+			$(TOAST) $(TCAT) $(UNTOAST)		\
 			$(ROOT)/gsm-1.0.tar.Z
 
 
diff -urNad gsm-1.0-pl13-orig/inc/config.h gsm-1.0-pl13/inc/config.h
--- gsm-1.0-pl13-orig/inc/config.h	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/inc/config.h	1970-01-01 02:00:00.000000000 +0200
@@ -1,37 +0,0 @@
-/*
- * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
- * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
- * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
- */
-
-/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/config.h,v 1.5 1996/07/02 11:26:20 jutta Exp $*/
-
-#ifndef	CONFIG_H
-#define	CONFIG_H
-
-/*efine	SIGHANDLER_T	int 		/* signal handlers are void	*/
-/*efine HAS_SYSV_SIGNAL	1		/* sigs not blocked/reset?	*/
-
-#define	HAS_STDLIB_H	1		/* /usr/include/stdlib.h	*/
-#define	HAS_LIMITS_H	1		/* /usr/include/limits.h	*/
-#define	HAS_FCNTL_H	1		/* /usr/include/fcntl.h		*/
-#define	HAS_ERRNO_DECL	1		/* errno.h declares errno	*/
-
-#define	HAS_FSTAT 	1		/* fstat syscall		*/
-#define	HAS_FCHMOD 	1		/* fchmod syscall		*/
-#define	HAS_CHMOD 	1		/* chmod syscall		*/
-#define	HAS_FCHOWN 	1		/* fchown syscall		*/
-#define	HAS_CHOWN 	1		/* chown syscall		*/
-/*efine	HAS__FSETMODE 	1		/* _fsetmode -- set file mode	*/
-
-#define	HAS_STRING_H 	1		/* /usr/include/string.h 	*/
-/*efine	HAS_STRINGS_H	1		/* /usr/include/strings.h 	*/
-
-#define	HAS_UNISTD_H	1		/* /usr/include/unistd.h	*/
-#define	HAS_UTIME	1		/* POSIX utime(path, times)	*/
-/*efine	HAS_UTIMES	1		/* use utimes()	syscall instead	*/
-#define	HAS_UTIME_H	1		/* UTIME header file		*/
-#define	HAS_UTIMBUF	1		/* struct utimbuf		*/
-/*efine	HAS_UTIMEUSEC   1		/* microseconds in utimbuf?	*/
-
-#endif	/* CONFIG_H */
diff -urNad gsm-1.0-pl13-orig/inc/gsm.h gsm-1.0-pl13/inc/gsm.h
--- gsm-1.0-pl13-orig/inc/gsm.h	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/inc/gsm.h	2015-05-17 12:43:53.000000000 +0300
@@ -54,6 +54,10 @@
 #define	GSM_OPT_FRAME_INDEX	5
 #define	GSM_OPT_FRAME_CHAIN	6
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern gsm  gsm_create 	GSM_P((void));
 extern void gsm_destroy GSM_P((gsm));	
 
@@ -66,6 +70,10 @@
 extern int  gsm_explode GSM_P((gsm, gsm_byte   *, gsm_signal *));
 extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte   *));
 
+#ifdef __cplusplus
+}
+#endif
+
 #undef	GSM_P
 
 #endif	/* GSM_H */
diff -urNad gsm-1.0-pl13-orig/inc/gsm_config.h gsm-1.0-pl13/inc/gsm_config.h
--- gsm-1.0-pl13-orig/inc/gsm_config.h	1970-01-01 02:00:00.000000000 +0200
+++ gsm-1.0-pl13/inc/gsm_config.h	2015-05-17 12:43:53.000000000 +0300
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
+ * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/config.h,v 1.5 1996/07/02 11:26:20 jutta Exp $*/
+
+#ifndef	CONFIG_H
+#define	CONFIG_H
+
+/*efine	SIGHANDLER_T	int 		/* signal handlers are void	*/
+/*efine HAS_SYSV_SIGNAL	1		/* sigs not blocked/reset?	*/
+
+#define	HAS_STDLIB_H	1		/* /usr/include/stdlib.h	*/
+#define	HAS_LIMITS_H	1		/* /usr/include/limits.h	*/
+#define	HAS_FCNTL_H	1		/* /usr/include/fcntl.h		*/
+#define	HAS_ERRNO_DECL	1		/* errno.h declares errno	*/
+
+#define	HAS_FSTAT 	1		/* fstat syscall		*/
+#define	HAS_FCHMOD 	1		/* fchmod syscall		*/
+#define	HAS_CHMOD 	1		/* chmod syscall		*/
+#define	HAS_FCHOWN 	1		/* fchown syscall		*/
+#define	HAS_CHOWN 	1		/* chown syscall		*/
+/*efine	HAS__FSETMODE 	1		/* _fsetmode -- set file mode	*/
+
+#define	HAS_STRING_H 	1		/* /usr/include/string.h 	*/
+/*efine	HAS_STRINGS_H	1		/* /usr/include/strings.h 	*/
+
+#define	HAS_UNISTD_H	1		/* /usr/include/unistd.h	*/
+#define	HAS_UTIME	1		/* POSIX utime(path, times)	*/
+/*efine	HAS_UTIMES	1		/* use utimes()	syscall instead	*/
+#define	HAS_UTIME_H	1		/* UTIME header file		*/
+#define	HAS_UTIMBUF	1		/* struct utimbuf		*/
+/*efine	HAS_UTIMEUSEC   1		/* microseconds in utimbuf?	*/
+
+#endif	/* CONFIG_H */
diff -urNad gsm-1.0-pl13-orig/inc/toast.h gsm-1.0-pl13/inc/toast.h
--- gsm-1.0-pl13-orig/inc/toast.h	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/inc/toast.h	2015-05-17 12:43:53.000000000 +0300
@@ -9,18 +9,19 @@
 #ifndef	TOAST_H
 #define	TOAST_H				/* Guard against multiple includes */
 
-#include "config.h"
+#include "gsm_config.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include <stdio.h>
 #include <ctype.h>
+#include <pthread.h>
 #include <signal.h>
 
 #include <errno.h>
-#ifndef	HAS_ERRNO_DECL
-	 extern int	errno;
+#ifndef errno
+extern int errno;
 #endif
 
 #ifdef	HAS_LIMITS_H
@@ -37,6 +38,10 @@
 # endif
 #endif
 
+#ifdef  HAS_STDIO_H
+#include <stdio.h>
+#endif
+
 #include "gsm.h"
 
 #ifndef	S_ISREG
diff -urNad gsm-1.0-pl13-orig/man/gsm.3 gsm-1.0-pl13/man/gsm.3
--- gsm-1.0-pl13-orig/man/gsm.3	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/man/gsm.3	2015-05-17 12:43:53.000000000 +0300
@@ -3,7 +3,6 @@
 .\" Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
 .\" details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
 .\"
-.PU
 .TH GSM 3 
 .SH NAME
 gsm_create, gsm_destroy, gsm_encode, gsm_decode \(em GSM\ 06.10 lossy sound compression
diff -urNad gsm-1.0-pl13-orig/man/gsm_explode.3 gsm-1.0-pl13/man/gsm_explode.3
--- gsm-1.0-pl13-orig/man/gsm_explode.3	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/man/gsm_explode.3	2015-05-17 12:43:53.000000000 +0300
@@ -3,7 +3,6 @@
 .\" Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
 .\" details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
 .\"
-.PU
 .TH GSM_EXPLODE 3 
 .SH NAME
 gsm_explode, gsm_implode \(em GSM\ 06.10 supplementary
diff -urNad gsm-1.0-pl13-orig/man/gsm_option.3 gsm-1.0-pl13/man/gsm_option.3
--- gsm-1.0-pl13-orig/man/gsm_option.3	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/man/gsm_option.3	2015-05-17 12:43:54.000000000 +0300
@@ -3,7 +3,6 @@
 .\" Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
 .\" details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
 .\"
-.PU
 .TH GSM_OPTION 3 
 .SH NAME
 gsm_option \(em customizing the GSM 06.10 implementation
@@ -39,19 +38,19 @@
 .I GSM_OPT_VERBOSE
 Verbosity level.
 .br
-.in+5
+.RS
 This option is only supported if the library was compiled
 with debugging turned on, and may be used by developers of
 compression algorithms to aid debugging.
 .br
 The verbosity level can be changed at any time during encoding or decoding.
-.in-5
+.RE
 .sp
 .PP
 .I GSM_OPT_FAST
 Faster compression algorithm.
 .br
-.in+5
+.RS
 This implementation offers a not strictly standard-compliant, but
 faster compression algorithm that is compatible with the regular
 method and does not noticably degrade audio quality.
@@ -70,14 +69,12 @@
 to set or query it.
 .br
 This option can be set any time during encoding or decoding.
-.in-5
-.ne 5
 .sp
 .PP
 .I GSM_OPT_LTP_CUT
 Enable, disable, or query the LTP cut-off optimization.
 .br
-.in+5
+.RS
 During encoding, the search for the long-term correlation
 lag forms the bottleneck of the algorithm. 
 The ltp-cut option enables an approximation that disregards most
@@ -100,7 +97,7 @@
 .I GSM_OPT_WAV49
 WAV-style byte ordering.
 .br
-.in+5
+.RS
 A WAV file of type #49 contains GSM 06.10-encoded frames.
 Unfortunately, the framing and code ordering of the WAV version
 are incompatible with the native ones of this GSM 06.10 library.
@@ -131,12 +128,13 @@
 .br
 Thanks to Jeff Chilton for the detective work and first free
 implementation of this version of the GSM 06.10 encoding.
+.RE
 .sp
 .PP
 .I GSM_OPT_FRAME_CHAIN
 Query or set the chaining byte.
 .br
-.in+5
+.RS
 Between the two frames of a WAV-style encoding, the GSM 06.10 library
 must keep track of one half-byte that is technically part of the first
 frame, but will be written as the first four bits of the second.
@@ -148,13 +146,14 @@
 .fi
 .br 
 This option can be queried and set at any time.
+.RE
 .sp
 .PP
 .I GSM_OPT_FRAME_INDEX
 Query or set the current frame's index in a format's
 alternating list of frames.
 .br
-.in+5
+.RS
 The WAV #49 framing uses two alternating types of frames.
 Which type the next GSM-coded frame belongs to can be queried, or,
 when decoding, announced, using
@@ -173,7 +172,7 @@
 option, it can be used to position on arbitrary GSM frames
 within a format like WAV #49 (not accounting for the lost
 internal GSM state).
-.in-5
+.RE
 .SH "RETURN VALUE"
 gsm_option() returns -1 if an option is not supported, the
 previous value of the option otherwise.
diff -urNad gsm-1.0-pl13-orig/man/gsm_print.3 gsm-1.0-pl13/man/gsm_print.3
--- gsm-1.0-pl13-orig/man/gsm_print.3	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/man/gsm_print.3	2015-05-17 12:43:54.000000000 +0300
@@ -3,7 +3,6 @@
 .\" Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
 .\" details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
 .\"
-.PU
 .TH GSM_PRINT 3 
 .SH NAME
 gsm_print \(em GSM\ 06.10 supplementary function for debugging
diff -urNad gsm-1.0-pl13-orig/src/code.c gsm-1.0-pl13/src/code.c
--- gsm-1.0-pl13-orig/src/code.c	2006-04-26 22:16:50.000000000 +0300
+++ gsm-1.0-pl13/src/code.c	2015-05-17 12:43:54.000000000 +0300
@@ -6,11 +6,11 @@
 
 /* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/code.c,v 1.3 1996/07/02 09:59:05 jutta Exp $ */
 
-#include	"config.h"
+#include	"gsm_config.h"
 
 
-#ifdef	HAS_STDLIB_H
-#include	<stdlib.h>
+#ifdef	HAS_STRING_H
+#include	<string.h>
 #else
 #	include "proto.h"
 	extern char	* memcpy P((char *, char *, int));
diff -urNad gsm-1.0-pl13-orig/src/debug.c gsm-1.0-pl13/src/debug.c
--- gsm-1.0-pl13-orig/src/debug.c	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/src/debug.c	2015-05-17 12:43:54.000000000 +0300
@@ -49,7 +49,7 @@
 	fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
 	while (from <= to) {
 
-		fprintf(stderr, "%d ", ptr[ from ] );
+		fprintf(stderr, "%ld ", ptr[ from ] );
 		from++;
 		if (nprinted++ >= 7) {
 			nprinted = 0;
@@ -63,14 +63,14 @@
 	char		* name,
 	longword	  value	)
 {
-	fprintf(stderr, "%s: %d\n", name, (long)value );
+	fprintf(stderr, "%s: %ld\n", name, (long)value );
 }
 
 void gsm_debug_word P2(  (name, value),
 	char	* name,
 	word	  value	)
 {
-	fprintf(stderr, "%s: %d\n", name, (long)value);
+	fprintf(stderr, "%s: %ld\n", name, (long)value);
 }
 
 #endif
diff -urNad gsm-1.0-pl13-orig/src/gsm_create.c gsm-1.0-pl13/src/gsm_create.c
--- gsm-1.0-pl13-orig/src/gsm_create.c	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/src/gsm_create.c	2015-05-17 12:43:54.000000000 +0300
@@ -6,7 +6,7 @@
 
 static char const	ident[] = "$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_create.c,v 1.4 1996/07/02 09:59:05 jutta Exp $";
 
-#include	"config.h"
+#include	"gsm_config.h"
 
 #ifdef	HAS_STRING_H
 #include	<string.h>
diff -urNad gsm-1.0-pl13-orig/src/gsm_destroy.c gsm-1.0-pl13/src/gsm_destroy.c
--- gsm-1.0-pl13-orig/src/gsm_destroy.c	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/src/gsm_destroy.c	2015-05-17 12:43:54.000000000 +0300
@@ -7,7 +7,7 @@
 /* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_destroy.c,v 1.3 1994/11/28 19:52:25 jutta Exp $ */
 
 #include "gsm.h"
-#include "config.h"
+#include "gsm_config.h"
 #include "proto.h"
 
 #ifdef	HAS_STDLIB_H
diff -urNad gsm-1.0-pl13-orig/src/toast.c gsm-1.0-pl13/src/toast.c
--- gsm-1.0-pl13-orig/src/toast.c	2006-04-26 22:14:26.000000000 +0300
+++ gsm-1.0-pl13/src/toast.c	2015-05-17 12:43:54.000000000 +0300
@@ -251,8 +251,8 @@
 {
 	char * s;
 	if (!(s = malloc(len))) {
-		fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
-			progname, len);
+		fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
+			progname, (long) len);
 		onintr();
 		exit(1);
 	}
@@ -270,7 +270,7 @@
 	maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
 	p = strcpy(emalloc(maxlen), name);
 
-	if (s = suffix(p, cut)) strcpy(s, want);
+	if ((s = suffix(p, cut))) strcpy(s, want);
 	else if (*want && !suffix(p, want)) strcat(p, want);
 
 	return p;
@@ -386,7 +386,7 @@
 		ut[0] = instat.st_atime;
 		ut[1] = instat.st_mtime;
 
-		(void) utime(outname, ut);
+		(void) utime(outname, (struct utimbuf *)ut);
 
 #endif	/* UTIMBUF */
 	}
@@ -416,7 +416,7 @@
 	}
 	if (st->st_nlink > 1 && !f_cat && !f_precious) {
 		fprintf(stderr, 
-		      "%s: \"%s\" has %s other link%s -- unchanged.\n",
+		      "%s: \"%s\" has %d other link%s -- unchanged.\n",
 			progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
 		return 0;
 	}
@@ -585,7 +585,7 @@
 
 		if (cc != sizeof(s)) {
 			if (cc >= 0) fprintf(stderr,
-			"%s: incomplete frame (%d byte%s missing) from %s\n",
+			"%s: incomplete frame (%ld byte%s missing) from %s\n",
 					progname, sizeof(s) - cc,
 					"s" + (sizeof(s) - cc == 1),
 					inname ? inname : "stdin" );
@@ -624,8 +624,6 @@
 
 static int process P1((name), char * name)
 {
-	int step = 0;
-
 	out     = (FILE *)0;
 	in      = (FILE *)0;
 
@@ -779,7 +777,6 @@
 	case 'h': help();    exit(0);
 
 	default: 
-	usage:
 		fprintf(stderr,
 	"Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
 			progname);
diff -urNad gsm-1.0-pl13-orig/tls/taste.c gsm-1.0-pl13/tls/taste.c
--- gsm-1.0-pl13-orig/tls/taste.c	2006-04-26 22:14:25.000000000 +0300
+++ gsm-1.0-pl13/tls/taste.c	2015-05-17 12:43:54.000000000 +0300
@@ -10,7 +10,7 @@
 #include	<string.h>
 #include	<memory.h>
 
-#include	"config.h"
+#include	"gsm_config.h"
 
 #ifdef	HAS_STDLIB_H
 #	include	<stdlib.h>
