From 473f16629cb4a705cca83e5589bec5eb6604b83f Mon Sep 17 00:00:00 2001 From: zcsahok Date: Wed, 26 Oct 2022 19:18:30 +0000 Subject: [PATCH 1/3] allow unsetting boolean configs --- src/parse_logcfg.c | 151 ++++++++++++++++++++++++--------------- src/parse_logcfg.h | 10 ++- test/test_parse_logcfg.c | 21 +++++- 3 files changed, 114 insertions(+), 68 deletions(-) diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 34552560a..4a7705488 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -141,6 +141,12 @@ int getidxbybandstr(char *confband) { return -1; } +static void str_toupper(char *str) { + for (char *p = str; *p; ++p) { + *p = g_ascii_toupper(*p); + } +} + //////////////////// // global variables for matcher functions: GMatchInfo *match_info; @@ -177,14 +183,43 @@ static int parse_int(const char *string, gint64 min, gint64 max, int *result) { return PARSE_OK; } -int cfg_bool_const(const cfg_arg_t arg) { - *arg.bool_p = arg.bool_value; +static int parse_bool(const char *string, bool *result) { + + gchar *str = NULL; + if (string != NULL) { + str = g_strdup(string); + g_strstrip(str); + str_toupper(str); // normalize to upper case + } + + bool value; + + if (str == NULL || str[0] == 0 // no or empty input is true + || strcmp(str, "TRUE") == 0 + || strcmp(str, "YES") == 0 + || strcmp(str, "ON") == 0) { + value = true; + } else if (strcmp(str, "FALSE") == 0 + || strcmp(str, "NO") == 0 + || strcmp(str, "OFF") == 0) { + value = false; + } else { + g_free(str); + return PARSE_WRONG_PARAMETER; + } + + g_free(str); + + *result = value; return PARSE_OK; } -int cfg_contest_bool_const(const cfg_arg_t arg) { - *(bool *)((char *)contest + arg.offset) = arg.bool_value; - return PARSE_OK; +int cfg_bool(const cfg_arg_t arg) { + return parse_bool(parameter, arg.bool_p); +} + +int cfg_contest_bool(const cfg_arg_t arg) { + return parse_bool(parameter, (bool *)((char *)contest + arg.offset)); } int cfg_int_const(const cfg_arg_t arg) { @@ -298,9 +333,7 @@ static int cfg_call(const cfg_arg_t arg) { return PARSE_WRONG_PARAMETER; } - for (char *p = my.call; *p; ++p) { - *p = g_ascii_toupper(*p); - } + str_toupper(my.call); return PARSE_OK; } @@ -1094,58 +1127,58 @@ static int cfg_resend_call(const cfg_arg_t arg) { } static config_t logcfg_configs[] = { - {"CONTEST_MODE", CFG_BOOL_TRUE(iscontest)}, - {"MIXED", CFG_BOOL_TRUE(mixedmode)}, - {"IGNOREDUPE", CFG_BOOL_TRUE(ignoredupe)}, - {"USE_CONTINENTLIST_ONLY", CFG_BOOL_TRUE(continentlist_only)}, - {"RADIO_CONTROL", CFG_BOOL_TRUE(trx_control)}, - {"PORTABLE_MULT_2", CFG_BOOL_TRUE(portable_x2)}, - - {"USEPARTIALS", CFG_BOOL_TRUE(use_part)}, - {"PARTIALS", CFG_BOOL_TRUE(partials)}, - {"RECALL_MULTS", CFG_CONTEST_BOOL_TRUE(recall_mult)}, - {"WYSIWYG_MULTIBAND", CFG_BOOL_TRUE(wysiwyg_multi)}, - {"WYSIWYG_ONCE", CFG_BOOL_TRUE(wysiwyg_once)}, - {"RIT_CLEAR", CFG_BOOL_TRUE(rit)}, + {"CONTEST_MODE", CFG_BOOL(iscontest)}, + {"MIXED", CFG_BOOL(mixedmode)}, + {"IGNOREDUPE", CFG_BOOL(ignoredupe)}, + {"USE_CONTINENTLIST_ONLY", CFG_BOOL(continentlist_only)}, + {"RADIO_CONTROL", CFG_BOOL(trx_control)}, + {"PORTABLE_MULT_2", CFG_BOOL(portable_x2)}, + + {"USEPARTIALS", CFG_BOOL(use_part)}, + {"PARTIALS", CFG_BOOL(partials)}, + {"RECALL_MULTS", CFG_CONTEST_BOOL(recall_mult)}, + {"WYSIWYG_MULTIBAND", CFG_BOOL(wysiwyg_multi)}, + {"WYSIWYG_ONCE", CFG_BOOL(wysiwyg_once)}, + {"RIT_CLEAR", CFG_BOOL(rit)}, {"SHORT_SERIAL", CFG_INT_ONE(shortqsonr)}, - {"NO_LEADING_ZEROS_SERIAL", CFG_BOOL_TRUE(noleadingzeros)}, - {"SCOREWINDOW", CFG_BOOL_TRUE(showscore_flag)}, - {"CHECKWINDOW", CFG_BOOL_TRUE(searchflg)}, - {"SEND_DE", CFG_BOOL_TRUE(demode)}, - {"SERIAL_EXCHANGE", CFG_CONTEST_BOOL_TRUE(exchange_serial)}, - {"COUNTRY_MULT", CFG_BOOL_TRUE(country_mult)}, - {"CQWW_M2", CFG_BOOL_TRUE(cqwwm2)}, - {"LAN_DEBUG", CFG_BOOL_TRUE(landebug)}, - {"CALLUPDATE", CFG_BOOL_TRUE(call_update)}, - {"TIME_MASTER", CFG_BOOL_TRUE(time_master)}, - {"CTCOMPATIBLE", CFG_BOOL_TRUE(ctcomp)}, - {"SERIAL\\+SECTION", CFG_BOOL_TRUE(serial_section_mult)}, - {"SECTION_MULT", CFG_BOOL_TRUE(sectn_mult)}, - {"NOB4", CFG_BOOL_TRUE(nob4)}, - {"SHOW_TIME", CFG_BOOL_TRUE(show_time)}, - {"RXVT", CFG_BOOL_TRUE(use_rxvt)}, - {"WAZMULT", CFG_BOOL_TRUE(wazmult)}, - {"ITUMULT", CFG_BOOL_TRUE(itumult)}, - {"CONTINENT_EXCHANGE", CFG_BOOL_TRUE(exc_cont)}, - {"NOAUTOCQ", CFG_BOOL_TRUE(noautocq)}, - {"NO_BANDSWITCH_ARROWKEYS", CFG_BOOL_TRUE(no_arrows)}, - {"SOUNDCARD", CFG_BOOL_TRUE(sc_sidetone)}, - {"LOWBAND_DOUBLE", CFG_BOOL_TRUE(lowband_point_mult)}, - {"CLUSTER_LOG", CFG_BOOL_TRUE(clusterlog)}, - {"SERIAL\\+GRID4", CFG_BOOL_TRUE(serial_grid4_mult)}, - {"LOGFREQUENCY", CFG_BOOL_TRUE(logfrequency)}, - {"NO_RST", CFG_BOOL_TRUE(no_rst)}, - {"SERIAL_OR_SECTION", CFG_BOOL_TRUE(serial_or_section)}, - {"PFX_MULT", CFG_BOOL_TRUE(pfxmult)}, - {"PFX_MULT_MULTIBAND", CFG_BOOL_TRUE(pfxmultab)}, - {"QTCREC_RECORD", CFG_BOOL_TRUE(qtcrec_record)}, - {"QTC_AUTO_FILLTIME", CFG_BOOL_TRUE(qtc_auto_filltime)}, - {"QTC_RECV_LAZY", CFG_BOOL_TRUE(qtc_recv_lazy)}, - {"BMAUTOGRAB", CFG_BOOL_TRUE(bmautograb)}, - {"BMAUTOADD", CFG_BOOL_TRUE(bmautoadd)}, - {"SPRINTMODE", CFG_BOOL_TRUE(sprint_mode)}, - {"KEYER_BACKSPACE", CFG_BOOL_TRUE(keyer_backspace)}, - {"SECTION_MULT_ONCE", CFG_BOOL_TRUE(sectn_mult_once)}, + {"NO_LEADING_ZEROS_SERIAL", CFG_BOOL(noleadingzeros)}, + {"SCOREWINDOW", CFG_BOOL(showscore_flag)}, + {"CHECKWINDOW", CFG_BOOL(searchflg)}, + {"SEND_DE", CFG_BOOL(demode)}, + {"SERIAL_EXCHANGE", CFG_CONTEST_BOOL(exchange_serial)}, + {"COUNTRY_MULT", CFG_BOOL(country_mult)}, + {"CQWW_M2", CFG_BOOL(cqwwm2)}, + {"LAN_DEBUG", CFG_BOOL(landebug)}, + {"CALLUPDATE", CFG_BOOL(call_update)}, + {"TIME_MASTER", CFG_BOOL(time_master)}, + {"CTCOMPATIBLE", CFG_BOOL(ctcomp)}, + {"SERIAL\\+SECTION", CFG_BOOL(serial_section_mult)}, + {"SECTION_MULT", CFG_BOOL(sectn_mult)}, + {"NOB4", CFG_BOOL(nob4)}, + {"SHOW_TIME", CFG_BOOL(show_time)}, + {"RXVT", CFG_BOOL(use_rxvt)}, + {"WAZMULT", CFG_BOOL(wazmult)}, + {"ITUMULT", CFG_BOOL(itumult)}, + {"CONTINENT_EXCHANGE", CFG_BOOL(exc_cont)}, + {"NOAUTOCQ", CFG_BOOL(noautocq)}, + {"NO_BANDSWITCH_ARROWKEYS", CFG_BOOL(no_arrows)}, + {"SOUNDCARD", CFG_BOOL(sc_sidetone)}, + {"LOWBAND_DOUBLE", CFG_BOOL(lowband_point_mult)}, + {"CLUSTER_LOG", CFG_BOOL(clusterlog)}, + {"SERIAL\\+GRID4", CFG_BOOL(serial_grid4_mult)}, + {"LOGFREQUENCY", CFG_BOOL(logfrequency)}, + {"NO_RST", CFG_BOOL(no_rst)}, + {"SERIAL_OR_SECTION", CFG_BOOL(serial_or_section)}, + {"PFX_MULT", CFG_BOOL(pfxmult)}, + {"PFX_MULT_MULTIBAND", CFG_BOOL(pfxmultab)}, + {"QTCREC_RECORD", CFG_BOOL(qtcrec_record)}, + {"QTC_AUTO_FILLTIME", CFG_BOOL(qtc_auto_filltime)}, + {"QTC_RECV_LAZY", CFG_BOOL(qtc_recv_lazy)}, + {"BMAUTOGRAB", CFG_BOOL(bmautograb)}, + {"BMAUTOADD", CFG_BOOL(bmautoadd)}, + {"SPRINTMODE", CFG_BOOL(sprint_mode)}, + {"KEYER_BACKSPACE", CFG_BOOL(keyer_backspace)}, + {"SECTION_MULT_ONCE", CFG_BOOL(sectn_mult_once)}, {"F([1-9]|1[0-2])", CFG_MESSAGE(message, -1)}, // index is 1-based {"S&P_TU_MSG", CFG_MESSAGE(message, SP_TU_MSG)}, diff --git a/src/parse_logcfg.h b/src/parse_logcfg.h index 3afc30e95..50dd2d82d 100644 --- a/src/parse_logcfg.h +++ b/src/parse_logcfg.h @@ -67,7 +67,6 @@ typedef struct { }; union { // extra info int int_value; - bool bool_value; struct { int string_type; int base, size; @@ -86,12 +85,11 @@ typedef struct { cfg_arg_t arg; } config_t; -#define CFG_BOOL_TRUE(var) NO_PARAM, cfg_bool_const, \ - (cfg_arg_t){.bool_p=&var, .bool_value=true} +#define CFG_BOOL(var) OPTIONAL_PARAM, cfg_bool, \ + (cfg_arg_t){.bool_p=&var} -#define CFG_CONTEST_BOOL_TRUE(var) NO_PARAM, cfg_contest_bool_const, \ - (cfg_arg_t){.offset=offsetof(contest_config_t, var), \ - .bool_value=true} +#define CFG_CONTEST_BOOL(var) OPTIONAL_PARAM, cfg_contest_bool, \ + (cfg_arg_t){.offset=offsetof(contest_config_t, var)} #define CFG_INT_CONST(var,n) NO_PARAM, cfg_int_const, \ (cfg_arg_t){.int_p=&var, .int_value=n} diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 9c87fec4c..616d9fd08 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -376,11 +376,26 @@ void test_usepartials(void **state) { assert_int_equal(use_part, 1); } -void test_usepartials_with_arg(void **state) { - int rc = call_parse_logcfg("USEPARTIALS=no\n"); +void test_usepartials_no(void **state) { + use_part = true; + int rc = call_parse_logcfg("USEPARTIALS = no\n"); // space around = + assert_int_equal(rc, PARSE_OK); + assert_int_equal(use_part, false); +} + +void test_usepartials_yes(void **state) { + use_part = false; + int rc = call_parse_logcfg("USEPARTIALS=yes\n"); + assert_int_equal(rc, PARSE_OK); + assert_int_equal(use_part, true); +} + +void test_usepartials_wrong_arg(void **state) { + int rc = call_parse_logcfg("USEPARTIALS=abc\n"); assert_int_equal(rc, PARSE_ERROR); assert_string_equal(showmsg_spy, - "Keyword 'USEPARTIALS' can't have a parameter. See man page.\n"); + "Wrong parameter format for keyword 'USEPARTIALS'. See man page.\n"); + } typedef struct { From 9bb973057cb54a9d338be1ba9ee8c28ca01c51e2 Mon Sep 17 00:00:00 2001 From: zcsahok Date: Mon, 7 Nov 2022 19:01:23 +0000 Subject: [PATCH 2/3] update man page --- tlf.1.in | 101 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/tlf.1.in b/tlf.1.in index 9a0655d37..1c6aeaea2 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -1507,6 +1507,13 @@ Make sure you edit the .I logcfg.dat file for at least your callsign and your preferred system configuration. . +.P +Parameters requiring a boolean value (like \fItrue\fR/\fIfalse\fR) +can have an optional case-insensitive argument. +Alternatively, both \fIyes\fR and \fIon\fR are treated as \fItrue\fR. +Similarly instead of \fIfalse\fR also \fIno\fR or \fIoff\fR can be used. +Without the argument the default assigned value is \fIyes\fR. +. . .SH logcfg.dat STATEMENTS . @@ -1534,7 +1541,7 @@ File on remote host you want to synchronize with (use syntax). . .TP -.B CTCOMPATIBLE +\fBCTCOMPATIBLE\fR[=<\fION\fR|\fIOFF\fR>] Do not use the TR-Log QSO sequence, but use .BR + , .B Insert @@ -1599,6 +1606,10 @@ to the same colour pallet as the Linux console. Most other terminals have their own way of setting the colour pallet. . .TP +\fBRXVT\fR[=<\fION\fR|\fIOFF\fR>] +Use \fBrxvt\fR's colours. +. +.TP \fBEDITOR\fR=\fInano\fR | \fIvi\fR[\fIm\fR] | \fI\fR Editor used to modify the QSO log or logcfg.dat. . @@ -1630,7 +1641,7 @@ Normally 0. Range: 0\(en23. . .TP -.B TIME_MASTER +\fBTIME_MASTER\fR[=<\fION\fR|\fIOFF\fR>] This node transmits the time over the network (only one master allowed!). . .TP @@ -1772,13 +1783,13 @@ Delay activation of the Push To Talk pin. Range: 0\(en50. . .TP -.B KEYER_BACKSPACE +\fBKEYER_BACKSPACE\fR[=<\fION\fR|\fIOFF\fR>] Support backspace key in keyer window. . .SS Sound Commands . .TP -.B SOUNDCARD +\fBSOUNDCARD\fR[=<\fION\fR|\fIOFF\fR>] Use soundcard for CW sidetone output. . .TP @@ -1878,7 +1889,7 @@ for 20, 15 and 10. This comes in handy when you have 3 dipoles and a 3-band beam (...). . .TP -.B NO_BANDSWITCH_ARROWKEYS +\fBNO_BANDSWITCH_ARROWKEYS\fR[=<\fION\fR|\fIOFF\fR>] This will prevent unwanted band switching when you are not using rig control. . .IP @@ -1904,7 +1915,7 @@ DX Clusters often use a non-standard port for Telnet, e.g. 8000. Automatic login for the telnet client. . .TP -.B CLUSTER_LOG +\fBCLUSTER_LOG\fR[=<\fION\fR|\fIOFF\fR>] Write clusterlog to disk. . .TP @@ -1931,7 +1942,7 @@ Anything you dump into this FIFO will be displayed by the packet interface. .SS Radio Control Commands . .TP -.B RADIO_CONTROL +\fBRADIO_CONTROL\fR[=<\fION\fR|\fIOFF\fR>] Switches the radio interface on. . The rig interface makes use of the @@ -1975,7 +1986,7 @@ Send rig configuration parameters to Hamlib. e.g. \fBRIGCONF\fR=\fIcivaddr=0x40,retry=3,rig_pathname=/dev/ttyS0\fR . .TP -.B RIT_CLEAR +\fBRIT_CLEAR\fR[=<\fION\fR|\fIOFF\fR>] Clears the RIT after logging the qso. . .IP @@ -2051,15 +2062,15 @@ lifetime for new spots in seconds (number >= .IR 30 ) . .TP -.B SCOREWINDOW +\fBSCOREWINDOW\fR[=<\fION\fR|\fIOFF\fR>] Show the score window (same as \fBAlt-R\fR). . .TP -.B CHECKWINDOW +\fBCHECKWINDOW\fR[=<\fION\fR|\fIOFF\fR>] Show the country/call check window. . .TP -.B PARTIALS +\fBPARTIALS\fR[=<\fION\fR|\fIOFF\fR>] Show a list of possible contest calls. . .IP @@ -2070,7 +2081,7 @@ in the section below for partials file specification. . .TP -.B USEPARTIALS +\fBUSEPARTIALS\fR[=<\fION\fR|\fIOFF\fR>] Use the auto-complete utility (takes some practice...). . .IP @@ -2085,7 +2096,7 @@ Sometimes you must edit the call because it has locked on a unique call. Try it, and switch it off when you don't like it. . .TP -.B LOGFREQUENCY +\fBLOGFREQUENCY\fR[=<\fION\fR|\fIOFF\fR>] Put frequency (kHz) into QSO number to enable logging of frequency (only in .B QSO or @@ -2093,7 +2104,7 @@ or modes). . .TP -.B IGNOREDUPE +\fBIGNOREDUPE\fR[=<\fION\fR|\fIOFF\fR>] Enables logging multiple QSOs in a contest with the same station (considered a good idea these days as contest bots that parse the submitted Cabrillo file will determine such dupes (duplicate contacts)). @@ -2146,14 +2157,14 @@ Providing a value for T is optional but will be ignored. In CW and DIGI modes T will always be 9. . .TP -.B NOB4 +\fBNOB4\fR[=<\fION\fR|\fIOFF\fR>] Do not send automatic \(lqQSO B4\(rq message. . .IP Default is to send such messages. . .TP -.B NOAUTOCQ +\fBNOAUTOCQ\fR[=<\fION\fR|\fIOFF\fR>] No automatic CQ when pressing .B Enter or @@ -2166,7 +2177,7 @@ in the section above). . .TP -.B SEND_DE +\fBSEND_DE\fR[=<\fION\fR|\fIOFF\fR>] Sends a \(lqDE\(rq word before your callsign, as in \(lqDE W1AW\(rq. . .IP @@ -2190,9 +2201,13 @@ has to be sent. Eg.: if the received call was but later it is corrected to .B AB1CB, then -.B CB. +.B CB is sent. . +.TP +\fBSHOW_TIME\fR[=<\fION\fR|\fIOFF\fR>] +Show last worked time instead of QSO number in the worked window. +. .SH RULES . The contest rules can be put into separate files. @@ -2267,7 +2282,7 @@ For further Cabrillo related information see below. . .TP -.B CONTEST_MODE +\fBCONTEST_MODE\fR[=<\fION\fR|\fIOFF\fR>] Sets @PACKAGE_NAME@ into contest mode. . .IP @@ -2282,11 +2297,11 @@ Uses short form for serial number (9=N, 0=T). Uses long form for serial number (default). . .TP -.B NO_LEADING_ZEROS_SERIAL +\fBNO_LEADING_ZEROS_SERIAL\fR[=<\fION\fR|\fIOFF\fR>] Disables sending leading zeros in serial number. . .TP -.B NO_RST +\fBNO_RST\fR[=<\fION\fR|\fIOFF\fR>] Do not use RST in contest, such as for CW Open, ARRL Sweepstakes, ARRL Field Day, or various QSO parties and such events. . @@ -2295,7 +2310,7 @@ In such a case when writing a Cabrillo log format template you must provide a conforming format definition without RST values. . .TP -.B MIXED +\fBMIXED\fR[=<\fION\fR|\fIOFF\fR>] Stations can be worked in any mode (CW, SSB and DIG) on a given band without being counted as a DUPE. . @@ -2378,7 +2393,7 @@ section above and the section below for obtaining Supercheck Partials updates. . .TP -.B BMAUTOGRAB +\fBBMAUTOGRAB\fR[=<\fION\fR|\fIOFF\fR>] If set along with the .B RADIO_CONTROL and @@ -2389,7 +2404,7 @@ bandmap frequency. . .\" FIXME: To what is the call added? .TP -.B BMAUTOADD +\fBBMAUTOADD\fR[=<\fION\fR|\fIOFF\fR>] If set along with the .B RADIO_CONTROL and @@ -2402,7 +2417,7 @@ Use \(lqS\(rqkip dupes in BANDMAP settings to control if it should also grab dupes. . .TP -.B SPRINTMODE +\fBSPRINTMODE\fR[=<\fION\fR|\fIOFF\fR>] If set, @PACKAGE_NAME@ will automatically switch its mode between LOG and S&P after every QSO. . @@ -2637,7 +2652,7 @@ instead. Points for countries in country list. . .TP -.B USE_COUNTRYLIST_ONLY +\fBUSE_COUNTRYLIST_ONLY\fR[=<\fION\fR|\fIOFF\fR>] Score zero points for countries not in the list. . .TP @@ -2655,11 +2670,11 @@ E.g. Scandinavia:SM,LA,OZ,OH. Not to be confused with so-called "country" files maintained by AD1C. . .TP -.B PORTABLE_MULT_2 +\fBPORTABLE_MULT_2\fR[=<\fION\fR|\fIOFF\fR>] Multiply points x2 for portable stations (e.g. R1 field day). . .TP -.B LOWBAND_DOUBLE +\fBLOWBAND_DOUBLE\fR[=<\fION\fR|\fIOFF\fR>] Double all points for lowband (40, 80, and 160m) QSOs (can be combined with any other value). . @@ -2685,29 +2700,29 @@ function, which gives the largest integer value that is not greater than multiplied score. . .TP -.B WYSIWYG_MULTIBAND +\fBWYSIWYG_MULTIBAND\fR[=<\fION\fR|\fIOFF\fR>] Exchange is the multiplier, per band, whatever you enter. . .IP @PACKAGE_NAME@ builds its own list of multipliers as QSOs are logged. . .TP -.B WYSIWYG_ONCE +\fBWYSIWYG_ONCE\fR[=<\fION\fR|\fIOFF\fR>] Exchange is multiplier, whatever you enter. . .IP Counts once per contest, not per band. . .TP -.B WAZMULT +\fBWAZMULT\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is the CQ zone (per band). . .TP -.B ITUMULT +\fBITUMULT\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is the ITU zone (per band). . .TP -.B PFX_MULT +\fBPFX_MULT\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is prefix (PA0, DA2, VE7, etc.). . .IP @@ -2716,7 +2731,7 @@ Counts once per contest, not per band. .\" FIXME: Reference CQ WPX handling elsewhere. CQ-WW-WPX is confusing as it .\" is not a parameter keyword and only appears here in the repository. .TP -.B PFX_MULT_MULTIBAND +\fBPFX_MULT_MULTIBAND\fR[=<\fION\fR|\fIOFF\fR>] Same as WPX, but the WPX only used CQ-WW-WPX, and there a single prefix multiplier only once, not all band. . @@ -2726,7 +2741,7 @@ With this option, the PFX counts as multiplier on all band. This usable in the All Asia DX contest (AA-DX). . .TP -.B COUNTRY_MULT +\fBCOUNTRY_MULT\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is the DXCC entity (per band). . .IP @@ -2767,14 +2782,14 @@ operators exchange county abbreviations rather than the state but the state can only count once (Kansas QSO Party is once such example). . .TP -.B SECTION_MULT +\fBSECTION_MULT\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is section from multipliers file. . .IP Counts per band. . .TP -.B SECTION_MULT_ONCE +\fBSECTION_MULT_ONCE\fR[=<\fION\fR|\fIOFF\fR>] Multiplier is section from multipliers file. . .IP @@ -2922,7 +2937,7 @@ Default value is NONE (disabled). The following parameters configure @PACKAGE_NAME@'s handling of the exchange. . .TP -.B SERIAL+SECTION +\fBSERIAL+SECTION\fR[=<\fION\fR|\fIOFF\fR>] Exchange is serial number and section, multiplier is section from multiplier file. . @@ -2930,7 +2945,7 @@ file. Counts per band. . .TP -.B SERIAL_OR_SECTION +\fBSERIAL_OR_SECTION\fR[=<\fION\fR|\fIOFF\fR>] Exchange is serial number or section. . .IP @@ -2941,7 +2956,7 @@ This option was introduced for HA-DX, where HA stations give the shortest form of their county, other stations give serial. . .TP -.B SERIAL+GRID4 +\fBSERIAL+GRID4\fR[=<\fION\fR|\fIOFF\fR>] Exchange is serial number and grid (e.g. 001 JO21QI), multiplier is 4-character grid (JO21). . @@ -2985,7 +3000,7 @@ Marathon. The module also recognises embedded calls (e.g. CT3/PA0R/QRP). . .TP -.B CONTINENT_EXCHANGE +\fBCONTINENT_EXCHANGE\fR[=<\fION\fR|\fIOFF\fR>] Exchange is a continent (NA, SA, EU, AS, AF, OC). . .TP @@ -3033,7 +3048,7 @@ Put the callsigns of such stations in a file in the working directory, one callsign per line, and give its name as an argument to this parameter. . .TP -.B QTC_AUTO_FILLTIME +\fBQTC_AUTO_FILLTIME\fR[=<\fION\fR|\fIOFF\fR>] If you use the QTC feature and you are an EU station in CW or SSB modes, then you can only RECEIVE the QTCs. . @@ -3051,7 +3066,7 @@ If you change the hour (e.g. if there is a time of 2059 and the next one is 2100), then all next time fields will be changed. . .TP -.B QTC_RECV_LAZY +\fBQTC_RECV_LAZY\fR[=<\fION\fR|\fIOFF\fR>] If you use the QTC feature, and you are an EU station in CW or SSB modes, then you can use this feature. . From dc0e5fe2d69c9c003d7575df9d7eb920ba969041 Mon Sep 17 00:00:00 2001 From: zcsahok Date: Tue, 8 Nov 2022 17:49:53 +0000 Subject: [PATCH 3/3] migrate NO_LEADING_ZEROS_SERIAL to LEADING_ZEROS_SERIAL --- src/globalvars.h | 2 +- src/main.c | 4 ++-- src/parse_logcfg.c | 2 +- src/sendbuf.c | 2 +- src/setcontest.c | 2 +- test/data.c | 2 +- test/test_parse_logcfg.c | 2 +- test/test_sendbuf.c | 4 ++-- tlf.1.in | 5 +++-- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/globalvars.h b/src/globalvars.h index 5b4c2ab78..3c3d210be 100644 --- a/src/globalvars.h +++ b/src/globalvars.h @@ -241,7 +241,7 @@ extern bool mult_side; extern bool countrylist_only; extern bool mixedmode; extern bool qso_once; -extern bool noleadingzeros; +extern bool leading_zeros_serial; extern bool ignoredupe; extern bool continentlist_only; extern bool debugflag; diff --git a/src/main.c b/src/main.c index 340f9b153..d237b4e9c 100644 --- a/src/main.c +++ b/src/main.c @@ -141,7 +141,7 @@ bool serial_section_mult = false; bool serial_or_section = false; /* exchange is serial OR section, like HA-DX */ bool serial_grid4_mult = false; bool qso_once = false; -bool noleadingzeros; +bool leading_zeros_serial; bool ctcomp; bool nob4 = false; // allow auto b4 bool ignoredupe = false; @@ -626,7 +626,7 @@ static void init_variables() { unique_call_multi = MULT_NONE; generic_mult = MULT_NONE; - noleadingzeros = false; + leading_zeros_serial = true; ctcomp = false; resend_call = RESEND_NOT_SET; diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 4a7705488..346e9d3a5 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -1141,7 +1141,7 @@ static config_t logcfg_configs[] = { {"WYSIWYG_ONCE", CFG_BOOL(wysiwyg_once)}, {"RIT_CLEAR", CFG_BOOL(rit)}, {"SHORT_SERIAL", CFG_INT_ONE(shortqsonr)}, - {"NO_LEADING_ZEROS_SERIAL", CFG_BOOL(noleadingzeros)}, + {"LEADING_ZEROS_SERIAL", CFG_BOOL(leading_zeros_serial)}, {"SCOREWINDOW", CFG_BOOL(showscore_flag)}, {"CHECKWINDOW", CFG_BOOL(searchflg)}, {"SEND_DE", CFG_BOOL(demode)}, diff --git a/src/sendbuf.c b/src/sendbuf.c index a73455fda..0b2faa6f2 100644 --- a/src/sendbuf.c +++ b/src/sendbuf.c @@ -212,7 +212,7 @@ void ExpandMacro(void) { } qsonroutput[4] = '\0'; - if (!noleadingzeros && leading_zeros > 1) { + if (leading_zeros_serial && leading_zeros > 1) { leading_zeros = 1; } diff --git a/src/setcontest.c b/src/setcontest.c index 4be0d3ef7..5c09c11c1 100644 --- a/src/setcontest.c +++ b/src/setcontest.c @@ -359,7 +359,7 @@ void setcontest(char *name) { qso_once = true; multlist = 1; // sectn_mult = true; - noleadingzeros = true; + leading_zeros_serial = false; } if (CONTEST_IS(PACC_PA)) { diff --git a/test/data.c b/test/data.c index 6750a1586..3c59c60b3 100644 --- a/test/data.c +++ b/test/data.c @@ -103,7 +103,7 @@ bool serial_section_mult = false; bool serial_or_section = false; /* exchange is serial OR section, like HA-DX */ bool serial_grid4_mult = false; bool qso_once = false; -bool noleadingzeros; +bool leading_zeros_serial; bool ctcomp = false; int isdupe = 0; // 0 if nodupe -- for auto qso b4 (LZ3NY) bool nob4 = false; // allow auto b4 diff --git a/test/test_parse_logcfg.c b/test/test_parse_logcfg.c index 616d9fd08..d7cde14d1 100644 --- a/test/test_parse_logcfg.c +++ b/test/test_parse_logcfg.c @@ -449,7 +449,7 @@ static bool_true_t bool_trues[] = { {"QTCREC_RECORD", &qtcrec_record}, {"QTC_AUTO_FILLTIME", &qtc_auto_filltime}, {"QTC_RECV_LAZY", &qtc_recv_lazy}, - {"NO_LEADING_ZEROS_SERIAL", &noleadingzeros}, + {"LEADING_ZEROS_SERIAL", &leading_zeros_serial}, }; void test_bool_trues(void **state) { diff --git a/test/test_sendbuf.c b/test/test_sendbuf.c index 143812fbd..99207e208 100644 --- a/test/test_sendbuf.c +++ b/test/test_sendbuf.c @@ -188,7 +188,7 @@ void test_expandQsoNrshort(void **state) { } void test_expandQsoNr_leadingzeros(void **state) { - noleadingzeros = false; + leading_zeros_serial = true; strcpy(qsonrstr, "0007"); check_ExpandMacro("nr #", "nr 007"); strcpy(qsonrstr, "0073"); @@ -200,7 +200,7 @@ void test_expandQsoNr_leadingzeros(void **state) { } void test_expandQsoNr_noleadingzeros(void **state) { - noleadingzeros = true; + leading_zeros_serial = false; strcpy(qsonrstr, "0007"); check_ExpandMacro("nr #", "nr 7"); strcpy(qsonrstr, "0073"); diff --git a/tlf.1.in b/tlf.1.in index 1c6aeaea2..76788e26a 100644 --- a/tlf.1.in +++ b/tlf.1.in @@ -2297,8 +2297,9 @@ Uses short form for serial number (9=N, 0=T). Uses long form for serial number (default). . .TP -\fBNO_LEADING_ZEROS_SERIAL\fR[=<\fION\fR|\fIOFF\fR>] -Disables sending leading zeros in serial number. +\fBLEADING_ZEROS_SERIAL\fR[=<\fION\fR|\fIOFF\fR>] +Controls sending leading zeros in serial number. By default serial numbers +are sent with (up to 2) leading zeros. . .TP \fBNO_RST\fR[=<\fION\fR|\fIOFF\fR>]