/****************************************************************************** FILE: ascii_dump.c USAGE: ascii_dump This file contains a set of routines for creating an ASCII dump for a set of CODAS block data files. It requires a control file that provides a list of names of the block files that will be converted to ASCII. See the file ascii_dump.cnt for an example. Pat Caldwell, April 1994 *****************************************************************************/ #include "common.h" #include "io_nc.h" int convert_blk_asc(char *buff, int destmach); int main(argc,argv) int argc; char *argv[]; { FILE *fp_cnt; /* pointer to control file */ char cfile[80]; /* control file name */ char buff[80]; /* input buffer for holding block file names */ char *bftst = "BLOCK_FILES:"; int destmach = HOST_ENVIRONMENT; /* ------> OPEN CONTROL FILE */ if ( argc < 2 ) { /* GET CONTROL FILE NAME FROM USER */ printf("\n\n Enter control file or [CR] for asc_dump.cnt ==>"); gets_ok(cfile, sizeof(cfile)); if( strlen(cfile) == 0 ) { strcpy( cfile, "asc_dump.cnt" ); fp_cnt = fopen( cfile, "r" ); } else fp_cnt = fopen( cfile, "r" ); } else /* GET CONTROL FILE NAME FROM COMMAND LINE */ fp_cnt = fopen( argv[1], "r" ); /* ------> READ PAST COMMENTS IN CONTROL FILE */ do { getword_nc( fp_cnt, buff, 80 ); } while( strcmp( bftst, buff ) != 0 ); /* ------> FOR EACH BLOCK FILE LISTED IN CONTROL FILE, CONVERT TO ASCII, STOP AT "end" */ while( fscanf( fp_cnt, "%79s", buff ) == 1 ) /* buff holds block path and file name */ { if (strcmp(buff,"end") == 0) break; convert_blk_asc( buff, destmach ); } return 0; }