Commit graph

84 commits

Author SHA1 Message Date
George Baltz N3GB
0b2b91f538 Get rid of all 'mode_t' declarations
Use rmode_t for real hamlib modes, appropriate types for others.
2026-05-10 12:11:01 -04:00
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
Daniele Forsi IU5HKX
4ce5763cb9 Fix exit statuses
Exit status 2 is for invalid command line options or arguments.
Exit status 2 is for errors returned by Hamlib.
2025-06-06 23:58:02 +02:00
Nate Bargmann
c92fee947a
Merge GitHub PR #1709 2025-06-05 21:42:20 -05:00
George Baltz N3GB
7d28822273 Add '#include "cache.h"' to all files that reference cache structure.
Issue #1420
2025-06-03 12:07:27 -04: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
Daniele Forsi IU5HKX
b141c14270 Make help strings more similar
Fixes text indent and verbs.
2025-04-19 23:57:26 +02:00
Michael Black W9MDB
12c453ccd3 Fix buffer overflow in rigctlcom.c
https://github.com/Hamlib/Hamlib/security/code-scanning/3213
2024-12-21 14:41:25 -06:00
Michael Black W9MDB
be045da06b Fix set_mode on rigctlcom 2024-12-04 17:15:35 -06:00
Michael Black W9MDB
941e69eda5 Fix set_mode on rigctlcom 2024-12-03 23:19:16 -06:00
Mike Black W9MDB
befb2ffcdf Add a bit more debug to rigctlcom.c 2024-05-30 10:03:01 -05:00
Mike Black W9MDB
00dbd6a6df Fix rigctlcom.s IF command for CW Skimmer use and others that might use IF command 2024-03-29 17:09:38 -05:00
George Baltz N3GB
c7665cb7d1 All struct rig_cache referenced converted to pointers. 2024-03-09 21:23:01 -05:00
George Baltz N3GB
07f8023d17 Convert tests/* to pointers 2024-03-01 12:27:26 -05:00
Mike Black W9MDB
911692c715 Remove some debug from rigctlcom.c 2024-02-20 12:05:51 -06:00
Mike Black W9MDB
8cc6ce1319 Fix rigctlcom.c for Icom rigs and those that don't have get_vfo 2024-02-19 11:46:16 -06:00
Mike Black W9MDB
91ec3afcda Fix get_vfo for Icom rigs in rigctlcom.c 2024-02-19 10:42:25 -06:00
Mike Black W9MDB
1657a0e673 Fix rigctlcom.c 2024-02-19 10:34:15 -06:00
George Baltz N3GB
b1d85e5aa1 Update dcdport usage in tests/*.c
Issue #1445
2024-02-05 11:28:30 -05: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
Mike Black W9MDB
778889e06a Fix rigctlcom.c and rigctlsync. version 2023-07-11 11:19:07 -05:00
Daniele Forsi IU5HKX
2db37fe7db Fix typos 2023-03-26 11:01:51 +02:00
Daniele Forsi IU5HKX
3f90086991 [tests] Fix includes 2023-02-16 19:08:24 +01:00
Mike Black W9MDB
560afb9de2 Add SM and KS commands to rigctlcom to work better with DXCommander
https://github.com/Hamlib/Hamlib/issues/1170
2022-12-02 10:34:29 -06: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
Mike Black W9MDB
668db3a0e2 Update rigctlcom information 2022-07-14 16:55:24 -05:00
Mike Black W9MDB
6f9d057162 astyle files getting ready for release 2022-05-13 16:50:13 -05:00
Mike Black W9MDB
382282ba20 Fix rigctl option -B 2022-04-25 08:18:06 -05:00
Mike Black W9MDB
b55668e2fa Update usage and no arg for -B option 2022-04-25 08:09:51 -05:00
Mike Black W9MDB
6497048f28 Allow rigctlcom to map set_freq on VFOA to VFOB instead
This will allow CW Skimmer to work with some rigs (e.g. IC7300) using FM
mode on VFOA and CW mode on VFOB and split mode transmit on VFOB.
Clicking on CW Skimmer will change VFOB instead of VFOA to allow working
dxpeditions where the fox is staying on frequency
2022-04-24 14:19:20 -05:00
Mike Black W9MDB
8c34ce1a2d astyle source code 2022-02-05 15:27:43 -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
7b4b7ee630 Add a depth count to debug statements to help understand calling sequences
First call into rig functions is level 1
Top level like rigctl, rigctld is level 0
Non-depth calls are internal debug statements -- which can be modified to also show levels but that's a whole lot of statements not really necessary
Normal calls from other clients will be level 1
2022-01-30 23:37:01 -06:00
Mike Black W9MDB
a277d7ab9b Changes changing hamlib_port_t to pointer are not backwards compatible 2022-01-25 17:41:26 -06:00
Mike Black W9MDB
9e86e62238 Enable async I/O by default
Change hamlib_port_t to a pointer in rig.state
Deprecate static hamlib_port_t structure
New hamlib_port_t structure at end of rig.state
Clients built with older hamlib will use old structure in DLL
Clients built with newer hamlib will use new structure in DLL
So we maintain backwards compatibility until Hamlib 5.0
https://github.com/Hamlib/Hamlib/issues/894
2022-01-25 07:59:47 -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
Mikael Nousiainen
c764336e73 Fix build warnings caused by changes to I/O function signatures 2021-12-18 23:49:45 +02:00
Mike Black W9MDB
d820ee9dbf Add expected_len to read_string function for potential serial I/O speedup
https://github.com/Hamlib/Hamlib/issues/850
2021-11-24 13:02:39 -06:00
Mike Black W9MDB
8fe190d622 Reduce error messages about RIG_VFO_OTHER which only applies to some rigs like Icom rigs with the 0x25 command
Add a flush_flag to read_string so that the new serial_flush will not produce a timeout value when flushing
https://github.com/Hamlib/Hamlib/issues/835
2021-11-01 23:43:45 -05:00
Mike Black W9MDB
283281c4cb astyle all files preparing for 4.3 release 2021-08-26 06:49:24 -05:00
Mike Black W9MDB
4bfd71f91f Fix Icom split and implement reverse split
These should work now from rigctl and via the API
S VFOB 1 VFOA
S Sub 1 Main
https://github.com/Hamlib/Hamlib/issues/754
2021-08-02 23:37:31 -05:00
Michael Black W9MDB
1fdbebd7b2 Fix rigctlcom VFOB set_freq
https://github.com/Hamlib/Hamlib/issues/620
2021-03-20 11:51:41 -05:00