Commit graph

23 commits

Author SHA1 Message Date
George Baltz N3GB
29c4ec4778 Finish adding #include's for things moving out of rig.h
Clean compile & execution with both NO_OLD_INCLUDES and NO_OLD_STRUCTS
  defined.
2026-02-23 11:12:15 -05: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
Daniele Forsi IU5HKX
cbefd0835f Do not show any debug trace messages unless requested with -vvvvv
This fixes the following commands that always printed debug messages
at the trace level:
 tests/ampctld -l >/dev/null
 tests/ampctl -h >/dev/null
 tests/rigctld -l >/dev/null
 tests/rigctltcp -l >/dev/null
 tests/rotctld -l >/dev/null
It doesn't affect other software which worked around this issue,
but changes all software to avoid regressions in future.

Test case (should print nothing in bash):
{
tests/ampctl -l -h
tests/ampctld -l -h
tests/rigctl -l -h
tests/rigctlcom -l -h
tests/rigctld -l -h
tests/rigctlsync -l -h
tests/rigctltcp -l -h
tests/rotctl -l -h
tests/rotctld -l -h
} >/dev/null
2025-08-20 17:03:32 +02:00
Daniele Forsi IU5HKX
5a001ab3aa Explicitely initialize static int verbose 2025-08-20 12:17:29 +02:00
Daniele Forsi IU5HKX
7fce140970 Make help texts more similar 2025-08-19 16:51:19 +02:00
Daniele Forsi IU5HKX
0267068220 Fix ambiguity between system includes and Hamlib includes 2025-07-22 23:33:57 +02:00
Nate Bargmann
c92fee947a
Merge GitHub PR #1709 2025-06-05 21:42:20 -05:00
Daniele Forsi IU5HKX
b03dea99b5 Allow to give the command lines options --list or --version 2025-05-14 19:41:34 +02:00
Daniele Forsi IU5HKX
55cae893f0 Fix definition of -B/--mapa2b command line option
It doesn't accept an argument.
2025-05-14 19:41:34 +02:00
Daniele Forsi IU5HKX
20b92ea115 Remove dead code
The code removed could never be executed because getopt()/getopt_long()
detect a missing argument only if it is at the end of the command line
and return '?' which is handled by the default case of the switch which
prints an error message to stderr.
2025-04-21 22:37:37 +02:00
Michael Black W9MDB
9624f06be9 Fix buffer overflow in rigctlsync.c
https://github.com/Hamlib/Hamlib/security/code-scanning/3215
2024-12-21 14:40:02 -06:00
George Baltz N3GB
07f8023d17 Convert tests/* to pointers 2024-03-01 12:27:26 -05:00
George Baltz N3GB
b1d85e5aa1 Update dcdport usage in tests/*.c
Issue #1445
2024-02-05 11:28:30 -05:00
Mike Black W9MDB
d72127f29a Fix cppcheck warnings 2023-10-11 23:22:42 -05:00
Mike Black W9MDB
c93440706f Fix rigctlsync.c compilation 2023-10-02 23:27:57 -05:00
Mike Black W9MDB
5ac1e50b80 Fix always true conditions found by cppcheck
https://github.com/Hamlib/Hamlib/issues/1351
2023-10-02 23:10:58 -05:00
Mike Black W9MDB
d28ce6b798 Bump up some 1024 buffers to 2048 to avoid overflow error 2023-07-21 11:46:58 -05:00
Mike Black W9MDB
778889e06a Fix rigctlcom.c and rigctlsync. version 2023-07-11 11:19:07 -05:00
Daniele Forsi IU5HKX
3f90086991 [tests] Fix includes 2023-02-16 19:08:24 +01:00
Mike Black W9MDB
2cec9e6d57 Update rigctlsync 2023-01-27 23:49:47 -06:00
Mike Black W9MDB
9bc5c4a883 Add rigctlsync utility to allow synchornizing a rig to SDR# 2023-01-27 23:35:31 -06:00