Commit graph

1540 commits

Author SHA1 Message Date
George Baltz N3GB
68e1458993
Make a padded copy of input so compare doesn't overread
Cleanup:
Fix typo and formatting
Move RIGCTLD_PASSWORDS from rig.h to rigctl_parse.h

(cherry picked from commit 11dbace230)
2026-06-12 09:05:06 -05:00
George Baltz N3GB
d5ece94f0b
Move password status to connection specific data.
Fix memory leak in rigctld_password_check()

(cherry picked from commit cef2d9d3a9)
2026-06-12 09:04:38 -05:00
George Baltz N3GB
6d8eb8e31b
Infrastructure and setup for associating connection data with thread
Will allow rigctl_parse() routines access to connection data, without
  reworking all of the internal and external interfaces.

(cherry picked from commit b56f8d8f8a)
2026-06-12 09:04:27 -05:00
George Baltz N3GB
47a8c5eec0
Turn off passwords and their help text
Disable them until they work

(cherry picked from commit 7fc1389349)
2026-06-12 09:04:13 -05:00
George Baltz N3GB
47171005bf
Bend boundary->subscript conversion in the right direction.
Don't mess with binary data.

(cherry picked from commit a3a7f00d75)
2026-06-07 18:00:13 -05:00
Gong BI1XJT
24d85cc066
Remove old-fashioned and buggy Android.mk build system
Signed-off-by: Gong BI1XJT <bi1xjt@rad1o.cn>
(cherry picked from commit 60fb8e5fa0)
2026-05-21 11:55:23 -05:00
Gong BI1XJT
d8ec66258c
Correct the linkage of tests/* against Android Sensor rot
Signed-off-by: Gong BI1XJT <bi1xjt@rad1o.cn>
(cherry picked from commit 1f2cebac17)
2026-05-21 11:54:59 -05:00
George Baltz N3GB
3a84b2dd29
Fix errors found by glibc 2.43
glibc implements some new parts of the C23 standard:
(Taken from https://download.opensuse.org/tumbleweed/iso/Changes.20260430.txt)

  * For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
    strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return
    pointers into their input arrays now have definitions as macros that
    return a pointer to a const-qualified type when the input argument is
    a pointer to a const-qualified type

and

  * The aforementioned change in ISO C23 of the declaration of bsearch,
    memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr,
    wcsstr, and wmemchr as const-preserving macros can lead to compilation
    issues in code not set up for it

This lead to some warnings about assigning returns from strchr(const, target)
  to non-const pointers, and then discovering that Hamlib was modifying
  those const parameters.

This commit aligns the const-ness of the offending parameters. Only affects
  internal functions in ampctl_parse.c, rigctl_parse.c and rotctl_parse.c,
  so API/ABI should not change.

(cherry picked from commit 7df5ae1a00)
2026-05-06 12:40:57 -05:00
George Baltz N3GB
490491645a
Avoid warnings from gcc-16
gcc-16 adds warnings about using strncpy() to copy into a buffer with
  size equal to the max count, possibly creating an unterminated string.
  Since we don't care about the contents here and both buffers are the
  same size, just do a byte copy.

(cherry picked from commit b6a25c8a83)
2026-03-14 17:30:47 -05:00
Nate Bargmann
47963c818f
Pause building and installing rigfreqwalk
The utility requires eight arguments but #3, baud, is ignored which
seems to leave it broken and has been ignored for about as long as the
code has been in the repository.  There is also no documentation on the
intended usage of this utility.

Will restore when these issues are resolved.

(cherry picked from commit 6b9bd14d24)
2026-02-14 21:15:46 -06:00
Nate Bargmann
c33b05d9f7
Add rigctltcp manual page
Reorder rigctltcp usage output slightly.

(cherry picked from commit 3703191f67)
2026-02-14 21:15:37 -06:00
George Baltz N3GB
0c8de5ab79
Add the missing commit
Plus a few more arbitrary lengths, so `git grep scanfc` shows no more
  bare "%s" format strings.

(cherry picked from commit f6734ad832)
2026-01-30 18:27:03 -06:00
George Baltz N3GB
61809a8b1e
Same for ampctl_parse.c
Update NEWS
Fix compiler snit about possible truncation

(cherry picked from commit de5087f57a)
2026-01-30 17:47:41 -06:00
George Baltz N3GB
37e57f4a0c
Fix string overflows in rotctl_parse.c
(cherry picked from commit 330b791216)
2026-01-30 17:43:27 -06:00
George Baltz N3GB
897ad1062a
Fix unbounded scanf string in rigctl_parse.c
Thanks to Vlatko Kosturjak with Marlink Cyber, for reporting it.

(cherry picked from commit 9d40f9f180)
2026-01-30 17:43:03 -06:00
Daniele Forsi IU5HKX
8a27cbcd1f
Fix typos
(cherry picked from commit ee42a8c120)
2025-12-26 10:52:31 -06:00
George Baltz N3GB
b779019846
Fix the same leak in rigctltcp.c
(cherry picked from commit 018c86997b)

Missed one

(cherry picked from commit 1cf8d03e13)
2025-12-13 11:51:37 -06:00
George Baltz N3GB
813f210979
Fix memory leak in rigctld
Just started playing with valgrind, and already We have a Winner!
rigctld was leaking ~100 bytes every 5 seconds; rearrange code so
  arg is not allocated until it is needed and will be passed to the
  routine that will free() it.
Also fix uninitialized variable warning.

(cherry picked from commit 08a013b87b)
2025-12-13 11:47:48 -06:00
George Baltz N3GB
bc5b5b6725 Use auto storage instead of clobbering string literal. 2025-10-06 13:08:19 -04:00
Daniele Forsi IU5HKX
bceb1a1fdf Do not use abbreviations where there is enough space 2025-10-05 11:36:03 +02:00
Daniele Forsi IU5HKX
486ec607dd Remove space for consistency with other descriptions 2025-10-05 11:31:10 +02:00
Daniele Forsi IU5HKX
a7188c201a Put set_gpio before get_gpio
Like other set/get pairs.
2025-10-05 09:02:00 +02:00
Daniele Forsi IU5HKX
0546e764af Update comments
All letters are used now, rig_set/rig_get are added and -W is
reserved by POSIX.2 for implementation extensions of get_opt,
but it doesn't apply here because this code is using strcmp()
and the W command which is implemented is not prefixed by a '-'.
2025-10-05 00:29:01 +02:00
Daniele Forsi IU5HKX
19ce6d30b0 Put get_conf near set_conf 2025-10-04 22:37:09 +02:00
Daniele Forsi IU5HKX
6238a5ef1b Reorder commands in --help output
Puts more related get/set commands side by side in the columnar output.
2025-10-04 21:51:00 +02:00
Daniele Forsi IU5HKX
c0717e7834 Remove duplicated command from --help output 2025-10-04 21:30:36 +02:00
Daniele Forsi IU5HKX
b1a673326b Wrap wide columns with the list of commands 2025-09-22 23:53:33 +02:00
Daniele Forsi IU5HKX
ca638238cb Wrap longer commands in the help text 2025-09-22 22:57:08 +02:00
Daniele Forsi IU5HKX
5e3911b3c3 The ampctld and rotctld do not read COMMANDs from their command line
Test case:
tests/ampctld -h | head -1
tests/rigctld -h | head -1
tests/rotctld -h | head -1

Expected output:
Usage: ampctld [OPTION]...
Usage: rigctld [OPTION]...
Usage: rotctld [OPTION]...
2025-09-21 22:20:29 +02:00
Daniele Forsi IU5HKX
59916293de Make static all usage() and usage_short() functions 2025-09-21 22:20:29 +02:00
Daniele Forsi IU5HKX
6708caa73a Print a shorter usage text for unknown options
Test case:
tests/ampctl -Q
tests/ampctld -Q
tests/rigctl -Q
tests/rigctld -Q
tests/rotctl -Q
tests/rotctld -Q

Expected output:
/home/ham/Hamlib/tests/.libs/ampctl: invalid option -- 'Q'
Usage: ampctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected amplifier.

Type: ampctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/ampctld: invalid option -- 'Q'
Usage: ampctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected amplifier.

Type: ampctld --help for extended usage.
/home/ham/Hamlib/tests/.libs/rigctl: invalid option -- 'Q'
Usage: rigctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected radio transceiver or receiver.

Type: rigctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/rigctld: invalid option -- 'Q'
Usage: rigctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected radio transceiver or receiver.

Type: rigctld --help for extended usage.
/home/ham/Hamlib/tests/.libs/rotctl: invalid option -- 'Q'
Usage: rotctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]
Send COMMANDs to a connected antenna rotator.

Type: rotctl --help for extended usage.
/home/ham/Hamlib/tests/.libs/rotctld: invalid option -- 'Q'
Usage: rotctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]
Daemon serving COMMANDs to a connected antenna rotator.

Type: rotctld --help for extended usage.
2025-09-21 22:20:15 +02:00
Daniele Forsi IU5HKX
942214da6e Direct usage text to stderr or stdout depending on context
Prints usage text to stdout when requested with -h/--help
or to stderr otherwise.

Test cases:
tests/rigctl --help # prints to stdout
tests/rigctl -Q # prints to stderr
2025-09-21 18:12:32 +02:00
Nate Bargmann
95cd7391a2
Merge GitHub PR #1917 2025-09-19 08:07:16 -05:00
Nate Bargmann
d04364e685
Use pkgconf/pkg-config to test for libusb-1.0
As reported in GitHub issue #1892, configure on FreeBSD failed to search
for the name of the library correctly which is libusb.  As pkg-config
correctly holds the library name for linking, modify the search for
libusb-1.0 to use the pkg-config capability.  If pkg-config (now largely
replaced by pkgconf) is not installed or found, the modules depending on
it will be gracefull disabled, i.e. the configure script will complete
with those modules disabled.

Modify the output summary to use spaces instead of tabs as things were
not lining up nicely in my FreeBSD terminal.

Rename the Automake substituted variable 'HAVE_LIBUSB' to
'TESTS_HAVE_LIBUSB' to avoid confusion with identically named variable
written to include/hamlib/config.h.

Likewise, rename the AutoConf substituted name 'LIBUSB' to
'HAMLIB_PC_LIBUSB' to avoid confusion with the 'LIBUSB' string passed to
PKG_CHECK_MODULES.

Update hamlib.pc.in and tests/Makefile.am to use the new variable names.

Make sure all source files no longer reference HAVE_LIBUSB_H or
HAVE_LIBUSB_1_0_LIBUSB_H as these variables no longer exist.

Fix src/Makefile.am to provide include path for usb_port.c.
2025-09-17 21:31:37 -05:00
Nate Bargmann
fd68f38743
Merge GitHub PR #1914 2025-09-17 20:12:20 -05:00
George Baltz N3GB
409949194e Once more into the breech... 2025-09-17 21:08:30 -04:00
Daniele Forsi IU5HKX
fb04375e36 Fix build failure when trying to build tests on a clean tree
Fixes:
make: *** No rule to make target '../lib/libmisc.la', needed by 'rigctl'.

Steps to reproduce:
make clean
make -j12 -C tests
2025-09-18 00:01:01 +02:00
Daniele Forsi IU5HKX
2a01ecdc5d Fix setting the variable HAVE_LIBUSB for makefiles 2025-09-14 17:09:09 +02:00
Daniele Forsi IU5HKX
901682ba30 [rigctl] Use "fout" for consistency
This makes no difference in the current code, but other usages
of dumpconf_list() are different:
$ grep dumpconf_list *parse.c
rigctl_parse.c:        dumpconf_list(rig, stdout);
rigctl_parse.c:        dumpconf_list(rig, fout);
rotctl_parse.c:        dumpconf_list(rot, fout);
rotctl_parse.c:        dumpconf_list(rot, fout);
rotctl_parse.c:    dumpconf_list(rot, fout);
2025-09-03 20:32:09 +02:00
Nate Bargmann
f15537f2e6
Merge GitHub PR #1875 2025-09-02 15:38:54 -05:00
Daniele Forsi IU5HKX
e4c43821d0 Always print error messages to stderr
Do not depend on the debug level set with --verbose
2025-09-02 21:54:18 +02:00
Nate Bargmann
4c520571df
Merge GitHub PR #1876 2025-08-31 20:11:12 -05:00
George Baltz N3GB
1c0de2107c Remove conditionals based on HAVE_PTHREAD 2025-08-30 11:29:45 -04:00
Daniele Forsi IU5HKX
632746cf91 Use rig_debug() instead of sending error messages to stdout 2025-08-30 16:20:32 +02:00
Daniele Forsi IU5HKX
39e155efe7 Fix include config.h
It should be included, with its path, before any hamlib include
and before any #ifdef that uses the symbols that it defines.
2025-08-30 11:18:51 +02:00
George Baltz N3GB
002677e48c Still more pthread conditional code cleanup 2025-08-27 15:24:50 -04:00
Nate Bargmann
0a06af1dde
Merge GitHub PR #1867 2025-08-24 17:22:57 -05:00
Daniele Forsi IU5HKX
bc8dbca1f3 Remove duplicated rig_type[] lines 2025-08-24 20:18:30 +02:00
Daniele Forsi IU5HKX
06a2a25cb7 Remove misleading duplicated error message
The correct error message has been printed by getopt_long()
before returning.

Test cases:
$ rigmem -Q
rigmem: invalid option -- 'Q'
Unknown option '?'
Usage: rigmem [OPTION]... COMMAND... FILE
...

$ rigmem --foo
rigmem: unrecognized option '--foo'
Unknown option '?'
Usage: rigmem [OPTION]... COMMAND... FILE
...
2025-08-24 18:55:56 +02:00
Daniele Forsi IU5HKX
5ba906c9aa Document building testsecurity
At some time, the commented out line check_PROGRAMS removed by this commit was
identical to the line following it, plus testsecurity appended, then they went
out of sync.
The commented out line check_PROGRAMS added by this commit appends testsecurity
in an explicit way.
2025-08-21 09:03:59 +02:00