aboutsummaryrefslogtreecommitdiff
path: root/comms/hamlib
diff options
context:
space:
mode:
authorMarcus Alves Grando <mnag@FreeBSD.org>2006-05-01 03:31:17 +0000
committerMarcus Alves Grando <mnag@FreeBSD.org>2006-05-01 03:31:17 +0000
commitf97b4df6a992d3f29b089f52b26bdbf13cce74e6 (patch)
tree1df222a0286df9f11ef205b2502ab4a734a5c0c9 /comms/hamlib
parent000390ed4ab0465bda01f64021e88de1f2a48cd3 (diff)
downloadports-f97b4df6a992d3f29b089f52b26bdbf13cce74e6.tar.gz
ports-f97b4df6a992d3f29b089f52b26bdbf13cce74e6.zip
Notes
Diffstat (limited to 'comms/hamlib')
-rw-r--r--comms/hamlib/Makefile83
-rw-r--r--comms/hamlib/distinfo6
-rw-r--r--comms/hamlib/files/patch-bindings_Makefile.in79
-rw-r--r--comms/hamlib/files/patch-configure.ac35
-rw-r--r--comms/hamlib/files/patch-include-config.h.in19
-rw-r--r--comms/hamlib/files/patch-kenwood__kenwood.c318
-rw-r--r--comms/hamlib/files/patch-kenwood__th.c287
-rw-r--r--comms/hamlib/files/patch-kenwood__thg71.c62
-rw-r--r--comms/hamlib/files/patch-kenwood__tmv7.c85
-rw-r--r--comms/hamlib/files/patch-kenwood__ts140.c107
-rw-r--r--comms/hamlib/files/patch-kenwood__ts2000.c12
-rw-r--r--comms/hamlib/files/patch-kenwood__ts450s.c42
-rw-r--r--comms/hamlib/files/patch-kenwood__ts480.c68
-rw-r--r--comms/hamlib/files/patch-kenwood__ts570.c42
-rw-r--r--comms/hamlib/files/patch-kenwood__ts680.c105
-rw-r--r--comms/hamlib/files/patch-kenwood__ts850.c122
-rw-r--r--comms/hamlib/files/patch-kenwood__ts870s.c192
-rw-r--r--comms/hamlib/files/patch-yaesu__ft817.c11
-rw-r--r--comms/hamlib/pkg-plist35
19 files changed, 1640 insertions, 70 deletions
diff --git a/comms/hamlib/Makefile b/comms/hamlib/Makefile
index 4bd43f9560ee..3da0f1d386a3 100644
--- a/comms/hamlib/Makefile
+++ b/comms/hamlib/Makefile
@@ -6,93 +6,96 @@
#
PORTNAME= hamlib
-PORTVERSION= 1.2.2
+PORTVERSION= 1.2.5
CATEGORIES= comms hamradio
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
DISTNAME= ${PORTNAME}-${PORTVERSION}
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= db@db.net
COMMENT= Shared libraries for Amateur Radio Equipment Control Applications
-USE_PERL5= yes
-GNU_CONFIGURE= yes
+BUILD_DEPENDS= swig:${PORTSDIR}/devel/swig13
+
USE_GNOME= pkgconfig gnomehack
+USE_GETOPT_LONG= yes
+USE_PERL5= yes
+USE_PYTHON= yes
+USE_AUTOTOOLS= autoconf:259 libtool:15
INSTALLS_SHLIB= yes
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" LIBS="-L${LOCALBASE}/lib"
+CONFIGURE_ARGS= --with-perl-binding --with-python=${PYTHON_CMD}
+PLIST_SUB= VER=${PORTVERSION}
MAN1= rigctl.1 rigmem.1 rigswr.1 rotctl.1
MAN8= rpc.rigd.8 rpc.rotd.8
-.if defined(WITH_PYTHON)
-USE_PYTHON= yes
-.endif
+OPTIONS = PYTHON "Define if you want PYTHON bindings" OFF \
+ TCL "Define if you want TCL bindings" OFF \
+ XML "Define if you want XML" OFF \
+ RIGMATRIX "Define if you want rigmatrix support" OFF
.include <bsd.port.pre.mk>
+.if ${PERL_LEVEL} < 500600
+IGNORE= required Perl 5.6 or newer. Install lang/perl5.8 or lang/perl5 and try again
+.endif
+
.if defined(WITH_XML)
-USE_GNOME+= libxml2
-PLIST_SUB+= XML=""
+USE_GNOME+= libxml2
+PLIST_SUB+= XML=""
.else
CONFIGURE_ARGS+= --disable-xmltest
-PLIST_SUB+= XML="@comment "
+PLIST_SUB+= XML="@comment "
.endif
.if defined(WITH_TCL)
-LIB_DEPENDS+= tcl84.1:${PORTSDIR}/lang/tcl84
+LIB_DEPENDS+= tcl84.1:${PORTSDIR}/lang/tcl84
CONFIGURE_ARGS+= --with-tcl=${LOCALBASE}/lib/tcl8.4 --with-tcl-binding
-PLIST_SUB+= TCL=""
+PLIST_SUB+= TCL=""
.else
CONFIGURE_ARGS+= --without-tcl-binding
-PLIST_SUB+= TCL="@comment "
+PLIST_SUB+= TCL="@comment "
.endif
.if defined(WITH_PYTHON)
-BUILD_DEPENDS+= swig1.3:${PORTSDIR}/devel/swig13
CONFIGURE_ARGS+= --with-python-binding
-PLIST_SUB+= PYTHON=""
+PLIST_SUB+= PYTHON=""
.else
CONFIGURE_ARGS+= --without-python-binding
-PLIST_SUB+= PYTHON="@comment "
+PLIST_SUB+= PYTHON="@comment "
.endif
.if defined(WITH_RIGMATRIX)
-LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd
+LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd
CONFIGURE_ARGS+= --with-rigmatrix
-PLIST_SUB+= RIGMATRIX=""
+PLIST_SUB+= RIGMATRIX=""
.else
CONFIGURE_ARGS+= --without-with-rigmatrix
-PLIST_SUB+= RIGMATRIX="@comment "
+PLIST_SUB+= RIGMATRIX="@comment "
.endif
.if defined(WITH_GNURADIO)
CONFIGURE_ARGS+= --with-gnuradio
-PLIST_SUB+= GNURADIO=""
+PLIST_SUB+= GNURADIO=""
.else
CONFIGURE_ARGS+= --without-gnuradio
-LIST_SUB+= GNURADIO="@comment "
+PLIST_SUB+= GNURADIO="@comment "
.endif
-pre-everything::
-.if !defined(WITH_TCL) || !defined(WITH_PYTHON) || !defined(WITH_RIGMATRIX)
- @${ECHO_MSG} "You can specify the following command lines:"
- @${ECHO_MSG} ""
-.endif
-.if !defined(WITH_XML)
- @${ECHO_MSG} "WITH_XML=yes for XML support"
-.endif
-.if !defined(WITH_TCL)
- @${ECHO_MSG} "WITH_TCL=yes for TCL Binding support"
-.endif
-.if !defined(WITH_PYTHON)
- @${ECHO_MSG} "WITH_PYTHON=yes for PYTHON Binding support"
-.endif
-.if !defined(WITH_RIGMATRIX)
- @${ECHO_MSG} "WITH_RIGMATRIX=yes for RigMatrix support"
+.if defined(WITH_TCL) && defined(WITH_PYTHON)
+PLIST_SUB+= PYTHON_TCL=""
+.else
+PLIST_SUB+= PYTHON_TCL="@comment "
.endif
-#.if !defined(WITH_GNURADIO)
-# @${ECHO_MSG} "WITH_GNURADIO=yes for GNURadio support"
-#.endif
+
+pre-everything::
+ @${MAKE} showconfig
+ @${ECHO_MSG} "Use make config to set or unset above options"
@${ECHO_MSG} ""
+post-build:
+ ${PERL5} -pi -e 's/ doc_(perl|site|\$$\(INSTALLDIRS\))_install$$//' \
+ ${WRKSRC}/bindings/Hamlib-pl.mk
+
.include <bsd.port.post.mk>
diff --git a/comms/hamlib/distinfo b/comms/hamlib/distinfo
index f72085acccb7..62ddd2faee2f 100644
--- a/comms/hamlib/distinfo
+++ b/comms/hamlib/distinfo
@@ -1,3 +1,3 @@
-MD5 (hamlib-1.2.2.tar.gz) = 62a9140f12d071a1c9f077a948d21f8f
-SHA256 (hamlib-1.2.2.tar.gz) = ddcdc3d109126ac3da4e0b40a4be0091bbf695ee7e49adceada5a18c21dfd521
-SIZE (hamlib-1.2.2.tar.gz) = 1359213
+MD5 (hamlib-1.2.5.tar.gz) = 9725a6ae60c1c8ead8669e42a67cc5e8
+SHA256 (hamlib-1.2.5.tar.gz) = 1a66cee68486087305b1f9ccfc2ea816aa88a50817257d6213608ec16a65c1ba
+SIZE (hamlib-1.2.5.tar.gz) = 1420619
diff --git a/comms/hamlib/files/patch-bindings_Makefile.in b/comms/hamlib/files/patch-bindings_Makefile.in
new file mode 100644
index 000000000000..9cc4bebeeceb
--- /dev/null
+++ b/comms/hamlib/files/patch-bindings_Makefile.in
@@ -0,0 +1,79 @@
+--- bindings/Makefile.in.orig Sun Apr 9 16:26:50 2006
++++ bindings/Makefile.in Sun Apr 9 20:26:15 2006
+@@ -270,7 +270,7 @@
+ prefix = @prefix@
+ program_transform_name = @program_transform_name@
+ pyexecdir = @pyexecdir@
+-pythondir = $(prefix)/lib/python
++pythondir = @pyexecdir@
+ sbindir = @sbindir@
+ sharedstatedir = @sharedstatedir@
+ subdirs = @subdirs@
+@@ -283,13 +283,13 @@
+ ##########################################
+ # Tcl binding
+ tcl_ltlib = hamlibtcl.la
+-tcldir = $(prefix)/lib/tcl
++tcldir = $(TCL_BIN_DIR)
+ PKG_VER = 1.0
+ DLL = hamlibtcl-$(PKG_VER)@TCL_SHLIB_SUFFIX@
+ nodist_hamlibtcl_la_SOURCES = hamlibtcl_wrap.c
+ hamlibtcl_la_LDFLAGS = -no-undefined -module -release $(PKG_VER) -avoid-version @TCL_LIB_SPEC@
+ hamlibtcl_la_LIBADD = $(top_builddir)/src/libhamlib.la
+-hamlibtcl_ladir = $(tcldir)
++hamlibtcl_ladir = $(tcldir)/hamlib
+ hamlibtcl_la_DATA = pkgIndex.tcl
+
+ ##########################################
+@@ -302,7 +302,8 @@
+ python_PYTHON = Hamlib.py
+
+ ##########################################
+-lib_LTLIBRARIES = $(tcl_ltlib) $(python_ltlib)
++#lib_LTLIBRARIES = $(tcl_ltlib) $(python_ltlib)
++lib_LTLIBRARIES = @BINDING_LIB_TARGETS@
+ EXTRA_DIST = hamlib.swg ignore.swg rig.swg rotator.swg \
+ Makefile.PL perltest.pl tcltest.tcl pytest.py
+
+@@ -421,6 +422,7 @@
+ -rm -f libtool
+ uninstall-info-am:
+ install-pythonPYTHON: $(python_PYTHON)
++install-py:
+ @$(NORMAL_INSTALL)
+ test -z "$(pythondir)" || $(mkdir_p) "$(DESTDIR)$(pythondir)"
+ @list='$(python_PYTHON)'; dlist=''; for p in $$list; do\
+@@ -449,6 +451,7 @@
+ rm -f "$(DESTDIR)$(pythondir)/$${f}o"; \
+ done
+ install-hamlibtcl_laDATA: $(hamlibtcl_la_DATA)
++install-tcl: install-libLTLIBRARIES
+ @$(NORMAL_INSTALL)
+ test -z "$(hamlibtcl_ladir)" || $(mkdir_p) "$(DESTDIR)$(hamlibtcl_ladir)"
+ @list='$(hamlibtcl_la_DATA)'; for p in $$list; do \
+@@ -551,7 +554,8 @@
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+ install: $(BUILT_SOURCES)
+- $(MAKE) $(AM_MAKEFLAGS) install-am
++# $(MAKE) $(AM_MAKEFLAGS) install-am
++ $(MAKE) $(AM_MAKEFLAGS) $(BINDING_INSTALL_EXEC)
+ install-exec: install-exec-am
+ install-data: install-data-am
+ uninstall: uninstall-am
+@@ -698,7 +702,6 @@
+ check-tcl: all-tcl
+ TCLLIBPATH=$(builddir)/.libs $(srcdir)/tcltest.tcl || echo "Tcl test failed" 1>&2
+
+-install-tcl:
+ clean-tcl:
+ distclean-tcl: clean-tcl
+ uninstall-tcl:
+@@ -713,7 +716,6 @@
+ check-py: all-py
+ $(srcdir)/pytest.py || echo "Python test failed" 1>&2
+
+-install-py:
+ clean-py:
+ distclean-py:
+ uninstall-py:
diff --git a/comms/hamlib/files/patch-configure.ac b/comms/hamlib/files/patch-configure.ac
new file mode 100644
index 000000000000..56b964666be9
--- /dev/null
+++ b/comms/hamlib/files/patch-configure.ac
@@ -0,0 +1,35 @@
+--- configure.ac.orig Sun Feb 26 14:47:50 2006
++++ configure.ac Sun Apr 9 20:10:30 2006
+@@ -215,6 +215,7 @@
+ BINDING_INSTALL_EXEC=""
+ BINDING_UNINSTALL=""
+ BINDING_LIST=""
++BINDING_LIB_TARGETS=""
+
+ dnl Check if cxx-binding not wanted, default is to build it
+
+@@ -292,6 +293,7 @@
+ BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-tcl"
+ BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-tcl"
+ BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-tcl"
++ BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(tcl_ltlib)"
+ fi
+ AC_SUBST(TCL_LIB_SPEC)
+ AC_SUBST(TCL_INCLUDE_SPEC)
+@@ -317,6 +319,7 @@
+ BINDING_DISTCLEAN="${BINDING_DISTCLEAN} distclean-py"
+ BINDING_INSTALL_EXEC="${BINDING_INSTALL_EXEC} install-py"
+ BINDING_UNINSTALL="${BINDING_UNINSTALL} uninstall-py"
++ BINDING_LIB_TARGETS="${BINDING_LIB_TARGETS} \$(python_ltlib)"
+ fi
+
+
+@@ -446,7 +449,7 @@
+ AC_SUBST(BINDING_INSTALL_EXEC)
+ AC_SUBST(BINDING_UNINSTALL)
+ AC_SUBST(BINDING_LIST)
+-
++AC_SUBST(BINDING_LIB_TARGETS)
+
+ AC_SUBST(INCLUDES)
+
diff --git a/comms/hamlib/files/patch-include-config.h.in b/comms/hamlib/files/patch-include-config.h.in
deleted file mode 100644
index 4ef72a8ad529..000000000000
--- a/comms/hamlib/files/patch-include-config.h.in
+++ /dev/null
@@ -1,19 +0,0 @@
---- include/config.h.in.orig Mon Aug 23 23:12:37 2004
-+++ include/config.h.in Thu Oct 21 23:25:45 2004
-@@ -394,16 +394,6 @@
- extern "C" {
- #endif
-
--#ifndef HAVE_GETOPT
--int getopt (int argc, char * const argv[], const char * optstring);
--extern char * optarg;
--extern int optind, opterr, optopt;
--#endif
--#ifndef HAVE_GETOPT_LONG
--int getopt_long (int argc, char * const argv[], const char * optstring,
-- const struct option * longopts, int * longindex);
--#endif
--
- #ifndef HAVE_USLEEP
- int usleep(unsigned long usec); /* SUSv2 */
- #endif
diff --git a/comms/hamlib/files/patch-kenwood__kenwood.c b/comms/hamlib/files/patch-kenwood__kenwood.c
new file mode 100644
index 000000000000..7d1be02b1522
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__kenwood.c
@@ -0,0 +1,318 @@
+--- kenwood/kenwood.c.orig Mon Apr 10 00:28:17 2006
++++ kenwood/kenwood.c Mon Apr 10 00:48:27 2006
+@@ -239,7 +239,8 @@
+ int kenwood_set_vfo(RIG *rig, vfo_t vfo)
+ {
+ unsigned char cmdbuf[16], ackbuf[16];
+- int cmd_len, ack_len, retval;
++ int cmd_len, retval;
++ size_t ack_len;
+ char vfo_function;
+
+ switch (vfo) {
+@@ -273,7 +274,8 @@
+ int kenwood_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t txvfo)
+ {
+ unsigned char cmdbuf[16], ackbuf[16];
+- int cmd_len, ack_len, retval;
++ int cmd_len, retval;
++ size_t ack_len;
+ char vfo_function;
+
+ if(vfo !=RIG_VFO_CURR) {
+@@ -326,7 +328,8 @@
+ int kenwood_get_vfo(RIG *rig, vfo_t *vfo)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ info_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len);
+@@ -358,7 +361,8 @@
+ int kenwood_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
+ {
+ unsigned char freqbuf[16], ackbuf[16];
+- int freq_len, ack_len, retval;
++ int freq_len, retval;
++ size_t ack_len;
+ char vfo_letter;
+ vfo_t tvfo;
+
+@@ -373,7 +377,7 @@
+ vfo);
+ return -RIG_EINVAL;
+ }
+- freq_len = sprintf(freqbuf,"F%c%011"PRIll";", vfo_letter, (long long)freq);
++ freq_len = sprintf(freqbuf,"F%c%011"PRIll";", vfo_letter, (long)freq);
+
+ ack_len = 0;
+ retval = kenwood_transaction (rig, freqbuf, freq_len, ackbuf, &ack_len);
+@@ -389,7 +393,8 @@
+ {
+ unsigned char freqbuf[50];
+ unsigned char cmdbuf[4];
+- int cmd_len, freq_len, retval;
++ int cmd_len, retval;
++ size_t freq_len;
+ char vfo_letter;
+ vfo_t tvfo;
+
+@@ -426,7 +431,8 @@
+ int kenwood_get_rit(RIG *rig, vfo_t vfo, shortfreq_t * rit)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ info_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len);
+@@ -451,7 +457,8 @@
+ int kenwood_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
+ {
+ unsigned char buf[50], infobuf[50], c;
+- int retval, info_len, len, i;
++ int retval, len, i;
++ size_t info_len;
+
+
+ info_len = 0;
+@@ -491,7 +498,7 @@
+ int kenwood_scan(RIG * rig, vfo_t vfo, scan_t scan, int ch)
+ {
+ unsigned char ackbuf[16];
+- int ack_len = 0;
++ size_t ack_len = 0;
+
+ return kenwood_transaction (rig, scan==RIG_SCAN_STOP? "SC0;":"SC1;", 4,
+ ackbuf, &ack_len);
+@@ -505,7 +512,8 @@
+ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
+ {
+ unsigned char mdbuf[16],ackbuf[16];
+- int mdbuf_len, ack_len, kmode, retval;
++ int mdbuf_len, kmode, retval;
++ size_t ack_len;
+
+ switch (mode) {
+ case RIG_MODE_CW: kmode = MD_CW; break;
+@@ -536,7 +544,8 @@
+ int kenwood_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char modebuf[50];
+- int mode_len, retval;
++ int retval;
++ size_t mode_len;
+
+
+ mode_len = 50;
+@@ -574,7 +583,8 @@
+ int kenwood_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
+ {
+ unsigned char levelbuf[16], ackbuf[16];
+- int level_len, ack_len, retval;
++ int level_len, retval;
++ size_t ack_len;
+ int i, kenwood_val;
+
+ if (RIG_LEVEL_IS_FLOAT(level))
+@@ -636,7 +646,8 @@
+ int get_kenwood_level(RIG *rig, const char *cmd, int cmd_len, float *f)
+ {
+ unsigned char lvlbuf[50];
+- int lvl_len, retval;
++ int retval;
++ size_t lvl_len;
+ int lvl;
+
+ lvl_len = 50;
+@@ -667,7 +678,8 @@
+ int kenwood_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ unsigned char lvlbuf[50];
+- int lvl_len, retval;
++ int retval;
++ size_t lvl_len;
+ int lvl;
+ int i, ret, agclevel;
+
+@@ -769,7 +781,8 @@
+ int kenwood_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int fct_len, ack_len;
++ int fct_len;
++ size_t ack_len;
+
+ /* Optimize:
+ * sort the switch cases with the most frequent first
+@@ -836,7 +849,8 @@
+ static int get_kenwood_func(RIG *rig, const char *cmd, int cmd_len, int *status)
+ {
+ unsigned char fctbuf[50];
+- int fct_len, retval;
++ int retval;
++ size_t fct_len;
+
+ fct_len = 50;
+ retval = kenwood_transaction (rig, cmd, cmd_len, fctbuf, &fct_len);
+@@ -862,7 +876,8 @@
+ int kenwood_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
+ {
+ unsigned char fctbuf[50];
+- int fct_len, retval;
++ int retval;
++ size_t fct_len;
+
+ fct_len = 50;
+
+@@ -933,7 +948,8 @@
+ {
+ const struct rig_caps *caps;
+ unsigned char tonebuf[16], ackbuf[16];
+- int tone_len, ack_len;
++ int tone_len;
++ size_t ack_len;
+ int i;
+
+ caps = rig->caps;
+@@ -961,7 +977,8 @@
+ {
+ const struct rig_caps *caps;
+ unsigned char tonebuf[50];
+- int tone_len, i, retval;
++ int i, retval;
++ size_t tone_len;
+ unsigned int tone_idx;
+
+ caps = rig->caps;
+@@ -1006,7 +1023,8 @@
+ int kenwood_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ info_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len);
+@@ -1032,7 +1050,7 @@
+ int kenwood_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
+ {
+ unsigned char ackbuf[16];
+- int ack_len = 0;
++ size_t ack_len = 0;
+
+ return kenwood_transaction (rig, ptt==RIG_PTT_ON? "TX;":"RX;", 3,
+ ackbuf, &ack_len);
+@@ -1046,7 +1064,8 @@
+ int kenwood_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
+ {
+ unsigned char busybuf[50];
+- int busy_len, retval;
++ int retval;
++ size_t busy_len;
+
+ busy_len = 50;
+ retval = kenwood_transaction (rig, "BY;", 3, busybuf, &busy_len);
+@@ -1071,7 +1090,8 @@
+ int kenwood_set_trn(RIG *rig, int trn)
+ {
+ unsigned char trnbuf[16], ackbuf[16];
+- int trn_len, ack_len = 0;
++ int trn_len;
++ size_t ack_len = 0;
+
+ trn_len = sprintf(trnbuf,"AI%c;", trn==RIG_TRN_RIG?'1':'0');
+
+@@ -1085,7 +1105,8 @@
+ int kenwood_get_trn(RIG *rig, int *trn)
+ {
+ unsigned char trnbuf[50];
+- int trn_len, retval;
++ int retval;
++ size_t trn_len;
+
+ trn_len = 50;
+ retval = kenwood_transaction (rig, "AI;", 3, trnbuf, &trn_len);
+@@ -1109,7 +1130,8 @@
+ int kenwood_set_powerstat(RIG *rig, powerstat_t status)
+ {
+ unsigned char pwrbuf[16], ackbuf[16];
+- int pwr_len, ack_len = 0;
++ int pwr_len;
++ size_t ack_len = 0;
+
+ pwr_len = sprintf(pwrbuf,"PS%c;", status==RIG_POWER_ON?'1':'0');
+
+@@ -1123,7 +1145,8 @@
+ int kenwood_get_powerstat(RIG *rig, powerstat_t *status)
+ {
+ unsigned char pwrbuf[50];
+- int pwr_len = 50, retval;
++ int retval;
++ size_t pwr_len = 50;
+
+ retval = kenwood_transaction (rig, "PS;", 3, pwrbuf, &pwr_len);
+ if (retval != RIG_OK)
+@@ -1146,7 +1169,8 @@
+ int kenwood_reset(RIG *rig, reset_t reset)
+ {
+ unsigned char rstbuf[16], ackbuf[16];
+- int rst_len, ack_len = 0;
++ int rst_len;
++ size_t ack_len = 0;
+ char rst;
+
+ switch(reset) {
+@@ -1169,7 +1193,8 @@
+ int kenwood_send_morse(RIG *rig, vfo_t vfo, const char *msg)
+ {
+ unsigned char morsebuf[30], m2[30], ackbuf[16];
+- int morse_len, ack_len;
++ int morse_len;
++ size_t ack_len;
+ int msg_len, buff_len, retval;
+ const char *p;
+
+@@ -1212,7 +1237,7 @@
+ int kenwood_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op)
+ {
+ unsigned char *cmd, ackbuf[16];
+- int ack_len = 0;
++ size_t ack_len = 0;
+
+ switch(op) {
+ case RIG_OP_UP: cmd="UP;"; break;
+@@ -1236,7 +1261,8 @@
+ int kenwood_set_mem(RIG *rig, vfo_t vfo, int ch)
+ {
+ unsigned char membuf[16], ackbuf[16];
+- int mem_len, ack_len = 0;
++ int mem_len;
++ size_t ack_len = 0;
+
+ /*
+ * "MCbmm;"
+@@ -1255,7 +1281,8 @@
+ int kenwood_get_mem(RIG *rig, vfo_t vfo, int *ch)
+ {
+ unsigned char membuf[50];
+- int retval, mem_len;
++ int retval;
++ size_t mem_len;
+
+ /*
+ * "MCbmm;"
+@@ -1286,7 +1313,8 @@
+ const char* kenwood_get_info(RIG *rig)
+ {
+ unsigned char firmbuf[50];
+- int firm_len, retval;
++ int retval;
++ size_t firm_len;
+
+ firm_len = 50;
+ retval = kenwood_transaction (rig, "TY;", 3, firmbuf, &firm_len);
diff --git a/comms/hamlib/files/patch-kenwood__th.c b/comms/hamlib/files/patch-kenwood__th.c
new file mode 100644
index 000000000000..63755ca730e6
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__th.c
@@ -0,0 +1,287 @@
+--- kenwood/th.c.orig Mon Apr 10 01:19:35 2006
++++ kenwood/th.c Mon Apr 10 02:34:23 2006
+@@ -64,7 +64,8 @@
+ th_decode_event (RIG *rig)
+ {
+ char asyncbuf[128];
+- int retval,async_len=128;
++ int retval;
++ size_t async_len=128;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -182,7 +183,8 @@
+ th_set_freq (RIG *rig, vfo_t vfo, freq_t freq)
+ {
+ char freqbuf[ACKBUF_LEN], ackbuf[ACKBUF_LEN];
+- int retval, step,ack_len=ACKBUF_LEN;
++ int retval, step;
++ size_t ack_len=ACKBUF_LEN;
+ long long f;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+@@ -193,7 +195,7 @@
+ }
+
+ step = 1;
+- f=(long long) freq;
++ f=(long) freq;
+ sprintf(freqbuf, "FQ %011"PRIll",%1d"EOM, f, step);
+ retval = kenwood_transaction(rig, freqbuf, strlen(freqbuf), ackbuf, &ack_len);
+ if (retval != RIG_OK)
+@@ -210,7 +212,8 @@
+ th_get_freq (RIG *rig, vfo_t vfo, freq_t *freq)
+ {
+ char freqbuf[24], ackbuf[ACKBUF_LEN];
+- int retval, step,ack_len=ACKBUF_LEN;
++ int retval, step;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -243,7 +246,8 @@
+ th_set_mode (RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
+ {
+ char kmode, mdbuf[24], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+ if(vfo!=RIG_VFO_CURR) {
+@@ -276,7 +280,8 @@
+ th_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ char vch, ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+ if(vfo!=RIG_VFO_CURR) {
+@@ -316,7 +321,8 @@
+ th_set_vfo (RIG *rig, vfo_t vfo)
+ {
+ char vfobuf[16], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -368,7 +374,8 @@
+ th_get_vfo (RIG *rig, vfo_t *vfo)
+ {
+ char cmdbuf[16], ackbuf[ACKBUF_LEN],vfoc;
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -425,7 +432,8 @@
+ th_set_trn(RIG *rig, int trn)
+ {
+ char trnbuf[16], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -445,7 +453,8 @@
+ th_get_trn (RIG *rig, int *trn)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -471,7 +480,8 @@
+ static int th_get_kenwood_func (RIG *rig, const char *cmd, int *status)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+ retval = kenwood_transaction (rig, cmd, strlen(cmd), ackbuf, &ack_len);
+@@ -528,7 +538,8 @@
+ static int th_tburst(RIG *rig, vfo_t vfo, int status)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ if(status==1) {
+ retval = kenwood_transaction(rig, "TT"EOM, 3, ackbuf, &ack_len);
+@@ -550,7 +561,8 @@
+ static int th_set_kenwood_func (RIG *rig, const char *cmd, int status)
+ {
+ char trbuf[16], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -641,7 +653,8 @@
+ th_get_level (RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ char vch, lvlbuf[32], ackbuf[ACKBUF_LEN];
+- int retval, v, l,ack_len=ACKBUF_LEN;
++ int retval, v, l;
++ size_t ack_len=ACKBUF_LEN;
+ vfo_t tvfo;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+@@ -734,7 +747,8 @@
+ int th_set_level (RIG *rig, vfo_t vfo, setting_t level, value_t val)
+ {
+ char vch, lvlbuf[32], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ vfo_t tvfo;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+@@ -788,7 +802,8 @@
+ {
+ const struct rig_caps *caps;
+ unsigned char tonebuf[16], ackbuf[ACKBUF_LEN];
+- int i, retval,ack_len=ACKBUF_LEN;
++ int i, retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -819,7 +834,8 @@
+ {
+ struct rig_caps *caps;
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ unsigned int tone_idx;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -851,7 +867,8 @@
+ th_get_info(RIG *rig)
+ {
+ static unsigned char firmbuf[16];
+- int retval,firm_len=16;
++ int retval;
++ size_t firm_len=16;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -877,7 +894,8 @@
+ th_set_mem(RIG *rig, vfo_t vfo, int ch)
+ {
+ unsigned char vsel, membuf[16], ackbuf[16];
+- int retval, ack_len = 16;
++ int retval;
++ size_t ack_len = 16;
+ vfo_t tvfo;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+@@ -913,7 +931,8 @@
+ th_get_mem(RIG *rig, vfo_t vfo, int *ch)
+ {
+ unsigned char *membuf, ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ vfo_t tvfo,cvfo;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+@@ -966,7 +985,8 @@
+ th_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
+ {
+ unsigned char *membuf, ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -1017,7 +1037,8 @@
+ int th_get_powerstat(RIG *rig, powerstat_t *status)
+ {
+ unsigned char pwrbuf[50];
+- int pwr_len = 50, retval;
++ int retval;
++ size_t pwr_len = 50;
+
+ retval = kenwood_transaction (rig, "PS;", 3, pwrbuf, &pwr_len);
+ if (retval != RIG_OK)
+@@ -1037,7 +1058,8 @@
+ int th_get_dcd(RIG *rig, vfo_t vfo, dcd_t *dcd)
+ {
+ unsigned char *membuf, ackbuf[ACKBUF_LEN];
+- int retval, ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ switch (vfo) {
+ case RIG_VFO_VFO:
+@@ -1081,7 +1103,8 @@
+ {
+
+ unsigned char *membuf,ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -1123,7 +1146,8 @@
+ int th_get_channel(RIG *rig, channel_t *chan)
+ {
+ char membuf[64],ackbuf[ACKBUF_LEN];
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+ freq_t freq,offset;
+ char req[16],scf[128];
+ int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
+@@ -1228,7 +1252,8 @@
+ int th_set_channel(RIG *rig, const channel_t *chan)
+ {
+ char membuf[ACKBUF_LEN],ackbuf[ACKBUF_LEN];
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+ char req[64];
+ long long freq,offset;
+ int chn, step, shift, tone, ctcss, tonefq, ctcssfq;
+@@ -1298,12 +1323,12 @@
+
+ if(chan->channel_num<=220)
+ sprintf(membuf, "%s,%011"PRIll",%01d,%01d,0,%01d,%01d,,%02d,,%02d,%09"PRIll",0"EOM,
+- req,(long long)freq, step, shift, tone,
+- ctcss, tonefq, ctcssfq, (long long)offset);
++ req,(long)freq, step, shift, tone,
++ ctcss, tonefq, ctcssfq, (long)offset);
+ else
+ sprintf(membuf, "%s,%011"PRIll",%01d,%01d,0,%01d,%01d,,%02d,,%02d,%09"PRIll EOM,
+- req, (long long)freq, step, shift, tone,
+- ctcss, tonefq, ctcssfq, (long long)offset);
++ req, (long)freq, step, shift, tone,
++ ctcss, tonefq, ctcssfq, (long)offset);
+
+ ack_len=ACKBUF_LEN;
+ retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len);
+@@ -1312,7 +1337,7 @@
+
+ if(chan->channel_num<223 && chan->tx_freq!=RIG_FREQ_NONE) {
+ req[5]='1';
+- sprintf(membuf, "%s,%011"PRIll",%01d"EOM, req,(long long)chan->tx_freq, step);
++ sprintf(membuf, "%s,%011"PRIll",%01d"EOM, req,(long)chan->tx_freq, step);
+ ack_len=ACKBUF_LEN;
+ retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len);
+ if (retval != RIG_OK)
diff --git a/comms/hamlib/files/patch-kenwood__thg71.c b/comms/hamlib/files/patch-kenwood__thg71.c
new file mode 100644
index 000000000000..d73de6a20741
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__thg71.c
@@ -0,0 +1,62 @@
+--- kenwood/thg71.c.orig Mon Apr 10 01:13:33 2006
++++ kenwood/thg71.c Mon Apr 10 01:16:04 2006
+@@ -184,7 +184,8 @@
+ int thg71_decode_event (RIG *rig)
+ {
+ char asyncbuf[ACKBUF_LEN];
+- int retval, asyncbuf_len = ACKBUF_LEN-1;
++ int retval;
++ size_t asyncbuf_len = ACKBUF_LEN-1;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+ retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &asyncbuf_len);
+@@ -291,7 +292,8 @@
+ int thg71_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ int step;
+ freq_t freq;
+
+@@ -327,7 +329,8 @@
+ int thg71_set_vfo (RIG *rig, vfo_t vfo)
+ {
+ char vfobuf[16], ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+@@ -355,7 +358,8 @@
+ int thg71_get_vfo (RIG *rig, vfo_t *vfo)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ int vch;
+
+ retval = kenwood_transaction(rig, "VMC 0"EOM , 6, ackbuf, &ack_len);
+@@ -382,7 +386,8 @@
+ int thg71_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ if(func != RIG_FUNC_TBURST)
+ return -RIG_EINVAL;
+@@ -404,7 +409,8 @@
+ int thg71_open(RIG *rig)
+ {
+ char ackbuf[ACKBUF_LEN],*strl,*stru;
+- int retval,i,ack_len=ACKBUF_LEN;
++ int retval,i;
++ size_t ack_len=ACKBUF_LEN;
+ const freq_range_t frend=RIG_FRNG_END;
+
+ /* just to be sure it's a THG-71 */
diff --git a/comms/hamlib/files/patch-kenwood__tmv7.c b/comms/hamlib/files/patch-kenwood__tmv7.c
new file mode 100644
index 000000000000..4256d817095f
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__tmv7.c
@@ -0,0 +1,85 @@
+--- kenwood/tmv7.c.orig Mon Apr 10 01:16:47 2006
++++ kenwood/tmv7.c Mon Apr 10 02:15:58 2006
+@@ -216,7 +216,8 @@
+ int tmv7_decode_event (RIG *rig)
+ {
+ char asyncbuf[ACKBUF_LEN];
+- int retval, asyncbuf_len = ACKBUF_LEN-1;
++ int retval;
++ size_t asyncbuf_len = ACKBUF_LEN-1;
+ rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __FUNCTION__);
+
+ retval = kenwood_transaction(rig, NULL, 0, asyncbuf, &asyncbuf_len);
+@@ -324,7 +325,8 @@
+ int tmv7_set_vfo (RIG *rig, vfo_t vfo)
+ {
+ char vfobuf[16], ackbuf[ACKBUF_LEN];
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+
+ rig_debug(RIG_DEBUG_TRACE, "%s: called %d\n", __FUNCTION__,vfo);
+
+@@ -383,7 +385,8 @@
+ int tmv7_get_mode (RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+ int step;
+ freq_t freq;
+
+@@ -428,7 +431,8 @@
+ int tmv7_get_channel(RIG *rig, channel_t *chan)
+ {
+ char membuf[64],ackbuf[ACKBUF_LEN];
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+ freq_t freq;
+ char req[16],scf[128];
+ int step, shift, rev, tone, ctcss, tonefq, ctcssfq;
+@@ -540,7 +544,8 @@
+ int tmv7_set_channel(RIG *rig, const channel_t *chan)
+ {
+ char membuf[ACKBUF_LEN],ackbuf[ACKBUF_LEN];
+- int retval,ack_len;
++ int retval;
++ size_t ack_len;
+ char req[64];
+ long long freq;
+ int chn, step, shift, tone, ctcss, tonefq, ctcssfq;
+@@ -617,11 +622,11 @@
+
+ if(chan->channel_num<221)
+ sprintf(membuf, "%s,%011"PRIll",%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,0,0"EOM,
+- req,(long long)freq, step, shift, tone,
++ req,(long)freq, step, shift, tone,
+ ctcss, tonefq, ctcssfq);
+ else
+ sprintf(membuf, "%s,%011"PRIll",%01d,%01d,0,%01d,%01d,0,%02d,000,%02d,"EOM,
+- req, (long long)freq, step, shift, tone,
++ req, (long)freq, step, shift, tone,
+ ctcss, tonefq, ctcssfq);
+
+ ack_len=ACKBUF_LEN;
+@@ -631,7 +636,7 @@
+
+ if(chan->tx_freq!=RIG_FREQ_NONE) {
+ req[5]='1';
+- sprintf(membuf, "%s,%011"PRIll",%01d"EOM, req,(long long)chan->tx_freq, step);
++ sprintf(membuf, "%s,%011"PRIll",%01d"EOM, req,(long)chan->tx_freq, step);
+ ack_len=ACKBUF_LEN;
+ retval = kenwood_transaction(rig, membuf, strlen(membuf), ackbuf, &ack_len);
+ if (retval != RIG_OK)
+@@ -656,7 +661,8 @@
+ int tmv7_open(RIG *rig)
+ {
+ char ackbuf[ACKBUF_LEN];
+- int retval,ack_len=ACKBUF_LEN;
++ int retval;
++ size_t ack_len=ACKBUF_LEN;
+
+ /* just to be sure it's a TM-V7 */
+ retval = kenwood_transaction(rig, "ID"EOM, 3, ackbuf, &ack_len);
diff --git a/comms/hamlib/files/patch-kenwood__ts140.c b/comms/hamlib/files/patch-kenwood__ts140.c
new file mode 100644
index 000000000000..0598a6cc200c
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts140.c
@@ -0,0 +1,107 @@
+--- kenwood/ts140.c.orig Sun Apr 9 23:07:44 2006
++++ kenwood/ts140.c Sun Apr 9 23:08:10 2006
+@@ -63,7 +63,8 @@
+ static int ts140_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char modebuf[50];
+- int mode_len, retval;
++ size_t mode_len;
++ int retval;
+
+ mode_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, modebuf, &mode_len);
+@@ -98,7 +99,8 @@
+ static int ts140_set_vfo(RIG *rig, vfo_t vfo)
+ {
+ unsigned char cmdbuf[16], ackbuf[16];
+- int cmd_len, ack_len, retval;
++ int cmd_len, retval;
++ size_t ack_len;
+ char vfo_function;
+
+ switch (vfo) {
+@@ -118,13 +120,14 @@
+ retval = kenwood_transaction (rig, cmdbuf, cmd_len, ackbuf, &ack_len);
+ if (retval != RIG_OK)
+ return retval;
+- return RIG_OK;
++ return RIG_OK;
+ }
+
+ static int ts140_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
+ {
+ unsigned char freqbuf[50];
+- int freq_len, retval;
++ size_t freq_len;
++ int retval;
+ long long f;
+
+ /* We're using IF; here because the TS-140S is incapable of supplying
+@@ -143,16 +146,47 @@
+ }
+
+ freqbuf[14] = '\0';
+- sscanf(freqbuf+2, "%lld", &f);
++ sscanf(freqbuf+2, "%lld", &f); /* Is a long long int really necessary here? */
+ *freq = (freq_t)f;
+
+ return RIG_OK;
+ }
+
++static int ts140_get_mem(RIG *rig, vfo_t vfo, int *ch)
++{
++ unsigned char membuf[50];
++ int m, retval;
++ size_t mem_len;
++
++ mem_len = 50;
++
++/* Again, the TS-140S is incapable of supplying the memory location
++* from MC; so we use IF;. Another awful hack, but it's what the radio
++* forces us to use. Furthermore, the radio will not return the value
++* of an empty memory. */
++
++ retval = kenwood_transaction (rig, "IF;", 3, membuf, &mem_len);
++ if (retval != RIG_OK)
++ return retval;
++
++ if (mem_len != 38 || membuf[1] != 'F') {
++ rig_debug(RIG_DEBUG_ERR,"ts140_get_mem: wrong answer "
++ "len=%d\n", mem_len);
++ return -RIG_ERJCTED;
++ }
++
++ membuf[28] = '\0';
++ sscanf(membuf+25, "%d", &m);
++ *ch = m;
++
++ return RIG_OK;
++}
++
+ static int ts140_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int fct_len, ack_len;
++ int fct_len;
++ size_t ack_len;
+ ack_len = 0;
+ switch (func) {
+ case RIG_FUNC_LOCK:
+@@ -170,7 +204,7 @@
+
+ /*
+ * ts140 rig capabilities.
+- * MattD.. 2005-01-29
++ * GW0VNR 09042006
+ */
+
+ const struct rig_caps ts140_caps = {
+@@ -275,7 +309,7 @@
+ .get_func = kenwood_get_func,
+ .vfo_op = kenwood_vfo_op,
+ .set_mem = kenwood_set_mem,
+-.get_mem = kenwood_get_mem,
++.get_mem = ts140_get_mem,
+ .reset = kenwood_reset,
+
+ };
diff --git a/comms/hamlib/files/patch-kenwood__ts2000.c b/comms/hamlib/files/patch-kenwood__ts2000.c
new file mode 100644
index 000000000000..dc25ff75afed
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts2000.c
@@ -0,0 +1,12 @@
+--- kenwood/ts2000.c.orig Mon Apr 10 01:08:30 2006
++++ kenwood/ts2000.c Mon Apr 10 01:09:48 2006
+@@ -259,7 +259,8 @@
+ int ts2000_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ unsigned char lvlbuf[50];
+- int lvl_len, retval;
++ int retval;
++ size_t lvl_len;
+ int lvl;
+ int i, ret, agclevel;
+
diff --git a/comms/hamlib/files/patch-kenwood__ts450s.c b/comms/hamlib/files/patch-kenwood__ts450s.c
new file mode 100644
index 000000000000..92d04e005567
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts450s.c
@@ -0,0 +1,42 @@
+--- kenwood/ts450s.c.orig Mon Apr 10 01:05:26 2006
++++ kenwood/ts450s.c Mon Apr 10 01:07:44 2006
+@@ -78,7 +78,8 @@
+ ts450s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len);
+ if (retval != RIG_OK)
+@@ -116,7 +117,8 @@
+ ts450s_get_vfo(RIG *rig, vfo_t *vfo)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len);
+ if (retval != RIG_OK)
+@@ -145,7 +147,8 @@
+ ts450s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ unsigned char lvlbuf[50];
+- int lvl_len, retval;
++ int retval;
++ size_t lvl_len;
+
+ lvl_len = 50;
+ switch (level)
+@@ -205,7 +208,8 @@
+ ts450s_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
+ {
+ unsigned char levelbuf[16], ackbuf[16];
+- int level_len, ack_len, retval;
++ int level_len, retval;
++ size_t ack_len;
+ int kenwood_val;
+
+ if (RIG_LEVEL_IS_FLOAT(level))
diff --git a/comms/hamlib/files/patch-kenwood__ts480.c b/comms/hamlib/files/patch-kenwood__ts480.c
new file mode 100644
index 000000000000..20273bf1caf4
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts480.c
@@ -0,0 +1,68 @@
+--- kenwood/ts480.c.orig Mon Apr 10 01:10:22 2006
++++ kenwood/ts480.c Mon Apr 10 01:12:55 2006
+@@ -50,7 +50,7 @@
+ kenwood_ts480_set_ptt (RIG * rig, vfo_t vfo, ptt_t ptt)
+ {
+ unsigned char ackbuf[16];
+- int ack_len = 0;
++ size_t ack_len = 0;
+
+ if (RIG_PTT_ON == ptt)
+ return kenwood_transaction (rig, "TX1;", 4, ackbuf, &ack_len);
+@@ -68,7 +68,7 @@
+ kenwood_ts480_set_ant (RIG * rig, vfo_t vfo, ant_t ant)
+ {
+ unsigned char ackbuf[16];
+- int ack_len = 0;
++ size_t ack_len = 0;
+
+ if (RIG_ANT_1 == ant)
+ return kenwood_transaction (rig, "AN1;", 4, ackbuf, &ack_len);
+@@ -88,7 +88,7 @@
+ kenwood_ts480_get_ant (RIG * rig, vfo_t vfo, ant_t * ant)
+ {
+ unsigned char ackbuf[16];
+- int ack_len = 16;
++ size_t ack_len = 16;
+ int retval;
+
+ retval = kenwood_transaction (rig, "AN;", 3, ackbuf, &ack_len);
+@@ -120,7 +120,8 @@
+ kenwood_ts480_get_info (RIG * rig)
+ {
+ unsigned char firmbuf[50];
+- int firm_len, retval;
++ int retval;
++ size_t firm_len;
+
+ firm_len = 50;
+ retval = kenwood_transaction (rig, "TY;", 3, firmbuf, &firm_len);
+@@ -160,7 +161,8 @@
+ kenwood_ts480_set_level (RIG * rig, vfo_t vfo, setting_t level, value_t val)
+ {
+ unsigned char levelbuf[16], ackbuf[16];
+- int level_len, ack_len, retval;
++ int level_len, retval;
++ size_t ack_len;
+ int kenwood_val;
+
+ switch (level)
+@@ -227,7 +229,7 @@
+ kenwood_ts480_get_level (RIG * rig, vfo_t vfo, setting_t level, value_t * val)
+ {
+ unsigned char ackbuf[50];
+- int ack_len = 50;
++ size_t ack_len = 50;
+ int levelint;
+ int retval;
+
+@@ -327,7 +329,8 @@
+ kenwood_ts480_set_func (RIG * rig, vfo_t vfo, setting_t func, int status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int fct_len, ack_len;
++ int fct_len;
++ size_t ack_len;
+
+ ack_len = 0;
+ switch (func)
diff --git a/comms/hamlib/files/patch-kenwood__ts570.c b/comms/hamlib/files/patch-kenwood__ts570.c
new file mode 100644
index 000000000000..8edace412202
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts570.c
@@ -0,0 +1,42 @@
+--- kenwood/ts570.c.orig Mon Apr 10 00:54:20 2006
++++ kenwood/ts570.c Mon Apr 10 01:04:43 2006
+@@ -65,7 +65,8 @@
+ static int ts570_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char buf[50];
+- int buf_len, retval;
++ int retval;
++ size_t buf_len;
+
+
+ buf_len = 50;
+@@ -146,7 +147,8 @@
+ static int ts570_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
+ {
+ unsigned char buf[16],ackbuf[16];
+- int buf_len, ack_len, kmode, retval;
++ int buf_len, kmode, retval;
++ size_t ack_len;
+
+ switch (mode)
+ {
+@@ -203,7 +205,8 @@
+ static int ts570_set_ant(RIG *rig, vfo_t vfo, ant_t ant)
+ {
+ unsigned char buf[6], ackbuf[16];
+- int len, ack_len, retval;
++ int len, retval;
++ size_t ack_len;
+
+ len = sprintf(buf,"AN%c;", ant==RIG_ANT_1?'1':'2');
+
+@@ -220,7 +223,8 @@
+ static int ts570_get_ant(RIG *rig, vfo_t vfo, ant_t *ant)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ info_len = 5;
+ retval = kenwood_transaction (rig, "AN;", 3, infobuf, &info_len);
diff --git a/comms/hamlib/files/patch-kenwood__ts680.c b/comms/hamlib/files/patch-kenwood__ts680.c
new file mode 100644
index 000000000000..f8eeb05bfd98
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts680.c
@@ -0,0 +1,105 @@
+--- kenwood/ts680.c.orig Mon Apr 10 01:50:28 2006
++++ kenwood/ts680.c Mon Apr 10 01:46:44 2006
+@@ -63,7 +63,8 @@
+ static int ts680_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char modebuf[50];
+- int mode_len, retval;
++ size_t mode_len;
++ int retval;
+
+ mode_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, modebuf, &mode_len);
+@@ -98,7 +99,8 @@
+ static int ts680_set_vfo(RIG *rig, vfo_t vfo)
+ {
+ unsigned char cmdbuf[16], ackbuf[16];
+- int cmd_len, ack_len, retval;
++ int cmd_len, retval;
++ size_t ack_len;
+ char vfo_function;
+
+ switch (vfo) {
+@@ -124,7 +126,8 @@
+ static int ts680_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
+ {
+ unsigned char freqbuf[50];
+- int freq_len, retval;
++ size_t freq_len;
++ int retval;
+ long long f;
+
+ /* We're using IF; here because the TS-680S is incapable of supplying
+@@ -143,16 +146,47 @@
+ }
+
+ freqbuf[14] = '\0';
+- sscanf(freqbuf+2, "%lld", &f);
++ sscanf(freqbuf+2, "%lld", &f); /* Is a long long int really necessary here? */
+ *freq = (freq_t)f;
+
+ return RIG_OK;
+ }
+
++static int ts680_get_mem(RIG *rig, vfo_t vfo, int *ch)
++{
++ unsigned char membuf[50];
++ int m, retval;
++ size_t mem_len;
++
++ mem_len = 50;
++
++ /* Again, the TS-680S is incapable of supplying the memory location
++ * from MC; so we use IF;. Another awful hack, but it's what the radio
++ * forces us to use. Furthermore, the radio will not return the value
++ * of an empty memory. */
++
++ retval = kenwood_transaction (rig, "IF;", 3, membuf, &mem_len);
++ if (retval != RIG_OK)
++ return retval;
++
++ if (mem_len != 38 || membuf[1] != 'F') {
++ rig_debug(RIG_DEBUG_ERR,"ts680_get_mem: wrong answer "
++ "len=%d\n", mem_len);
++ return -RIG_ERJCTED;
++ }
++
++ membuf[28] = '\0';
++ sscanf(membuf+25, "%d", &m);
++ *ch = m;
++
++ return RIG_OK;
++}
++
+ static int ts680_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int fct_len, ack_len;
++ int fct_len;
++ size_t ack_len;
+ ack_len = 0;
+ switch (func) {
+ case RIG_FUNC_LOCK:
+@@ -170,11 +204,11 @@
+
+ /*
+ * ts680 rig capabilities.
+- * MattD.. 2005-01-29
++ * GW0VNR 09042006
+ */
+
+ const struct rig_caps ts680s_caps = {
+-.rig_model = RIG_MODEL_TS680S, /* Returns ID of 006. Suggest this is added to kenwood.c */
++.rig_model = RIG_MODEL_TS680S,
+ .model_name = "TS-680S",
+ .mfg_name = "Kenwood",
+ .version = BACKEND_VER ".0",
+@@ -281,7 +315,7 @@
+ .get_func = kenwood_get_func,
+ .vfo_op = kenwood_vfo_op,
+ .set_mem = kenwood_set_mem,
+-.get_mem = kenwood_get_mem,
++.get_mem = ts680_get_mem,
+ .reset = kenwood_reset,
+
+ };
diff --git a/comms/hamlib/files/patch-kenwood__ts850.c b/comms/hamlib/files/patch-kenwood__ts850.c
new file mode 100644
index 000000000000..b3e309ee485d
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts850.c
@@ -0,0 +1,122 @@
+--- kenwood/ts850.c.orig Sun Apr 9 23:36:11 2006
++++ kenwood/ts850.c Sun Apr 9 23:49:51 2006
+@@ -226,7 +226,8 @@
+ int ts850_set_rit(RIG * rig, vfo_t vfo, shortfreq_t rit)
+ {
+ unsigned char buf[50], infobuf[50], c;
+- int retval, info_len, len, i;
++ int retval, len, i;
++ size_t info_len;
+
+
+ info_len = 0;
+@@ -255,7 +256,8 @@
+ int ts850_set_xit(RIG * rig, vfo_t vfo, shortfreq_t xit)
+ {
+ unsigned char buf[50], infobuf[50], c;
+- int retval, info_len, len, i;
++ int retval, len, i;
++ size_t info_len;
+
+ info_len = 0;
+ if (xit == 0)
+@@ -297,7 +299,8 @@
+ int ts850_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+ int f,f1,f2;
+
+ info_len = 50;
+@@ -387,7 +390,8 @@
+ int ts850_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
+ {
+ unsigned char mdbuf[16],ackbuf[16];
+- int mdbuf_len, ack_len, kmode, retval;
++ int mdbuf_len, kmode, retval;
++ size_t ack_len;
+
+ kmode=mode_to_char(mode);
+ if(kmode==RIG_MODE_NONE) {
+@@ -426,7 +430,8 @@
+ {
+ const struct rig_caps *caps;
+ unsigned char tonebuf[16], ackbuf[16];
+- int tone_len, ack_len;
++ int tone_len;
++ size_t ack_len;
+ int i;
+
+ caps = rig->caps;
+@@ -447,7 +452,8 @@
+ int ts850_set_func(RIG *rig, vfo_t vfo, setting_t func, int status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int fct_len, ack_len;
++ int fct_len;
++ size_t ack_len;
+
+ if (vfo != RIG_VFO_CURR)
+ return -RIG_EINVAL;
+@@ -474,7 +480,8 @@
+ int ts850_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
+ {
+ unsigned char fctbuf[16], ackbuf[16];
+- int retval, fct_len, ack_len;
++ int retval, fct_len;
++ size_t ack_len;
+
+ if (vfo != RIG_VFO_CURR)
+ return -RIG_EINVAL;
+@@ -505,7 +512,8 @@
+ int ts850_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ unsigned char lvlbuf[50];
+- int i, lvl_len, retval;
++ int i, retval;
++ size_t lvl_len;
+
+ if(vfo!=RIG_VFO_CURR)
+ return -RIG_EINVAL;
+@@ -587,7 +595,8 @@
+ int ts850_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
+ {
+ unsigned char lvlbuf[16], ackbuf[16];
+- int lvl_len, ack_len;
++ int lvl_len;
++ size_t ack_len;
+
+ if(level != RIG_LEVEL_CWPITCH)
+ return -RIG_EINVAL;
+@@ -604,7 +613,8 @@
+ int ts850_get_mem(RIG *rig, vfo_t vfo, int *ch)
+ {
+ unsigned char infobuf[50];
+- int info_len, retval;
++ int retval;
++ size_t info_len;
+
+ info_len = 50;
+ retval = kenwood_transaction (rig, "IF;", 3, infobuf, &info_len)
+@@ -642,7 +652,8 @@
+ int ts850_get_channel (RIG * rig, channel_t * chan)
+ {
+ unsigned char cmdbuf[16], membuf[30];
+- int retval, cmd_len,mem_len,num;
++ int retval, cmd_len, num;
++ size_t mem_len;
+
+ num=chan->channel_num;
+
+@@ -693,7 +704,8 @@
+ int ts850_set_channel (RIG * rig, const channel_t * chan)
+ {
+ unsigned char cmdbuf[30], membuf[30];
+- int retval, cmd_len,mem_len;
++ int retval, cmd_len;
++ size_t mem_len;
+ int num,freq,tx_freq,tone;
+ char mode,tx_mode,split,tones;
+
diff --git a/comms/hamlib/files/patch-kenwood__ts870s.c b/comms/hamlib/files/patch-kenwood__ts870s.c
new file mode 100644
index 000000000000..91dd6a020b6a
--- /dev/null
+++ b/comms/hamlib/files/patch-kenwood__ts870s.c
@@ -0,0 +1,192 @@
+--- kenwood/ts870s.c.orig Mon Apr 10 00:08:29 2006
++++ kenwood/ts870s.c Mon Apr 10 00:08:39 2006
+@@ -74,7 +74,8 @@
+ static int ts870s_get_vfo(RIG *rig, vfo_t *vfo)
+ {
+ unsigned char vfobuf[50];
+- int vfo_len, retval;
++ int retval;
++ size_t vfo_len;
+
+
+ /* query RX VFO */
+@@ -104,98 +105,100 @@
+
+ static int ts870s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
+ {
+- unsigned char buf[50];
+- int buf_len, retval;
+-
+-
+- buf_len = 50;
+- retval = kenwood_transaction (rig, "MD;", 3, buf, &buf_len);
+- if (retval != RIG_OK)
+- return retval;
+-
+- if (buf_len != 4 || buf[1] != 'D')
+- {
+- rig_debug(RIG_DEBUG_ERR,"%s: unexpected MD answer, len=%d\n",
+- __FUNCTION__,buf_len);
+- return -RIG_ERJCTED;
+- }
+-
+- switch (buf[2])
+- {
+- case MD_CW: *mode = RIG_MODE_CW; break;
+- case MD_CWR: *mode = RIG_MODE_CWR; break;
+- case MD_USB: *mode = RIG_MODE_USB; break;
+- case MD_LSB: *mode = RIG_MODE_LSB; break;
+- case MD_FM: *mode = RIG_MODE_FM; break;
+- case MD_AM: *mode = RIG_MODE_AM; break;
+- case MD_FSK: *mode = RIG_MODE_RTTY; break;
+- case MD_FSKR: *mode = RIG_MODE_RTTYR; break;
+- case MD_NONE: *mode = RIG_MODE_NONE; break;
+- default:
+- rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n",
+- __FUNCTION__,buf[2]);
+- return -RIG_EINVAL;
+- }
+-
+- buf_len = 50;
+- retval = kenwood_transaction (rig, "FW;", 3, buf, &buf_len);
+- if (retval != RIG_OK)
+- return retval;
+-
+- if (buf_len != 7 || buf[1] != 'W')
+- {
+- rig_debug(RIG_DEBUG_ERR,"%s: unexpected FW answer, len=%d\n",
++ unsigned char buf[50];
++ int retval;
++ size_t buf_len;
++
++ buf_len = 50;
++ retval = kenwood_transaction (rig, "MD;", 3, buf, &buf_len);
++ if (retval != RIG_OK)
++ return retval;
++
++ if (buf_len != 4 || buf[1] != 'D')
++ {
++ rig_debug(RIG_DEBUG_ERR,"%s: unexpected MD answer, len=%d\n",
++ __FUNCTION__,buf_len);
++ return -RIG_ERJCTED;
++ }
++
++ switch (buf[2])
++ {
++ case MD_CW: *mode = RIG_MODE_CW; break;
++ case MD_CWR: *mode = RIG_MODE_CWR; break;
++ case MD_USB: *mode = RIG_MODE_USB; break;
++ case MD_LSB: *mode = RIG_MODE_LSB; break;
++ case MD_FM: *mode = RIG_MODE_FM; break;
++ case MD_AM: *mode = RIG_MODE_AM; break;
++ case MD_FSK: *mode = RIG_MODE_RTTY; break;
++ case MD_FSKR: *mode = RIG_MODE_RTTYR; break;
++ case MD_NONE: *mode = RIG_MODE_NONE; break;
++ default:
++ rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode '%c'\n",
++ __FUNCTION__,buf[2]);
++ return -RIG_EINVAL;
++ }
++
++ buf_len = 50;
++ retval = kenwood_transaction (rig, "FW;", 3, buf, &buf_len);
++ if (retval != RIG_OK)
++ return retval;
++
++ if (buf_len != 7 || buf[1] != 'W')
++ {
++ rig_debug(RIG_DEBUG_ERR,"%s: unexpected FW answer, len=%d\n",
+ __FUNCTION__,buf_len);
+- return -RIG_ERJCTED;
+- }
++ return -RIG_ERJCTED;
++ }
+
+- *width = 10 * atoi(&buf[2]);
++ *width = 10 * atoi(&buf[2]);
+
+- return RIG_OK;
++ return RIG_OK;
+ }
+
+ static int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
+ {
+- unsigned char buf[16],ackbuf[16];
+- int buf_len, ack_len, kmode, retval;
+-
+- switch (mode)
+- {
+- case RIG_MODE_CW: kmode = MD_CW; break;
+- case RIG_MODE_CWR: kmode = MD_CWR; break;
+- case RIG_MODE_USB: kmode = MD_USB; break;
+- case RIG_MODE_LSB: kmode = MD_LSB; break;
+- case RIG_MODE_FM: kmode = MD_FM; break;
+- case RIG_MODE_AM: kmode = MD_AM; break;
+- case RIG_MODE_RTTY: kmode = MD_FSK; break;
+- case RIG_MODE_RTTYR: kmode = MD_FSKR; break;
+- default:
+- rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
+- __FUNCTION__,mode);
+- return -RIG_EINVAL;
+- }
+-
+- buf_len = sprintf(buf, "MD%c;", kmode);
+- ack_len = 0;
+- retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len);
+- if (retval != RIG_OK) return retval;
+-
+-/*
+- * This rig will simply use an IF bandpass which is closest to width,
+- * so we don't need to check the value...
+- */
+- buf_len = sprintf(buf, "FW%04d;", (int)width/10);
+- ack_len = 0;
+- retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len);
+- if (retval != RIG_OK) return retval;
++ unsigned char buf[16],ackbuf[16];
++ int buf_len, kmode, retval;
++ size_t ack_len;
++
++ switch (mode)
++ {
++ case RIG_MODE_CW: kmode = MD_CW; break;
++ case RIG_MODE_CWR: kmode = MD_CWR; break;
++ case RIG_MODE_USB: kmode = MD_USB; break;
++ case RIG_MODE_LSB: kmode = MD_LSB; break;
++ case RIG_MODE_FM: kmode = MD_FM; break;
++ case RIG_MODE_AM: kmode = MD_AM; break;
++ case RIG_MODE_RTTY: kmode = MD_FSK; break;
++ case RIG_MODE_RTTYR: kmode = MD_FSKR; break;
++ default:
++ rig_debug(RIG_DEBUG_ERR,"%s: unsupported mode %d\n",
++ __FUNCTION__,mode);
++ return -RIG_EINVAL;
++ }
++
++ buf_len = sprintf(buf, "MD%c;", kmode);
++ ack_len = 0;
++ retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len);
++ if (retval != RIG_OK) return retval;
++
++ /*
++ * This rig will simply use an IF bandpass which is closest to width,
++ * so we don't need to check the value...
++ */
++ buf_len = sprintf(buf, "FW%04d;", (int)width/10);
++ ack_len = 0;
++ retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len);
++ if (retval != RIG_OK) return retval;
+
+- return RIG_OK;
++ return RIG_OK;
+ }
+
+ static int ts870s_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
+ {
+ unsigned char lvlbuf[50];
+- int lvl_len, retval;
++ int retval;
++ size_t lvl_len;
+ int lvl;
+ int i, ret, agclevel;
+
diff --git a/comms/hamlib/files/patch-yaesu__ft817.c b/comms/hamlib/files/patch-yaesu__ft817.c
new file mode 100644
index 000000000000..1d1d5cf6dbe0
--- /dev/null
+++ b/comms/hamlib/files/patch-yaesu__ft817.c
@@ -0,0 +1,11 @@
+--- yaesu/ft817.c.orig Tue Apr 18 23:15:31 2006
++++ yaesu/ft817.c Tue Apr 18 23:16:15 2006
+@@ -288,8 +288,6 @@
+ .get_tone = NULL,
+ .set_ctcss_tone = ft817_set_ctcss_tone,
+ .get_ctcss_tone = NULL,
+- .set_tone = NULL,
+- .get_tone = NULL,
+ .set_dcs_sql = ft817_set_dcs_sql,
+ .get_dcs_sql = NULL,
+ .set_tone_sql = NULL,
diff --git a/comms/hamlib/pkg-plist b/comms/hamlib/pkg-plist
index 52c387dc9a6e..5eaba9556919 100644
--- a/comms/hamlib/pkg-plist
+++ b/comms/hamlib/pkg-plist
@@ -9,6 +9,9 @@ include/hamlib/riglist.h
include/hamlib/rotator.h
include/hamlib/rotclass.h
include/hamlib/rotlist.h
+%%PYTHON_TCL%%lib/_Hamlib.a
+%%PYTHON_TCL%%lib/_Hamlib.la
+%%PYTHON_TCL%%lib/_Hamlib.so
lib/hamlib-alinco.a
lib/hamlib-alinco.la
lib/hamlib-alinco.so
@@ -54,6 +57,9 @@ lib/hamlib-microtune.so
lib/hamlib-pcr.a
lib/hamlib-pcr.la
lib/hamlib-pcr.so
+lib/hamlib-racal.a
+lib/hamlib-racal.la
+lib/hamlib-racal.so
lib/hamlib-rft.a
lib/hamlib-rft.la
lib/hamlib-rft.so
@@ -78,12 +84,18 @@ lib/hamlib-tapr.so
lib/hamlib-tentec.a
lib/hamlib-tentec.la
lib/hamlib-tentec.so
+lib/hamlib-tuner.a
+lib/hamlib-tuner.la
+lib/hamlib-tuner.so
lib/hamlib-uniden.a
lib/hamlib-uniden.la
lib/hamlib-uniden.so
lib/hamlib-winradio.a
lib/hamlib-winradio.la
lib/hamlib-winradio.so
+lib/hamlib-wj.a
+lib/hamlib-wj.la
+lib/hamlib-wj.so
lib/hamlib-yaesu.a
lib/hamlib-yaesu.la
lib/hamlib-yaesu.so
@@ -91,22 +103,29 @@ lib/hamlib-yaesu.so
%%TCL%%lib/hamlibtcl.a
%%TCL%%lib/hamlibtcl.la
%%TCL%%lib/hamlibtcl.so
-lib/libhamlib++-1.2.2.so
-lib/libhamlib++-1.2.2.so.2
+%%TCL%%lib/tcl8.4/hamlib/pkgIndex.tcl
+lib/libhamlib++-%%VER%%.so
+lib/libhamlib++-%%VER%%.so.2
lib/libhamlib++.a
lib/libhamlib++.la
lib/libhamlib++.so
-lib/libhamlib-1.2.2.so
-lib/libhamlib-1.2.2.so.2
+lib/libhamlib-%%VER%%.so
+lib/libhamlib-%%VER%%.so.2
lib/libhamlib.a
lib/libhamlib.la
lib/libhamlib.so
-%%PYTHON%%lib/python/Hamlib.py
-%%PYTHON%%lib/python/Hamlib.pyc
-%%PYTHON%%lib/python/Hamlib.pyo
-%%TCL%%lib/tcl/pkgIndex.tcl
+%%SITE_PERL%%/%%PERL_ARCH%%/auto/Hamlib/.packlist
+%%SITE_PERL%%/%%PERL_ARCH%%/auto/Hamlib/Hamlib.so
+%%SITE_PERL%%/%%PERL_ARCH%%/auto/Hamlib/Hamlib.bs
+%%SITE_PERL%%/%%PERL_ARCH%%/Hamlib.pm
+%%SITE_PERL%%/mach/perltest.pl
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/Hamlib.py
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/Hamlib.pyc
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/Hamlib.pyo
libdata/pkgconfig/hamlib.pc
sbin/rpc.rigd
sbin/rpc.rotd
share/aclocal/hamlib.m4
+%%TCL%%@dirrm lib/tcl8.4/hamlib
+@dirrm %%SITE_PERL%%/mach/auto/Hamlib
@dirrm include/hamlib