diff --git a/configure.ac b/configure.ac index d5e31b18..60ba550a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may dnl contain other characters or be empty m4_define(FLDIGI_MAJOR, [3]) m4_define(FLDIGI_MINOR, [0]) -m4_define(FLDIGI_PATCH, []) +m4_define(FLDIGI_PATCH, [1]) AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com]) diff --git a/src/logger/logger.cxx b/src/logger/logger.cxx index d8a5a107..f0756efa 100644 --- a/src/logger/logger.cxx +++ b/src/logger/logger.cxx @@ -88,40 +88,32 @@ const char *ADIFHEADER = \n\n"; -int writeadif () { +void writeadif () { // open the adif file -#ifndef __CYGWIN__ - string sfname = HomeDir; - sfname.append("fldigi.adif"); -#else - string sfname = "C:/FL_LOGBOOK/log.adif"; -#endif FILE *adiFile; -#ifndef __CYGWIN__ - adiFile = fopen (sfname.c_str(), "r"); - if (!adiFile) { - adiFile = fopen(sfname.c_str(),"w"); - if (!adiFile) - return 1; - fprintf (adiFile, ADIFHEADER, - strlen(ADIF_VERS), ADIF_VERS, - strlen(PACKAGE_NAME), PACKAGE_NAME, - strlen(PACKAGE_VERSION), PACKAGE_VERSION); - fclose(adiFile); - } else - fclose(adiFile); -#endif +// Append to fldigi.adif on all platforms + string sfname = HomeDir; + sfname.append("fldigi.adif"); adiFile = fopen (sfname.c_str(), "a"); - if (!adiFile) - return 1; + if (adiFile) { // write the current record to the file - adif.append("\n"); - fprintf(adiFile,"%s", adif.c_str()); -// printf("%s", adif.c_str()); -// fflush(adiFile); - fclose (adiFile); - return 0; + adif.append("\n"); + fprintf(adiFile,"%s", adif.c_str()); + fclose (adiFile); + } + +// Append to FL_LOGBOOK adif file on Windows if and only if C:\FL_LOGBOOK exists +#ifdef __CYGWIN__ + sfname = "C:/FL_LOGBOOK/log.adif"; + adiFile = fopen (sfname.c_str(), "a"); + if (adiFile) { +// write the current record to the file + adif.append("\n"); + fprintf(adiFile,"%s", adif.c_str()); + fclose (adiFile); + } +#endif } void putadif(int num, const char *s) diff --git a/src/misc/configuration.cxx b/src/misc/configuration.cxx index 116bdcf8..f964e66a 100644 --- a/src/misc/configuration.cxx +++ b/src/misc/configuration.cxx @@ -224,7 +224,7 @@ configuration progdefaults = { "", // string strCommPorts 9876, // int rx_msgid 6789, // int tx_msgid - "localhost", // string arq_address + "127.0.0.1", // string arq_address "3122", // string arq_port // PSK viewer parameters true, // bool VIEWERmarquee @@ -234,7 +234,7 @@ configuration progdefaults = { 10.0, // double VIEWERsquelch 15, // int VIEWERtimeout false, // bool xmlrpc_server - "localhost", // string xmlrpc_address + "127.0.0.1", // string xmlrpc_address "7362", // string xmlrpc_port }; @@ -1641,39 +1641,42 @@ FL_UNLOCK(); void configuration::testCommPorts() { - char COM[] = "COMx"; - char ttyS[] = "/dev/ttySx"; - char ttyUSB[] = "/dev/ttyUSBx"; - char devttyUSB[] = "/dev/usb/ttyUSBx"; int fd; strCommPorts = "Ports:"; - - for (int i = 0; i < 4; i++) { - ttyS[9] = '0' + i; - COM[3] = '1' + i; - if ((fd = open( ttyS, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) - break; + char COM[7] = "COMxxx"; + char sztty[20] = "/dev/usb/ttyUSBxxx"; +#ifdef __CYGWIN__ + for (int i = 0; i < 255; i++) { +#else + for (int i = 0; i < 8; i++) { +#endif + snprintf(sztty, sizeof(sztty), "/dev/ttyS%-d", i); + snprintf(COM, sizeof(COM), "COM%-d", i+1); + if ((fd = open( sztty, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) + continue; strCommPorts += '\n'; - strCommPorts.append(ttyS); - strCommPorts.append(" or "); +#ifdef __CYGWIN__ strCommPorts.append(COM); +#else + strCommPorts.append(sztty); +#endif close(fd); } - for (int i = 0; i < 4; i++) { - ttyUSB[11] = '0' + i; - if ((fd = open( ttyUSB, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) - break; + for (int i = 0; i < 8; i++) { + snprintf(sztty, sizeof(sztty), "/dev/ttyUSB%-d", i); + if ((fd = open( sztty, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) + continue; strCommPorts += '\n'; - strCommPorts.append(ttyUSB); + strCommPorts.append(sztty); close(fd); } - for (int i = 0; i < 4; i++) { - devttyUSB[15] = '0' + i; - if ((fd = open( devttyUSB, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) - break; + for (int i = 0; i < 8; i++) { + snprintf(sztty, sizeof(sztty), "/dev/usb/ttyUSB%-d", i); + if ((fd = open( sztty, O_RDWR | O_NOCTTY | O_NDELAY)) < 0) + continue; strCommPorts += '\n'; - strCommPorts.append(devttyUSB); + strCommPorts.append(sztty); close(fd); } } diff --git a/src/misc/socket.cxx b/src/misc/socket.cxx index abe01dbb..b7778330 100644 --- a/src/misc/socket.cxx +++ b/src/misc/socket.cxx @@ -45,6 +45,11 @@ #include "socket.h" +#if HAVE_GETADDRINFO && !defined(AI_NUMERICSERV) +# define AI_NUMERICSERV 0 +#endif + + using namespace std; // @@ -617,7 +622,7 @@ size_t Socket::send(const void* buf, size_t len) if (!wait(1)) return 0; - ssize_t r = ::send(sockfd, buf, len, MSG_NOSIGNAL); + ssize_t r = ::send(sockfd, buf, len, 0); if (r == 0) shutdown(sockfd, SHUT_WR); else if (r == -1) {