@@ -108,6 +108,7 @@ typedef struct { /* Defaults: */
108
108
das_units utZvals ; /* UNIT_E_SPECDENS (see units.h) */
109
109
double dFillValue ; /* 1E31 */
110
110
double dBaseTime ; /* Required input */
111
+ bool bDump ; /* Diagnostic output instead of das2 stream */
111
112
} Options ;
112
113
113
114
#define ST_ASCII 0
@@ -146,6 +147,8 @@ void show_help(FILE *h)
146
147
"\n"
147
148
" -tBeg STRING Begin time of data capture (required)\n"
148
149
"\n"
150
+ " -diag Suppress normal output, write ascii packet contents to\n"
151
+ " stdout\n"
149
152
);
150
153
}
151
154
@@ -165,6 +168,9 @@ void getCmdOpts(int argc, char** argv, Options* pOpts){
165
168
else if (!strcmp ("-s" ,* argv )){
166
169
pOpts -> bSilent = true;
167
170
}
171
+ else if (!strcmp ("-diag" ,* argv )){
172
+ pOpts -> bDump = true;
173
+ }
168
174
else if (!strcmp ("-t" ,* argv )){
169
175
-- argc ; ++ argv ;
170
176
nTmp = strtoul (* argv ,NULL ,10 );
@@ -330,7 +336,7 @@ PktDesc* sendPktDesc(
330
336
PktDesc_addPlane (pPd , pPlane );
331
337
332
338
if (!pOpts -> bSilent ) fprintf (stderr ,"done\n DasIO_writePktDesc..." );
333
- DasIO_writePktDesc (pOut , pPd );
339
+ if (! pOpts -> bDump ) DasIO_writePktDesc (pOut , pPd );
334
340
if (!pOpts -> bSilent ) fprintf (stderr ,"done\n" );
335
341
336
342
++ g_nPktType ;
@@ -420,7 +426,7 @@ int main(int argc,char *argv[])
420
426
char * sProgName = argv [0 ];
421
427
422
428
Options opts = {false, ST_FLOAT , EPOCH_1958 , 128.0 , 0.0 ,
423
- UNIT_HERTZ , UNIT_E_SPECDENS , -1E31 , -1.0 };
429
+ UNIT_HERTZ , UNIT_E_SPECDENS , -1E31 , -1.0 , false };
424
430
425
431
/* Exit on errors, log info messages and above */
426
432
das_init (argv [0 ], DASERR_DIS_EXIT , 0 , DASLOG_INFO , NULL );
@@ -448,7 +454,7 @@ int main(int argc,char *argv[])
448
454
DasDesc_setDouble ((DasDesc * )pSd ,"zFill" , opts .dFillValue );
449
455
450
456
if (!opts .bSilent ) fprintf (stderr ,"done, Send Stream Header..." );
451
- DasIO_writeStreamDesc (pOut , pSd );
457
+ if (! opts . bDump ) DasIO_writeStreamDesc (pOut , pSd );
452
458
if (!opts .bSilent ) fprintf (stderr ,"done\n\n" );
453
459
454
460
int nNumPkt = 0 ;
@@ -467,7 +473,15 @@ int main(int argc,char *argv[])
467
473
arTime [i ]= * (pF ++ ); /* C Increment operator notes: */
468
474
arFreq [i ]= * (pF ++ ); /* p++ (as suffix) returns old value, but */
469
475
arAmpl [i ]= * (pF ++ ); /* ++p (as prefix) returns new value */
476
+
477
+ if (opts .bDump ){
478
+ if (i == 0 )
479
+ printf ("%9.3f %9.3e %9.3e" , arTime [i ], arFreq [i ], arAmpl [i ]);
480
+ else
481
+ printf (",%9.3f %9.3e %9.3e" , arTime [i ], arFreq [i ], arAmpl [i ]);
482
+ }
470
483
}
484
+ if (opts .bDump ) printf ("\n" );
471
485
472
486
/* sort by frequencies to enable das2 streams to work */
473
487
SwapSort_Min (arFreq ,nItems ,arSort );
@@ -508,7 +522,7 @@ int main(int argc,char *argv[])
508
522
PlaneDesc_setValue (pYScan , i , arAmpl [arSort [i ]]);
509
523
}
510
524
511
- DasIO_writePktData (pOut , pPd );
525
+ if (! opts . bDump ) DasIO_writePktData (pOut , pPd );
512
526
513
527
++ nNumPkt ;
514
528
}
0 commit comments