From ab422bb9b1e9e84d66338ecc3249ebd8ffb54ed0 Mon Sep 17 00:00:00 2001 From: David Freese Date: Sun, 19 May 2013 13:20:34 -0500 Subject: [PATCH] Free BSD mods * Changes required by recent Free BSD library mods --- src/misc/configuration.cxx | 48 +-------------------------------- src/throb/throb.cxx | 4 ++- src/xmlrpcpp/XmlRpcDispatch.cpp | 9 ++++++- 3 files changed, 12 insertions(+), 49 deletions(-) diff --git a/src/misc/configuration.cxx b/src/misc/configuration.cxx index cdf7fbd2..3781dbc6 100644 --- a/src/misc/configuration.cxx +++ b/src/misc/configuration.cxx @@ -904,8 +904,6 @@ static bool open_serial(const char* dev) void configuration::testCommPorts() { -// int retval; - inpTTYdev->clear(); inpRIGdev->clear(); inpXmlRigDevice->clear(); @@ -920,56 +918,12 @@ void configuration::testCommPorts() char ttyname[PATH_MAX + 1]; #endif -/* -#ifdef __linux__ - bool ret = false; - DIR* sys = NULL; - char cwd[PATH_MAX] = { '.', '\0' }; - if (getcwd(cwd, sizeof(cwd)) == NULL || chdir("/sys/class/tty") == -1 || - (sys = opendir(".")) == NULL) - goto out; - - ssize_t len; - struct dirent* dp; - while ((dp = readdir(sys))) { -# ifdef _DIRENT_HAVE_D_TYPE - if (dp->d_type != DT_LNK) - continue; -# endif - if ((len = readlink(dp->d_name, ttyname, sizeof(ttyname)-1)) == -1) - continue; - ttyname[len] = '\0'; - if (!strstr(ttyname, "/devices/virtual/")) { - snprintf(ttyname, sizeof(ttyname), "/dev/%s", dp->d_name); - if (stat(ttyname, &st) == -1 || !S_ISCHR(st.st_mode)) - continue; - LOG_VERBOSE("Found serial port %s", ttyname); - inpTTYdev->add(ttyname); -#if USE_HAMLIB - inpRIGdev->add(ttyname); -#endif - inpXmlRigDevice->add(ttyname); - } - } - ret = true; - -out: - if (sys) - closedir(sys); - retval = chdir(cwd); - if (ret) // do we need to fall back to the probe code below? - return; -#endif // __linux__ - -*/ const char* tty_fmt[] = { #if defined(__linux__) "/dev/ttyS%u", "/dev/ttyUSB%u", "/dev/usb/ttyUSB%u" -#elif defined(__FreeBSD__) - "/dev/ttyd%u" -#elif defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) "/dev/tty%2.2u" #elif defined(__CYGWIN__) "/dev/ttyS%u" diff --git a/src/throb/throb.cxx b/src/throb/throb.cxx index 2bc96049..b246d3d7 100644 --- a/src/throb/throb.cxx +++ b/src/throb/throb.cxx @@ -37,6 +37,8 @@ #include "fl_digi.h" #include "status.h" +#define MAX_TONES 15 + #undef CLAMP #define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) @@ -410,7 +412,7 @@ void throb::decodechar(int tone1, int tone2) void throb::rx(complex in) { - complex rxword[num_tones]; + complex rxword[MAX_TONES]; int i, tone1, tone2, maxtone; symbol[symptr] = in; diff --git a/src/xmlrpcpp/XmlRpcDispatch.cpp b/src/xmlrpcpp/XmlRpcDispatch.cpp index bf37fd58..53d19cdf 100644 --- a/src/xmlrpcpp/XmlRpcDispatch.cpp +++ b/src/xmlrpcpp/XmlRpcDispatch.cpp @@ -10,7 +10,14 @@ #include #include -#include + +#if defined(__FreeBSD__) +# ifdef USE_FTIME +# include +# endif +#else +# include +#endif // __FreeBSD__ #if defined(_WINDOWS) # include