From 19621b8becf00f4784bdb0aff5e2d875eab159de Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Fri, 23 Jun 2023 20:48:46 +0200 Subject: [PATCH 01/10] Add keyword to start tlf in S&P mode --- src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index 84ae17113..a0a4c3b1b 100644 --- a/src/main.c +++ b/src/main.c @@ -443,6 +443,7 @@ static const struct argp_option options[] = { {"sync", 's', "URL", 0, "Synchronize log with other node" }, {"debug", 'd', 0, 0, "Debug mode" }, {"verbose", 'v', 0, 0, "Produce verbose output" }, + {"s&p", 'p', 0, 0, "Start in Search and Pounce mode" }, { 0 } }; @@ -482,6 +483,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { case 'v': // verbose startup verbose = true; break; + case 'p': // run in s&p mode + cqmode = S_P; + break; default: return ARGP_ERR_UNKNOWN; From b2944902c95b7d77efcf833a9f8343887833aea5 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Fri, 23 Jun 2023 20:57:22 +0200 Subject: [PATCH 02/10] Fix formating --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index a0a4c3b1b..640236aea 100644 --- a/src/main.c +++ b/src/main.c @@ -483,9 +483,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { case 'v': // verbose startup verbose = true; break; - case 'p': // run in s&p mode - cqmode = S_P; - break; + case 'p': // run in s&p mode + cqmode = S_P; + break; default: return ARGP_ERR_UNKNOWN; From f8a986a6eb81fe62b8b92f2e99c79a65827f5879 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Wed, 28 Jun 2023 20:13:15 +0200 Subject: [PATCH 03/10] Move setup operation mode to config file --- share/logcfg.dat | 9 +++++++++ src/main.c | 6 ------ src/parse_logcfg.c | 26 ++++++++++++++++++++++++++ src/parse_logcfg.h | 1 - 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/share/logcfg.dat b/share/logcfg.dat index d12d9b7ac..2878fbdf0 100644 --- a/share/logcfg.dat +++ b/share/logcfg.dat @@ -45,6 +45,15 @@ CALL=NOCALL # ################################# # # +# OPERATING MODE # +# # +################################# +# Can be set to RUN, S&P, AUTO_CQ, KEYBOARD or NONE +OPERATING_MODE=RUN +# +# +################################# +# # # Time offset from UTC # # # ################################# diff --git a/src/main.c b/src/main.c index 640236aea..0c9009b07 100644 --- a/src/main.c +++ b/src/main.c @@ -443,7 +443,6 @@ static const struct argp_option options[] = { {"sync", 's', "URL", 0, "Synchronize log with other node" }, {"debug", 'd', 0, 0, "Debug mode" }, {"verbose", 'v', 0, 0, "Produce verbose output" }, - {"s&p", 'p', 0, 0, "Start in Search and Pounce mode" }, { 0 } }; @@ -483,10 +482,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { case 'v': // verbose startup verbose = true; break; - case 'p': // run in s&p mode - cqmode = S_P; - break; - default: return ARGP_ERR_UNKNOWN; } @@ -699,7 +694,6 @@ static int databases_load() { return EXIT_FAILURE; } - if (multlist == 1) { showmsg("Reading multiplier data "); if (strlen(multsfile) == 0) { diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 9481a01c6..b4811d6e5 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -51,6 +51,7 @@ #include "startmsg.h" #include "tlf_curses.h" #include "searchlog.h" +#include "tlf.h" bool exist_in_country_list(); @@ -350,6 +351,30 @@ static int cfg_contest(const cfg_arg_t arg) { return PARSE_OK; } +static int cfg_operation_mode(const cfg_arg_t arg) { + char *str = g_ascii_strup(parameter, -1); + g_strstrip(str); + + if (strcmp(str, "RUN") == 0) { + cqmode = CQ; + } else if (strcmp(str, "S&P") == 0) { + cqmode = S_P; + } else if (strcmp(str, "AUTO") == 0) { + cqmode = AUTO_CQ; + } else if (strcmp(str, "KEYBOARD") == 0) { + cqmode = KEYBOARD; + } else if (strcmp(str, "NONE") == 0) { + cqmode = NONE; + } else { + g_free(str); + error_details = g_strdup("must be RUN, S&P, AUTO, KEYBOARD or NONE"); + return PARSE_WRONG_PARAMETER; + } + + g_free(str); + return PARSE_OK; +} + static int cfg_bandoutput(const cfg_arg_t arg) { char *str = g_strdup(parameter); g_strstrip(str); @@ -1301,6 +1326,7 @@ static config_t logcfg_configs[] = { {"CABRILLO-(.+)", OPTIONAL_PARAM, cfg_cabrillo_field}, {"RESEND_CALL", NEED_PARAM, cfg_resend_call}, {"GENERIC_MULT", NEED_PARAM, cfg_generic_mult}, + {"OPERATING_MODE", NEED_PARAM, cfg_operation_mode}, {NULL} // end marker }; diff --git a/src/parse_logcfg.h b/src/parse_logcfg.h index 50dd2d82d..aefe418ec 100644 --- a/src/parse_logcfg.h +++ b/src/parse_logcfg.h @@ -43,7 +43,6 @@ extern char *error_details; //////////////////////////////////// // config parsing definitions - enum { NO_PARAM, NEED_PARAM, From 2d0318eda1f4cbe6c5c60afc0f50fcbe940b83e8 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Wed, 28 Jun 2023 21:33:22 +0200 Subject: [PATCH 04/10] Update manual and added test for new function --- share/logcfg.dat | 4 ++-- src/parse_logcfg.c | 10 ++-------- test/test_parse_logcfg.c | 7 +++++++ tlf.1.in | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/share/logcfg.dat b/share/logcfg.dat index 2878fbdf0..0f3caf209 100644 --- a/share/logcfg.dat +++ b/share/logcfg.dat @@ -48,8 +48,8 @@ CALL=NOCALL # OPERATING MODE # # # ################################# -# Can be set to RUN, S&P, AUTO_CQ, KEYBOARD or NONE -OPERATING_MODE=RUN +# Can be set to CQ, S&P +OPERATING_MODE=CQ # # ################################# diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index b4811d6e5..5b75499bf 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -355,19 +355,13 @@ static int cfg_operation_mode(const cfg_arg_t arg) { char *str = g_ascii_strup(parameter, -1); g_strstrip(str); - if (strcmp(str, "RUN") == 0) { + if (strcmp(str, "CQ") == 0) { cqmode = CQ; } else if (strcmp(str, "S&P") == 0) { cqmode = S_P; - } else if (strcmp(str, "AUTO") == 0) { - cqmode = AUTO_CQ; - } else if (strcmp(str, "KEYBOARD") == 0) { - cqmode = KEYBOARD; - } else if (strcmp(str, "NONE") == 0) { - cqmode = NONE; } else { g_free(str); - error_details = g_strdup("must be RUN, S&P, AUTO, KEYBOARD or NONE"); + error_details = g_strdup("must be CQ or S&P"); return PARSE_WRONG_PARAMETER; } diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 871bb66b7..1709a216b 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -190,6 +190,7 @@ int setup_default(void **state) { exclude_multilist_type = EXCLUDE_NONE; rigptt = 0; minitest = 0; + cqmode = S_P; setcontest(QSO_MODE); @@ -915,6 +916,12 @@ void test_ssbmode(void **state) { assert_int_equal(trxmode, SSBMODE); } +void test_operation_mode(void **state) { + int rc = call_parse_logcfg("OPERATION_MODE\n"); + assert_int_equal(rc, 0); + assert_int_equal(cqmode, S_P); +} + // TLFCOLOR1..6 void test_tlfcolorn(void **state) { char line[80]; diff --git a/tlf.1.in b/tlf.1.in index 9aa9d5b35..1f4abbfcf 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -1656,6 +1656,10 @@ The station callsign used in messages; also used to determine the station's country, zone and continent. . .TP +\fBOPERATION_MODE\fR=\fICQ\fR +Default operation mode CQ for RUN and S&P for Search and Pounce +. +.TP \fBTIME_OFFSET\fR=\fI0\fR Used to shift the @PACKAGE_NAME@ time with respect to the computer clock. . From b3500cfb6af2cfeb525e1f9523d0d3390c23c4fd Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Wed, 28 Jun 2023 21:47:37 +0200 Subject: [PATCH 05/10] Fix tests --- test/test_parse_logcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 1709a216b..14500ee20 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -190,7 +190,7 @@ int setup_default(void **state) { exclude_multilist_type = EXCLUDE_NONE; rigptt = 0; minitest = 0; - cqmode = S_P; + cqmode = CQ; setcontest(QSO_MODE); @@ -917,9 +917,9 @@ void test_ssbmode(void **state) { } void test_operation_mode(void **state) { - int rc = call_parse_logcfg("OPERATION_MODE\n"); + int rc = call_parse_logcfg("OPERATING_MODE=CQ\n"); assert_int_equal(rc, 0); - assert_int_equal(cqmode, S_P); + assert_int_equal(cqmode, CQ); } // TLFCOLOR1..6 From 2e6e2f6874cf2c9c6c0cc1e3071c38fc4333399a Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Thu, 29 Jun 2023 05:16:03 +0200 Subject: [PATCH 06/10] Post review fixes. --- src/main.c | 2 ++ src/parse_logcfg.c | 4 ++-- src/parse_logcfg.h | 1 + test/test_parse_logcfg.c | 6 +++--- tlf.1.in | 5 +++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 0c9009b07..84ae17113 100644 --- a/src/main.c +++ b/src/main.c @@ -482,6 +482,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { case 'v': // verbose startup verbose = true; break; + default: return ARGP_ERR_UNKNOWN; } @@ -694,6 +695,7 @@ static int databases_load() { return EXIT_FAILURE; } + if (multlist == 1) { showmsg("Reading multiplier data "); if (strlen(multsfile) == 0) { diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 5b75499bf..a4b2f01e6 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -351,7 +351,7 @@ static int cfg_contest(const cfg_arg_t arg) { return PARSE_OK; } -static int cfg_operation_mode(const cfg_arg_t arg) { +static int cfg_operating_mode(const cfg_arg_t arg) { char *str = g_ascii_strup(parameter, -1); g_strstrip(str); @@ -1320,7 +1320,7 @@ static config_t logcfg_configs[] = { {"CABRILLO-(.+)", OPTIONAL_PARAM, cfg_cabrillo_field}, {"RESEND_CALL", NEED_PARAM, cfg_resend_call}, {"GENERIC_MULT", NEED_PARAM, cfg_generic_mult}, - {"OPERATING_MODE", NEED_PARAM, cfg_operation_mode}, + {"OPERATING_MODE", NEED_PARAM, cfg_operating_mode}, {NULL} // end marker }; diff --git a/src/parse_logcfg.h b/src/parse_logcfg.h index aefe418ec..50dd2d82d 100644 --- a/src/parse_logcfg.h +++ b/src/parse_logcfg.h @@ -43,6 +43,7 @@ extern char *error_details; //////////////////////////////////// // config parsing definitions + enum { NO_PARAM, NEED_PARAM, diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 14500ee20..4cea3512a 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -916,10 +916,10 @@ void test_ssbmode(void **state) { assert_int_equal(trxmode, SSBMODE); } -void test_operation_mode(void **state) { - int rc = call_parse_logcfg("OPERATING_MODE=CQ\n"); +void test_operating_mode(void **state) { + int rc = call_parse_logcfg("OPERATING_MODE=S&P\n"); assert_int_equal(rc, 0); - assert_int_equal(cqmode, CQ); + assert_int_equal(cqmode, S_P); } // TLFCOLOR1..6 diff --git a/tlf.1.in b/tlf.1.in index 1f4abbfcf..24d3b1266 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -1656,8 +1656,9 @@ The station callsign used in messages; also used to determine the station's country, zone and continent. . .TP -\fBOPERATION_MODE\fR=\fICQ\fR -Default operation mode CQ for RUN and S&P for Search and Pounce +\fBOPERATING_MODE\fR=\fICQ\fR +Set operating mode for start up. Use \fICQ\fR for "run" and \fIS&P\fR for "search and pounce". +The default mode is \fICQ\fR. . .TP \fBTIME_OFFSET\fR=\fI0\fR From eddfbfd59248b200e8dec4521729467b15a3d5b1 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Thu, 29 Jun 2023 09:03:31 +0200 Subject: [PATCH 07/10] Update man pages --- tlf.1.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tlf.1.in b/tlf.1.in index 24d3b1266..e5cb13228 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -1656,7 +1656,7 @@ The station callsign used in messages; also used to determine the station's country, zone and continent. . .TP -\fBOPERATING_MODE\fR=\fICQ\fR +\fBOPERATING_MODE\fR=\fICQ\fR|\fIS&P\fR Set operating mode for start up. Use \fICQ\fR for "run" and \fIS&P\fR for "search and pounce". The default mode is \fICQ\fR. . From 5fe36d538679e16cb36adeaceb30669e4cc4cab3 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Thu, 29 Jun 2023 09:15:02 +0200 Subject: [PATCH 08/10] Move operating_mode initalization to init_variables --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 84ae17113..af1c724ba 100644 --- a/src/main.c +++ b/src/main.c @@ -182,7 +182,7 @@ int cluster = NOCLUSTER; /* 0 = OFF, 1 = FOLLOW, 2 = spots 3 = all */ bool clusterlog = false; /* clusterlog on/off */ bool searchflg = false; /* display search window */ bool show_time = false; -cqmode_t cqmode = CQ; +cqmode_t cqmode; /* can be CQ or S&P */ bool demode = false; /* send DE before s&p call */ int announcefilter = FILTER_ANN; /* filter cluster announcements */ @@ -636,7 +636,7 @@ static void init_variables() { tune_seconds = 6; /* tune up for 6 s */ unique_call_multi = MULT_NONE; generic_mult = MULT_NONE; - + cqmode = CQ; leading_zeros_serial = true; ctcomp = false; resend_call = RESEND_NOT_SET; From d10b061c6dc774d5b7d8adc2d7218bd47b2ff68c Mon Sep 17 00:00:00 2001 From: darvark Date: Thu, 29 Jun 2023 19:52:52 +0200 Subject: [PATCH 09/10] Update ToDo. Marked item finished --- ToDo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ToDo b/ToDo index 2a85fd491..f504b44c5 100644 --- a/ToDo +++ b/ToDo @@ -28,7 +28,7 @@ Planned for later versions list of most used RST values which will then be used for scrolling, e.g. CHANGE_RST=339,479,599 or similar. [x] Have a template for cabrillo file header (suggested by Joop PG4I) -[ ] Add a keyword to startup TLF in S&P mode (should be an easy one) +[x] Add a keyword to startup TLF in S&P mode (should be an easy one) [ ] switch between ESM and CT mode during contest (Nate N0NB) [x] Send Morse via Hamlib for radios that support it. Tnx Christoph DF7CB and others. From b5e504e4dece376bb8b23ad0785baf7642fb97e2 Mon Sep 17 00:00:00 2001 From: Marcin SP6MI Date: Sat, 5 Aug 2023 22:14:22 +0200 Subject: [PATCH 10/10] Adapt autoreconf to new version 2.7 --- configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 32f31b630..6948c9f4e 100644 --- a/configure.ac +++ b/configure.ac @@ -13,11 +13,10 @@ dnl Clean compilation output makes compiler warnings more visible m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # Checks for programs. -AC_PROG_CC_C99 +iC_PROG_CC AC_PROG_INSTALL # Checks for header files. -AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h \ sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h])