@@ -215,7 +215,10 @@ int main (int argc, char *argv[])
215215 char input_file [80 ];
216216 char T_opt_timestamp [40 ];
217217
218- int t_opt = 1 ; /* Text color option. */
218+ int t_opt = 1 ; /* Text color option. */
219+ char o_opt [80 ] = "" ; // Console capture received raw packets.
220+ char O_opt [80 ] = "" ; // Console capture all output.
221+
219222 int a_opt = 0 ; /* "-a n" interval, in seconds, for audio statistics report. 0 for none. */
220223 int g_opt = 0 ; /* G3RUH mode, ignoring default for speed. */
221224 int j_opt = 0 ; /* 2400 bps PSK compatible with direwolf <= 1.5 */
@@ -236,6 +239,7 @@ int main (int argc, char *argv[])
236239 int d_2_opt = 0 ; /* "-d 2" option for IL2P. Default minimal. Repeat for more detail. */
237240 int d_c_opt = 0 ; /* "-d c" option for connected mode data link state machine. */
238241 int d_q_opt = 0 ; /* "-d q" option for data link state machine queue. */
242+ int d_s_opt = 0 ; /* "-d s" print statistics when link ends. */
239243
240244 int aprstt_debug = 0 ; /* "-d d" option for APRStt (think Dtmf) debug. */
241245
@@ -295,11 +299,19 @@ int main (int argc, char *argv[])
295299
296300// FIXME: consider case of no space between t and number.
297301
302+ // Prescan for options that are needed before ant text goes to console.
303+
298304 for (j = 1 ; j < argc - 1 ; j ++ ) {
299305 if (strcmp (argv [j ], "-t" ) == 0 ) {
300306 t_opt = atoi (argv [j + 1 ]);
301307 //dw_printf ("DEBUG: text color option = %d.\n", t_opt);
302308 }
309+ if (strcmp (argv [j ], "-o" ) == 0 ) {
310+ strlcpy (o_opt , argv [j + 1 ], sizeof (o_opt ));
311+ }
312+ if (strcmp (argv [j ], "-O" ) == 0 ) {
313+ strlcpy (O_opt , argv [j + 1 ], sizeof (O_opt ));
314+ }
303315 }
304316
305317 // TODO: control development/beta/release by version.h instead of changing here.
@@ -310,6 +322,10 @@ int main (int argc, char *argv[])
310322 // https://www.dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on
311323
312324 text_color_init (t_opt );
325+ dw_printf_capture_init (o_opt , O_opt );
326+
327+ // Print application version.
328+
313329 text_color_set (DW_COLOR_INFO );
314330 //dw_printf ("Dire Wolf version %d.%d (%s) BETA TEST 1\n", MAJOR_VERSION, MINOR_VERSION, __DATE__);
315331 dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n" , MAJOR_VERSION , MINOR_VERSION , "B" , __DATE__ );
@@ -453,7 +469,7 @@ int main (int argc, char *argv[])
453469
454470 /* ':' following option character means arg is required. */
455471
456- c = getopt_long (argc , argv , "hP:B:gjJD:U:c:px:r:b:n:d:q:t:ul:L:Sa:E:T:e:X:AI:i:" ,
472+ c = getopt_long (argc , argv , "hP:B:gjJD:U:c:px:r:b:n:d:q:t:ul:L:Sa:E:T:e:X:AI:i:o:O: " ,
457473 long_options , & option_index );
458474 if (c == -1 )
459475 break ;
@@ -666,6 +682,8 @@ int main (int argc, char *argv[])
666682 case 'h' : d_h_opt ++ ; break ; // Hamlib verbose level.
667683#endif
668684 case 'c' : d_c_opt ++ ; break ; // Connected mode data link state machine
685+ // Repeat for more detail.
686+ case 's' : d_s_opt ++ ; break ; // Print statistics when link ends
669687 case 'x' : d_x_opt ++ ; break ; // FX.25
670688 case '2' : d_2_opt ++ ; break ; // IL2P
671689 case 'd' : aprstt_debug ++ ; break ; // APRStt (mnemonic Dtmf)
@@ -691,6 +709,8 @@ int main (int argc, char *argv[])
691709 break ;
692710
693711 case 't' : /* Was handled earlier. */
712+ case 'o' :
713+ case 'O' :
694714 break ;
695715
696716
@@ -791,7 +811,6 @@ int main (int argc, char *argv[])
791811 }
792812
793813 strlcpy (input_file , argv [optind ], sizeof (input_file ));
794-
795814 }
796815
797816/*
@@ -1148,7 +1167,7 @@ int main (int argc, char *argv[])
11481167 igate_init (& audio_config , & igate_config , & digi_config , d_i_opt );
11491168 cdigipeater_init (& audio_config , & cdigi_config );
11501169 pfilter_init (& igate_config , d_f_opt );
1151- ax25_link_init (& misc_config , d_c_opt );
1170+ ax25_link_init (& misc_config , d_c_opt , d_s_opt );
11521171
11531172/*
11541173 * Provide the AGW & KISS socket interfaces for use by a client application.
@@ -1355,7 +1374,7 @@ void app_process_rec_packet (int chan, int subchan, int slice, packet_t pp, alev
13551374 // TODO: suppress this message if not using soundcard input.
13561375 // i.e. we have no control over the situation when using SDR.
13571376
1358- if (alevel .rec > 110 ) {
1377+ if (! q_h_opt && alevel .rec > 110 ) {
13591378
13601379 text_color_set (DW_COLOR_ERROR );
13611380 dw_printf ("Audio input level is too high. This may cause distortion and reduced decode performance.\n" );
@@ -1451,6 +1470,14 @@ void app_process_rec_packet (int chan, int subchan, int slice, packet_t pp, alev
14511470 xid_parse (pinfo , info_len , & param , info2text , sizeof (info2text ));
14521471 dw_printf (" %s\n" , info2text );
14531472 }
1473+ else if (ftype == frame_type_S_SREJ ) {
1474+ // Additional sequence numbers can be in the info part.
1475+ // This does not handle the range case, which we don't generate.
1476+ for (int j = 0 ; j < info_len ; j ++ ) {
1477+ dw_printf (" +%d" , (unsigned int )(pinfo [j ]) >> 1 );
1478+ }
1479+ dw_printf ("\n" );
1480+ }
14541481 else {
14551482 ax25_safe_print ((char * )pinfo , info_len , ( ! ax25_is_aprs (pp )) && ( ! d_u_opt ) );
14561483 dw_printf ("\n" );
@@ -1742,7 +1769,8 @@ static void usage (void)
17421769 dw_printf ("Usage: direwolf [options] [ - | stdin | UDP:nnnn ]\n" );
17431770 dw_printf ("Options:\n" );
17441771 dw_printf (" -c fname Configuration file name.\n" );
1745- dw_printf (" -l logdir Directory name for log files. Use . for current.\n" );
1772+ dw_printf (" -l logdir Directory name for daily log files. Use . for current.\n" );
1773+ dw_printf (" -L logname Generate single log file with fixed name.\n" );
17461774 dw_printf (" -r n Audio sample rate, per sec.\n" );
17471775 dw_printf (" -n n Number of audio channels, 1 or 2.\n" );
17481776 dw_printf (" -b n Bits per audio sample, 8 or 16.\n" );
@@ -1780,6 +1808,7 @@ static void usage (void)
17801808 dw_printf (" h h = hamlib increase verbose level.\n" );
17811809#endif
17821810 dw_printf (" c c = Connected mode data link state machine.\n" );
1811+ dw_printf (" s s = Print statistics when link ends.\n" );
17831812 dw_printf (" x x = FX.25 increase verbose level.\n" );
17841813 dw_printf (" 2 2 = IL2P.\n" );
17851814 dw_printf (" d d = APRStt (DTMF to APRS object translation).\n" );
0 commit comments