Fix declarations after statements
Remove some !rig checks...we either don't need them or need them everywhere with a new error code
If you pass a NULL rig you get what you deserve :-)
This found tons of errors in rig_debug statements
So this patch cleans up all the files that were producing warnings or errors
This should fix a few segfaults when running with debug turned on
On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following
warning:
CC network.lo
../../hamlib/src/network.c: In function ‘network_open’:
../../hamlib/src/network.c:245:46: warning: ‘%s’ directive output may be truncated writing up to 511 bytes into a region of size 139 [-Wformat-truncation=]
snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname);
^~
../../hamlib/src/network.c:245:9: note: ‘snprintf’ output between 44 and 555 bytes into a destination of size 150
snprintf(msg,sizeof(msg),"connect to %s failed, (trying next interface)",rp->pathname);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Raising the size of the msg buffer to 1024 quelled the warning.
This means that rigctl & rigctld now work with default arguments on a
modern Windows machine with dual stack and localhost being [::1] as
the first interface returned by getaddrinfo().
Try all the interfaces return by DNS lookups to establish a connection
or listening port. Handle Windows network errors correctly so that
meaningful messages are printed.
The rigctl program now accepts IPv6 numeric addresses in the portname
field like [<addr>}:<port> for example the IPv6 loopback on port 4531
would be [::1]:4531.
Trying to run the pthread enabled binaries on W2k resulted in an error
dialog with the text, "The procedure entry point freeaddrinfo could not be
located in ws2_32.dll". A Microsoft support page
(http://support.microsoft.com/kb/955045) hints that when 'ws2tcpip.h' is
included that 'wspiapi.h' should be included as well. Since MinGw
includes both files, this patch corrects the runtime error on W2k