/******************************************************************** * * Module Name : DUMP_GSF * * Author/Date : J. S. Byrne / 12 May 1994 * * Description : This file contains the source code for the dump_gsf * test program. This program was written during the * development of the gsf library as a test program. It * can be used to view the contents of a gsf swath bathymetry * ping record in text form. * * Restrictions/Limitations : * * Change Descriptions : * who when what * --- ---- ---- * * * Classification : Unclassified * * References : DoDBL Generic Sensor Format Sept. 30, 1993 * * Copyright (C) Science Applications International Corp. ********************************************************************/ /* Get required standard c include files */ #include #include #include /* Get specific includes */ #include "gsf.h" /* global external data required by this module */ extern int gsfError; /* static global data for this module */ static gsfRecords gsfRec; static gsfDataID id; static int shortOutput; static int pingTimeOutput; /* function prototypes for this module */ static void printMBPing(int rec_number); /******************************************************************** * * Function Name : main * * Description : This is the main function of the dump_gsf program. * This function receive the file name to open as a command line * argument, opens the file, and then reads each record from the * file one at a time. Ping records are dumped in text form to the * stdout device. * * Inputs : * argc = an integer argument counter * argv = a pointer to an array of character string command line arguments * * Returns : This function (program) returns a zero if succesful, or a non * zero value if unsuccesful to the invokation environment. * * Error Conditions : * ********************************************************************/ int main(int argc, char *argv[]) { char gsfFileName[128]; char str[64]; char *ptr; int gsfHandle; int bytes; int num_header = 0; int num_svp = 0; int num_pparam = 0; int num_sparam = 0; int num_comment = 0; int num_ping = 0; int num_history = 0; int num_nav_error = 0; int num_ping_sum = 0; int record_number = 0; int i; int val; struct tm *t; struct tm st; time_t StartTime=0; /* check the command line arguments */ if (argc < 3) { fprintf(stderr, "Useage: %s [-s] -f [-pt] [-t mm/dd/yy hh:mm:ss]\n", argv[0]); fprintf(stderr, "-s: short output a page at a time\n"); fprintf(stderr, "-f: for specifying the input file\n"); fprintf(stderr, "-pt: short output showing only ping times, all pings printed to stdout\n"); fprintf(stderr, "-t: for specifying start time\n"); exit(0); } for (i=1; itime_series[i].sample_count); sprintf(str, "%s %7d", str, gsfRec.mb_ping.brb_inten->time_series[i].detect_sample); max_intensity_sample = 0; for (j = 0; j < gsfRec.mb_ping.brb_inten->time_series[i].sample_count; j++) { if (gsfRec.mb_ping.brb_inten->time_series[i].samples[j] > max_intensity_sample) { max_intensity_sample = gsfRec.mb_ping.brb_inten->time_series[i].samples[j]; } } sprintf(str, "%s %07lX", str, max_intensity_sample); } if (gsfRec.mb_ping.quality_flags != NULL) { sprintf(str, "%s %0.7d", str, gsfRec.mb_ping.quality_flags[i]); } if (gsfRec.mb_ping.beam_flags != NULL) { sprintf(str, "%s %0.7d", str, gsfRec.mb_ping.beam_flags[i]); } fprintf(stdout, "%s\n", str); if (line > 20) { line = 0; fprintf(stdout,"Press return to continue, q to quit\n"); ret = fgetc(stdin); if (ret == 'q') { exit(0); } } } return; }