From: n0nb <n0...@us...> - 2025-09-23 02:32:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Hamlib -- Ham radio control libraries". The branch, master has been updated via c195d3dd4c66d959119d50a07801836fd6b558da (commit) via b1a673326b152ae763ac49045b267d2be2898710 (commit) via ca638238cb6724d5cf3e0dda0c353b0b430bc413 (commit) via 5e3911b3c32fdddc26af855523d169b6c51bd466 (commit) via 59916293de76d15b4f61023a70900334d60f7d05 (commit) via 6708caa73a0372ebc650cca886df3edf10d8c8f0 (commit) via 942214da6eb95c6309d6d50aa5be52c54a4a5f96 (commit) from 3ea25e6ba072cd1e4c2c2095927ee0e9c805d3c9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c195d3dd4c66d959119d50a07801836fd6b558da Merge: 3ea25e6ba b1a673326 Author: Nate Bargmann <n0...@n0...> Date: Mon Sep 22 21:22:27 2025 -0500 Merge GitHub PR #1882 commit b1a673326b152ae763ac49045b267d2be2898710 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Sep 22 23:53:33 2025 +0200 Wrap wide columns with the list of commands diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index e9c264529..496f148c6 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -1963,6 +1963,7 @@ void usage_rig(FILE *fout) { int i; int column = 1; + int wrapped = 0; fprintf(fout, "Commands (some may not be available for this rig):\n"); @@ -1990,9 +1991,10 @@ void usage_rig(FILE *fout) nbspaces -= fprintf(fout, ",%s", test_list[i].arg3); } - if ((nbspaces < 1) || (column == 2)) + if ((nbspaces < 1) || (column == 2) || wrapped) { fprintf(fout, ")\n"); + wrapped = (nbspaces < 1) && (column == 1); column = 1; } else commit ca638238cb6724d5cf3e0dda0c353b0b430bc413 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Mon Sep 22 22:57:08 2025 +0200 Wrap longer commands in the help text diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 801c259a0..e9c264529 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -1962,14 +1962,15 @@ declare_proto_rig(client_version) void usage_rig(FILE *fout) { int i; + int column = 1; fprintf(fout, "Commands (some may not be available for this rig):\n"); for (i = 0; test_list[i].cmd != 0; i++) { - int nbspaces = 18; + int nbspaces = 20; // longest arguments are 32 chars: "TX Frequency,TX Mode,TX Passband" fprintf(fout, - "%c: %-16s(", + "%c: %-19s(", // longest commands are 19 chars, eg. "set_split_freq_mode" isprint(test_list[i].cmd) ? test_list[i].cmd : '?', test_list[i].name); @@ -1989,13 +1990,15 @@ void usage_rig(FILE *fout) nbspaces -= fprintf(fout, ",%s", test_list[i].arg3); } - if (i % 2) + if ((nbspaces < 1) || (column == 2)) { fprintf(fout, ")\n"); + column = 1; } else { fprintf(fout, ")%*s", nbspaces, " "); + column++; } } commit 5e3911b3c32fdddc26af855523d169b6c51bd466 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Sep 21 19:00:18 2025 +0200 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]... diff --git a/tests/ampctld.c b/tests/ampctld.c index 466a8d48a..ba6454ad0 100644 --- a/tests/ampctld.c +++ b/tests/ampctld.c @@ -681,7 +681,7 @@ handle_exit: static void usage(FILE *fout) { - fprintf(fout, "Usage: ampctld [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: ampctld [OPTION]...\n" "Daemon serving COMMANDs to a connected amplifier.\n\n"); fprintf(fout, diff --git a/tests/rotctld.c b/tests/rotctld.c index c9b06fa43..43f8b28ab 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -705,7 +705,7 @@ handle_exit: static void usage(FILE *fout) { - fprintf(fout, "Usage: rotctld [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: rotctld [OPTION]...\n" "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); fprintf(fout, commit 59916293de76d15b4f61023a70900334d60f7d05 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Sep 21 18:54:09 2025 +0200 Make static all usage() and usage_short() functions diff --git a/tests/ampctl.c b/tests/ampctl.c index af0e37e43..73e54930c 100644 --- a/tests/ampctl.c +++ b/tests/ampctl.c @@ -70,8 +70,8 @@ extern int read_history(); /* * Prototypes */ -void usage(FILE *fout); -void short_usage(FILE *fout); +static void usage(FILE *fout); +static void short_usage(FILE *fout); /* * Reminder: when adding long options, @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: ampctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected amplifier.\n\n"); @@ -470,7 +470,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: ampctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); fprintf(fout, "Send COMMANDs to a connected amplifier.\n\n"); diff --git a/tests/ampctld.c b/tests/ampctld.c index 5e09cb1b4..466a8d48a 100644 --- a/tests/ampctld.c +++ b/tests/ampctld.c @@ -70,9 +70,14 @@ struct handle_data socklen_t clilen; }; + +/* + * Prototypes + */ void *handle_socket(void *arg); +static void usage(FILE *fout); +static void short_usage(FILE *fout); -void usage(FILE *fout); /* * Reminder: when adding long options, @@ -674,7 +679,7 @@ handle_exit: } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: ampctld [OPTION]... [COMMAND]...\n" "Daemon serving COMMANDs to a connected amplifier.\n\n"); @@ -699,7 +704,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: ampctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); fprintf(fout, "Daemon serving COMMANDs to a connected amplifier.\n\n"); diff --git a/tests/rigctl.c b/tests/rigctl.c index 7fe0e415b..28c321e31 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -73,8 +73,11 @@ extern int read_history(); #define MAXNAMSIZ 32 #define MAXNBOPT 100 /* max number of different options */ - +/* + * Prototypes + */ static void usage(FILE *fout); +static void short_usage(FILE *fout); /* * Reminder: when adding long options, @@ -872,7 +875,7 @@ int main(int argc, char *argv[]) } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected radio transceiver or receiver.\n\n"); @@ -912,7 +915,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: rigctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); fprintf(fout, "Send COMMANDs to a connected radio transceiver or receiver.\n\n"); diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index ef2440d0b..94eeae5fb 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -114,7 +114,7 @@ static struct option long_options[] = {0, 0, 0, 0} }; -void usage(FILE *fout); +static void usage(FILE *fout); static int handle_ts2000(void *arg); static RIG *my_rig; /* handle to rig */ @@ -1690,7 +1690,7 @@ static int handle_ts2000(void *arg) } -void usage(FILE *fout) +static void usage(FILE *fout) { char *name = "rigctlcom"; diff --git a/tests/rigctld.c b/tests/rigctld.c index 33e7ba06e..620557f42 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -123,9 +123,12 @@ struct handle_data }; +/* + * Prototypes + */ void *handle_socket(void *arg); -void usage(FILE *fout); - +static void usage(FILE *fout); +static void short_usage(FILE *fout); static unsigned client_count; @@ -1364,7 +1367,7 @@ handle_exit: } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigctld [OPTION]...\n" "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); @@ -1403,7 +1406,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: rigctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); fprintf(fout, "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); diff --git a/tests/rigctlsync.c b/tests/rigctlsync.c index c2636003c..0d98d4f79 100644 --- a/tests/rigctlsync.c +++ b/tests/rigctlsync.c @@ -105,7 +105,7 @@ static struct option long_options[] = {0, 0, 0, 0} }; -void usage(FILE *fout); +static void usage(FILE *fout); static RIG *my_rig; /* handle to rig */ static RIG *my_rig_sync; /* rig the gets synchronized -- freq only for now */ @@ -591,7 +591,7 @@ int main(int argc, char *argv[]) return 0; } -void usage(FILE *fout) +static void usage(FILE *fout) { const char *name = "rigctlsync"; diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c index 66a0c0250..5ccccd09b 100644 --- a/tests/rigctltcp.c +++ b/tests/rigctltcp.c @@ -128,7 +128,7 @@ struct handle_data void *handle_socket(void *arg); -void usage(FILE *fout); +static void usage(FILE *fout); static unsigned client_count; @@ -1364,7 +1364,7 @@ handle_exit: } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigctltcp [OPTION]...\n" "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); diff --git a/tests/rigmem.c b/tests/rigmem.c index 56a605d0b..e26249057 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -54,7 +54,7 @@ extern int csv_parm_load(RIG *rig, const char *infilename); /* * Prototypes */ -void usage(FILE *fout); +static void usage(FILE *fout); void version(); static int set_conf(RIG *rig, char *conf_parms); @@ -372,7 +372,7 @@ void version() } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigmem [OPTION]... COMMAND... FILE\n" "Backup/restore COMMANDs to a connected radio transceiver or receiver.\n\n"); diff --git a/tests/rigsmtr.c b/tests/rigsmtr.c index 27bb5e715..da2623e41 100644 --- a/tests/rigsmtr.c +++ b/tests/rigsmtr.c @@ -356,7 +356,7 @@ void version() } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigsmtr [OPTION]... [time]\n" "Input S-Meter vs Azimuth.\n\n"); diff --git a/tests/rigswr.c b/tests/rigswr.c index 7301a9451..f631ba933 100644 --- a/tests/rigswr.c +++ b/tests/rigswr.c @@ -310,7 +310,7 @@ void version() } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rigswr [OPTION]... start_freq stop_freq [freq_step]\n" "Output SWR vs Frequency.\n\n"); diff --git a/tests/rotctl.c b/tests/rotctl.c index 49d701604..05a4b05c1 100644 --- a/tests/rotctl.c +++ b/tests/rotctl.c @@ -67,10 +67,13 @@ extern int read_history(); #include "rotctl_parse.h" #include "rotlist.h" + /* * Prototypes */ -void usage(FILE *fout); +static void usage(FILE *fout); +static void short_usage(FILE *fout); + /* * Reminder: when adding long options, @@ -479,7 +482,7 @@ int main(int argc, char *argv[]) } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rotctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected antenna rotator.\n\n"); @@ -512,7 +515,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: rotctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); fprintf(fout, "Send COMMANDs to a connected antenna rotator.\n\n"); diff --git a/tests/rotctld.c b/tests/rotctld.c index 5efa12771..c9b06fa43 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -67,9 +67,14 @@ struct handle_data socklen_t clilen; }; + +/* + * Prototypes + */ void *handle_socket(void *arg); +static void usage(FILE *fout); +static void short_usage(FILE *fout); -void usage(FILE *fout); /* * Reminder: when adding long options, @@ -698,7 +703,7 @@ handle_exit: } -void usage(FILE *fout) +static void usage(FILE *fout) { fprintf(fout, "Usage: rotctld [OPTION]... [COMMAND]...\n" "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); @@ -726,7 +731,7 @@ void usage(FILE *fout) } -void short_usage(FILE *fout) +static void short_usage(FILE *fout) { fprintf(fout, "Usage: rotctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); fprintf(fout, "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); commit 6708caa73a0372ebc650cca886df3edf10d8c8f0 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Sun Sep 21 18:22:39 2025 +0200 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. diff --git a/tests/ampctl.c b/tests/ampctl.c index 8ccddf025..af0e37e43 100644 --- a/tests/ampctl.c +++ b/tests/ampctl.c @@ -71,6 +71,7 @@ extern int read_history(); * Prototypes */ void usage(FILE *fout); +void short_usage(FILE *fout); /* * Reminder: when adding long options, @@ -237,7 +238,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -466,3 +468,11 @@ void usage(FILE *fout) usage_amp(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: ampctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); + fprintf(fout, "Send COMMANDs to a connected amplifier.\n\n"); + fprintf(fout, "Type: ampctl --help for extended usage.\n"); +} diff --git a/tests/ampctld.c b/tests/ampctld.c index 3a2928363..5e09cb1b4 100644 --- a/tests/ampctld.c +++ b/tests/ampctld.c @@ -262,7 +262,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -696,3 +697,11 @@ void usage(FILE *fout) usage_amp(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: ampctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); + fprintf(fout, "Daemon serving COMMANDs to a connected amplifier.\n\n"); + fprintf(fout, "Type: ampctld --help for extended usage.\n"); +} diff --git a/tests/rigctl.c b/tests/rigctl.c index 5b13e40ae..7fe0e415b 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -463,7 +463,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -909,3 +910,11 @@ void usage(FILE *fout) usage_rig(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: rigctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); + fprintf(fout, "Send COMMANDs to a connected radio transceiver or receiver.\n\n"); + fprintf(fout, "Type: rigctl --help for extended usage.\n"); +} diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index 0cd456643..ef2440d0b 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -400,7 +400,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rigctld.c b/tests/rigctld.c index 948c51e85..33e7ba06e 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -524,7 +524,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -1400,3 +1401,11 @@ void usage(FILE *fout) usage_rig(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: rigctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); + fprintf(fout, "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); + fprintf(fout, "Type: rigctld --help for extended usage.\n"); +} diff --git a/tests/rigctlsync.c b/tests/rigctlsync.c index 7d8dfbcf7..c2636003c 100644 --- a/tests/rigctlsync.c +++ b/tests/rigctlsync.c @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c index 7d53acc0c..66a0c0250 100644 --- a/tests/rigctltcp.c +++ b/tests/rigctltcp.c @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rigmem.c b/tests/rigmem.c index 1f71444e9..56a605d0b 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rigsmtr.c b/tests/rigsmtr.c index 125581a13..27bb5e715 100644 --- a/tests/rigsmtr.c +++ b/tests/rigsmtr.c @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rigswr.c b/tests/rigswr.c index 99497c146..7301a9451 100644 --- a/tests/rigswr.c +++ b/tests/rigswr.c @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + usage(stderr); exit(1); } } diff --git a/tests/rotctl.c b/tests/rotctl.c index a0660ef7c..49d701604 100644 --- a/tests/rotctl.c +++ b/tests/rotctl.c @@ -258,7 +258,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -509,3 +510,11 @@ void usage(FILE *fout) usage_rot(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: rotctl [OPTION]... [-m ID] [-r DEVICE] [-s BAUD] [COMMAND...|-]\n"); + fprintf(fout, "Send COMMANDs to a connected antenna rotator.\n\n"); + fprintf(fout, "Type: rotctl --help for extended usage.\n"); +} diff --git a/tests/rotctld.c b/tests/rotctld.c index 3e98e31c8..5efa12771 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -267,7 +267,8 @@ int main(int argc, char *argv[]) break; default: - usage(stderr); /* unknown option? */ + /* unknown getopt option */ + short_usage(stderr); exit(1); } } @@ -723,3 +724,11 @@ void usage(FILE *fout) usage_rot(fout); } + + +void short_usage(FILE *fout) +{ + fprintf(fout, "Usage: rotctld [OPTION]... [-m ID] [-r DEVICE] [-s BAUD]\n"); + fprintf(fout, "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); + fprintf(fout, "Type: rotctld --help for extended usage.\n"); +} commit 942214da6eb95c6309d6d50aa5be52c54a4a5f96 Author: Daniele Forsi IU5HKX <iu...@gm...> Date: Fri Aug 15 11:23:17 2025 +0200 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 diff --git a/tests/ampctl.c b/tests/ampctl.c index da664c31a..8ccddf025 100644 --- a/tests/ampctl.c +++ b/tests/ampctl.c @@ -70,7 +70,7 @@ extern int read_history(); /* * Prototypes */ -void usage(); +void usage(FILE *fout); /* * Reminder: when adding long options, @@ -153,7 +153,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -438,12 +438,12 @@ int main(int argc, char *argv[]) } -void usage() +void usage(FILE *fout) { - printf("Usage: ampctl [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: ampctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected amplifier.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select amplifier model number. See model list (-l)\n" " -r, --amp-file=DEVICE set device of the amplifier to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" @@ -464,5 +464,5 @@ void usage() "\n" ); - usage_amp(stdout); + usage_amp(fout); } diff --git a/tests/ampctld.c b/tests/ampctld.c index 3f0bc8284..3a2928363 100644 --- a/tests/ampctld.c +++ b/tests/ampctld.c @@ -72,7 +72,7 @@ struct handle_data void *handle_socket(void *arg); -void usage(); +void usage(FILE *fout); /* * Reminder: when adding long options, @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -673,12 +673,12 @@ handle_exit: } -void usage() +void usage(FILE *fout) { - printf("Usage: ampctld [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: ampctld [OPTION]... [COMMAND]...\n" "Daemon serving COMMANDs to a connected amplifier.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select amplifier model number. See model list (-l)\n" " -r, --amp-file=DEVICE set device of the amplifier to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" @@ -694,5 +694,5 @@ void usage() " -V, --version output version information and exit\n\n", portno); - usage_amp(stdout); + usage_amp(fout); } diff --git a/tests/rigctl.c b/tests/rigctl.c index e001ab4bc..5b13e40ae 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -74,7 +74,7 @@ extern int read_history(); #define MAXNBOPT 100 /* max number of different options */ -static void usage(void); +static void usage(FILE *fout); /* * Reminder: when adding long options, @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) break; case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -463,7 +463,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -871,13 +871,12 @@ int main(int argc, char *argv[]) } -void usage(void) +void usage(FILE *fout) { - printf("Usage: rigctl [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: rigctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected radio transceiver or receiver.\n\n"); - - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (-l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" @@ -908,5 +907,5 @@ void usage(void) "\n" ); - usage_rig(stdout); + usage_rig(fout); } diff --git a/tests/rigctlcom.c b/tests/rigctlcom.c index 255628cd0..0cd456643 100644 --- a/tests/rigctlcom.c +++ b/tests/rigctlcom.c @@ -114,7 +114,7 @@ static struct option long_options[] = {0, 0, 0, 0} }; -void usage(); +void usage(FILE *fout); static int handle_ts2000(void *arg); static RIG *my_rig; /* handle to rig */ @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -400,7 +400,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -411,7 +411,7 @@ int main(int argc, char *argv[]) if (argc == 1) { - usage(); + usage(stderr); exit(1); } @@ -1690,20 +1690,21 @@ static int handle_ts2000(void *arg) } -void usage() +void usage(FILE *fout) { char *name = "rigctlcom"; - printf("Usage: %s -m rignumber -r comport -s baud -R comport [OPTIONS]...\n\n" + + fprintf(fout, "Usage: %s -m rignumber -r comport -s baud -R comport [OPTIONS]...\n\n" "A TS-2000 emulator for rig sharing with programs that don't support Hamlib or FLRig to be able\n" "to use a connected radio transceiver or receiver with FLRig or rigctld via Hamlib.\n\n", name); - printf("Example: Using FLRig with virtual COM5/COM6 and other program:\n"); - printf("\t%s -m 4 -R COM5 -S 115200\n\n", name); - printf("Other program would connect to COM6 and use TS-2000 115200 8N1\n\n"); - printf("See the %s.1 manual page for complete details.\n\n", name); + fprintf(fout, "Example: Using FLRig with virtual COM5/COM6 and other program:\n"); + fprintf(fout, "\t%s -m 4 -R COM5 -S 115200\n\n", name); + fprintf(fout, "Other program would connect to COM6 and use TS-2000 115200 8N1\n\n"); + fprintf(fout, "See the %s.1 manual page for complete details.\n\n", name); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (-l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -R, --rig-file2=DEVICE set device of the virtual com port to operate on\n" @@ -1725,6 +1726,5 @@ void usage() " -V, --version output version information and exit\n\n" ); - printf("\nReport bugs to <ham...@li...>.\n"); - + fprintf(fout, "\nReport bugs to <ham...@li...>.\n"); } diff --git a/tests/rigctld.c b/tests/rigctld.c index 9935f5520..948c51e85 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -124,7 +124,7 @@ struct handle_data void *handle_socket(void *arg); -void usage(void); +void usage(FILE *fout); static unsigned client_count; @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -524,7 +524,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -1363,13 +1363,13 @@ handle_exit: } -void usage(void) +void usage(FILE *fout) { - printf("Usage: rigctld [OPTION]...\n" + fprintf(fout, "Usage: rigctld [OPTION]...\n" "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (-l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" @@ -1398,5 +1398,5 @@ void usage(void) " -V, --version output version information and exit\n\n", portno); - usage_rig(stdout); + usage_rig(fout); } diff --git a/tests/rigctlsync.c b/tests/rigctlsync.c index 9e332a426..7d8dfbcf7 100644 --- a/tests/rigctlsync.c +++ b/tests/rigctlsync.c @@ -105,7 +105,7 @@ static struct option long_options[] = {0, 0, 0, 0} }; -void usage(); +void usage(FILE *fout); static RIG *my_rig; /* handle to rig */ static RIG *my_rig_sync; /* rig the gets synchronized -- freq only for now */ @@ -236,7 +236,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -409,7 +409,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -420,7 +420,7 @@ int main(int argc, char *argv[]) if (argc < 3) { - usage(); + usage(stderr); exit(1); } @@ -591,19 +591,20 @@ int main(int argc, char *argv[]) return 0; } -void usage() +void usage(FILE *fout) { const char *name = "rigctlsync"; - printf("Usage: %s -m rignumber -r comport -s baud -M rignumber -R comport [OPTIONS]...\n\n" + + fprintf(fout, "Usage: %s -m rignumber -r comport -s baud -M rignumber -R comport [OPTIONS]...\n\n" "Will copy frequency from -m rig to -M rig\n" "e.g. will keep SDR# synchronized to a rig.\n\n", name); - printf("Example: Sync freq from rigctld to SDR#\n"); - printf("\t%s -m 2 -M 9 -R 127.0.0.1:4532\n\n", name); - printf("See the %s.1 manual page for complete details.\n\n", name); + fprintf(fout, "Example: Sync freq from rigctld to SDR#\n"); + fprintf(fout, "\t%s -m 2 -M 9 -R 127.0.0.1:4532\n\n", name); + fprintf(fout, "See the %s.1 manual page for complete details.\n\n", name); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (-l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -R, --rig-file2=DEVICE set device of the virtual com port to operate on\n" @@ -620,6 +621,5 @@ void usage() " -V, --version output version information and exit\n\n" ); - printf("\nReport bugs to <ham...@li...>.\n"); - + fprintf(fout, "\nReport bugs to <ham...@li...>.\n"); } diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c index 5e92f8cf9..7d53acc0c 100644 --- a/tests/rigctltcp.c +++ b/tests/rigctltcp.c @@ -128,7 +128,7 @@ struct handle_data void *handle_socket(void *arg); -void usage(void); +void usage(FILE *fout); static unsigned client_count; @@ -301,7 +301,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -1364,13 +1364,12 @@ handle_exit: } -void usage(void) +void usage(FILE *fout) { - printf("Usage: rigctltcp [OPTION]...\n" + fprintf(fout, "Usage: rigctltcp [OPTION]...\n" "Daemon serving COMMANDs to a connected radio transceiver or receiver.\n\n"); - - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (-l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -p, --ptt-file=DEVICE set device of the PTT device to operate on\n" @@ -1400,5 +1399,5 @@ void usage(void) " -V, --version output version information and exit\n\n", portno); - usage_rig(stdout); + usage_rig(fout); } diff --git a/tests/rigmem.c b/tests/rigmem.c index 15154db0a..1f71444e9 100644 --- a/tests/rigmem.c +++ b/tests/rigmem.c @@ -54,7 +54,7 @@ extern int csv_parm_load(RIG *rig, const char *infilename); /* * Prototypes */ -void usage(); +void usage(FILE *fout); void version(); static int set_conf(RIG *rig, char *conf_parms); @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) if (optind + 1 >= argc) { - usage(); + usage(stderr); exit(1); } @@ -348,7 +348,7 @@ int main(int argc, char *argv[]) } else { - usage(); + usage(stderr); exit(1); } @@ -372,13 +372,13 @@ void version() } -void usage() +void usage(FILE *fout) { - printf("Usage: rigmem [OPTION]... COMMAND... FILE\n" + fprintf(fout, "Usage: rigmem [OPTION]... COMMAND... FILE\n" "Backup/restore COMMANDs to a connected radio transceiver or receiver.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (rigctl -l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" @@ -394,7 +394,7 @@ void usage() " -V, --version output version information and exit\n\n" ); - printf( + fprintf(fout, "COMMANDs:\n" " load\n" " save\n" @@ -403,8 +403,7 @@ void usage() " clear\n\n" ); - printf("\nReport bugs to <ham...@li...>.\n"); - + fprintf(fout, "\nReport bugs to <ham...@li...>.\n"); } diff --git a/tests/rigsmtr.c b/tests/rigsmtr.c index 132422ccb..125581a13 100644 --- a/tests/rigsmtr.c +++ b/tests/rigsmtr.c @@ -36,7 +36,7 @@ /* * Prototypes */ -static void usage(); +static void usage(FILE *fout); static void version(); static int set_conf_rig(RIG *rig, char *conf_parms); static int set_conf_rot(ROT *rot, char *conf_parms); @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -356,12 +356,12 @@ void version() } -void usage() +void usage(FILE *fout) { - printf("Usage: rigsmtr [OPTION]... [time]\n" + fprintf(fout, "Usage: rigsmtr [OPTION]... [time]\n" "Input S-Meter vs Azimuth.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (rigctl -l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" @@ -376,8 +376,7 @@ void usage() " -V, --version output version information and exit\n\n" ); - printf("\nReport bugs to <ham...@li...>.\n"); - + fprintf(fout, "\nReport bugs to <ham...@li...>.\n"); } diff --git a/tests/rigswr.c b/tests/rigswr.c index e4f64e562..99497c146 100644 --- a/tests/rigswr.c +++ b/tests/rigswr.c @@ -34,7 +34,7 @@ /* * Prototypes */ -static void usage(); +static void usage(FILE *fout); static void version(); static int set_conf(RIG *rig, char *conf_parms); @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -178,7 +178,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) if (optind + 1 >= argc) { - usage(); + usage(stderr); exit(1); } @@ -310,13 +310,13 @@ void version() } -void usage() +void usage(FILE *fout) { - printf("Usage: rigswr [OPTION]... start_freq stop_freq [freq_step]\n" + fprintf(fout, "Usage: rigswr [OPTION]... start_freq stop_freq [freq_step]\n" "Output SWR vs Frequency.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select radio model number. See model list (rigctl -l)\n" " -r, --rig-file=DEVICE set device of the radio to operate on\n" " -s, --serial-speed=BAUD set serial speed of the serial port\n" @@ -329,8 +329,7 @@ void usage() " -V, --version output version information and exit\n\n" ); - printf("\nReport bugs to <ham...@li...>.\n"); - + fprintf(fout, "\nReport bugs to <ham...@li...>.\n"); } diff --git a/tests/rotctl.c b/tests/rotctl.c index fd740c2d2..a0660ef7c 100644 --- a/tests/rotctl.c +++ b/tests/rotctl.c @@ -70,7 +70,7 @@ extern int read_history(); /* * Prototypes */ -void usage(); +void usage(FILE *fout); /* * Reminder: when adding long options, @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -258,7 +258,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -478,12 +478,12 @@ int main(int argc, char *argv[]) } -void usage() +void usage(FILE *fout) { - printf("Usage: rotctl [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: rotctl [OPTION]... [COMMAND]...\n" "Send COMMANDs to a connected antenna rotator.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select rotator model number. See model list (-l)\n" " -r, --rot-file=DEVICE set device of the rotator to operate on\n" " -R, --rot-file2=DEVICE set device of the 2nd rotator controller to operate on\n" @@ -507,5 +507,5 @@ void usage() "\n" ); - usage_rot(stdout); + usage_rot(fout); } diff --git a/tests/rotctld.c b/tests/rotctld.c index 9410620ea..3e98e31c8 100644 --- a/tests/rotctld.c +++ b/tests/rotctld.c @@ -69,7 +69,7 @@ struct handle_data void *handle_socket(void *arg); -void usage(); +void usage(FILE *fout); /* * Reminder: when adding long options, @@ -185,7 +185,7 @@ int main(int argc, char *argv[]) switch (c) { case 'h': - usage(); + usage(stdout); exit(0); case 'V': @@ -267,7 +267,7 @@ int main(int argc, char *argv[]) break; default: - usage(); /* unknown option? */ + usage(stderr); /* unknown option? */ exit(1); } } @@ -697,12 +697,12 @@ handle_exit: } -void usage() +void usage(FILE *fout) { - printf("Usage: rotctld [OPTION]... [COMMAND]...\n" + fprintf(fout, "Usage: rotctld [OPTION]... [COMMAND]...\n" "Daemon serving COMMANDs to a connected antenna rotator.\n\n"); - printf( + fprintf(fout, " -m, --model=ID select rotator model number. See model list (-l)\n" " -r, --rot-file=DEVICE set device of the rotator to operate on\n" " -R, --rot-file2=DEVICE set device of the 2nd rotator controller to operate on\n" @@ -721,5 +721,5 @@ void usage() " -V, --version output version information and exit\n\n", portno); - usage_rot(stdout); + usage_rot(fout); } ----------------------------------------------------------------------- Summary of changes: tests/ampctl.c | 24 +++++++++++++++++------- tests/ampctld.c | 28 +++++++++++++++++++++------- tests/rigctl.c | 29 ++++++++++++++++++++--------- tests/rigctl_parse.c | 11 ++++++++--- tests/rigctlcom.c | 26 +++++++++++++------------- tests/rigctld.c | 28 ++++++++++++++++++++-------- tests/rigctlsync.c | 24 ++++++++++++------------ tests/rigctltcp.c | 15 +++++++-------- tests/rigmem.c | 21 ++++++++++----------- tests/rigsmtr.c | 15 +++++++-------- tests/rigswr.c | 17 ++++++++--------- tests/rotctl.c | 26 +++++++++++++++++++------- tests/rotctld.c | 28 +++++++++++++++++++++------- 13 files changed, 183 insertions(+), 109 deletions(-) hooks/post-receive -- Hamlib -- Ham radio control libraries |