Commit graph

46 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
George Baltz N3GB
ba3c5624b6 Remove deprecated port references from ampctl.c
As a stand-alone program, ampctl has no need for that data.
2026-02-23 11:02:34 -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
ead67ec170 Replace magic number with define 2025-08-20 12:17:29 +02:00
Daniele Forsi IU5HKX
90ffcadfa5 Refactor to remove code duplication in ampctl*.c 2025-08-19 16:51:31 +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
dc3a71da1b Document existing option to read commands from stdin 2025-05-14 19:41:34 +02:00
Daniele Forsi IU5HKX
57e5dba438 Make usage texts more similar 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
George Baltz N3GB
8150583541 Drop redundant token lookups. 2025-04-20 21:28:57 -04:00
Michael Black W9MDB
89383a553a Fix buffer overrun in ampctl.c 2024-12-22 10:31:17 -06:00
George Baltz N3GB
7bf63ecbf0 More amplifier and rotator state changes 2024-07-14 01:17:28 -04:00
George Baltz N3GB
728db84c0c Finish tests/* 2024-03-01 12:27:26 -05:00
Mike Black W9MDB
05033171c3 Change token_t to hamlib_token_t to avoid collsions with libbsm and others
https://github.com/Hamlib/Hamlib/issues/1469
2024-01-21 23:11:55 -06:00
Mike Black W9MDB
e267c62764 astyle files 2023-12-16 11:37:58 -06:00
Mike Black W9MDB
02ffc6d6dc More set_conf/get_conf work
https://github.com/Hamlib/Hamlib/issues/971
2023-11-05 17:03:21 -06:00
Mike Black W9MDB
d28ce6b798 Bump up some 1024 buffers to 2048 to avoid overflow error 2023-07-21 11:46:58 -05:00
Daniele Forsi IU5HKX
52d41236a7 Enable --show-conf for ampctl and ampctld 2023-03-18 10:25:36 +01:00
Daniele Forsi IU5HKX
3f90086991 [tests] Fix includes 2023-02-16 19:08:24 +01:00
Daniele Forsi IU5HKX
7a132e2703 Remove unused includes
Removes includes of stdio.h stdlib.h string.h unistd.h
2022-07-24 17:08:57 +02:00
Daniele Forsi IU5HKX
4dfe46edbb Remove unused includes related to times and dates
Removes includes of time.h sys/time.h hamlibdatetime.h
2022-07-23 18:12:10 +02:00
Mike Black W9MDB
0333cdfca5 astyle files 2022-03-01 11:40:14 -06:00
Mike Black W9MDB
a360bd0a07 Add some deprecated copies to ampctl.c 2022-02-11 16:28:03 -06:00
Mike Black W9MDB
68e121d82c Change all to remove HAVE_CONFIG dependency and include <hamlib/config.h> by default
This is necessary to keep alignment between the client view of rig->state and the shared libarary view
Including PTHREAD functions in rig->state necessitated this as HAVE_PTHREAD only defined during hamlib compilation.
Clients including hamlib/rig.h did not pick up all the HAVE* config variable that control what gets included
https://github.com/Hamlib/Hamlib/issues/947
2022-02-04 07:41:36 -06:00
Mike Black W9MDB
c2cb94e412 Change sprintf to snprint in tests
https://github.com/Hamlib/Hamlib/issues/857
2022-01-11 00:00:44 -06:00
Michael Black W9MDB
6eee309b56 Improve rig_get_version and hamlib_version2 information to include commit information
https://github.com/Hamlib/Hamlib/issues/617
2021-03-19 22:56:18 -05:00
Michael Black W9MDB
1fcb9404b9 More changes to support macro renaming 2021-03-06 14:59:57 -06:00
Bill Somerville
f38ee5c6f1
Ensure old hamlibdatetime.h headers in the source dir are ignored 2020-10-17 02:31:17 +01:00
Michael Black W9MDB
110cfe7abd Remove warning from ampctl.c 2020-09-02 22:13:11 -05:00
Michael Black W9MDB
fade1681fa Fix cppcheck errors and warnings 2020-09-02 16:56:11 -05:00
Michael Black W9MDB
f454cff0b7 Add check for -s switch on all utils to ensure integer is entered 2020-07-01 08:52:44 -05:00
Michael Black W9MDB
677ccac4bc astyle files 2020-05-27 12:23:08 -05:00
Michael Black W9MDB
fb68d9f561 Add better version info to utilities 2020-05-23 10:58:25 -05:00
Michael Black
ee87d5e6df Fix buffer overrun in all utilities
Change MAXCONFLEN to 1024 bytes for some future proofing
2020-04-01 14:51:50 -05:00
Michael Black
5646eb3fe4
Move hist_dir_stat 2020-01-15 15:58:04 -06:00
Michael Black
4be4b7033b
Clean up HAVE_LIBREADLINE mods 2020-01-15 07:04:40 -06:00
Michael Black
0c63e6efd3
Fix cppcheck warning in ampctl.c 2020-01-13 15:31:19 -06:00
Michael Black
fb73e5abd7
Fix some cppcheck warnings
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 :-)
2019-12-09 17:12:13 -06:00
Michael Black
6bf3b00c4f
astyle all files 2019-11-30 10:19:08 -06:00
Michael Black
2f4d62709e
Added a dummy snprintf to rig_debug to allow gcc to check format strings
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
2019-11-30 10:04:31 -06:00
Michael Black
7e9c566944
Add first cut at amplifier control 2019-06-12 15:52:35 -05:00