/****************************************************************************** FILE: lstblock.C List Block Times USAGE: lstblock Utility for writing to a file the time range of each block in a database. On the command line are the database name and the name of the output file. Eric Firing 88-03-13 Modified 88-04-14 to write the block file name along with the block number. ******************************************************************************/ #include "geninc.h" /* DB*() */ #include "ioserv.h" /* check_fopen(), check_error() */ #include "use_db.h" /* get_nblocks(), get_nprofs() */ static FILE_NAME_TYPE dbname, filename; int main(int argc, char *argv[]) { FILE_NAME_TYPE block_filename; unsigned int n; int iarg, ierr, iblkprf[2]; int write_dp_mask = 0; int search_mode = BLOCK_PROFILE_SEARCH, type, dbid = 1, /* database id */ accmode = READ_ONLY, memmode = DIR_IN_MEMORY; YMDHMS_TIME_TYPE t1, t2; ULONG data_proc_mask; FILE *fp_out; int nprofs, nblocks; int i; check_error( (argc < 3), "command line\n USAGE: lstblock [-p] \n\n"); iarg = 1; while (argv[iarg][0] == '-') { if (strchr(argv[iarg], 'p') ) write_dp_mask = 1; /* if (strchr(argv[iarg], 't') ) time_key = 1; */ iarg++; } strncpy(dbname, argv[iarg++], NPATHMAX); strncpy(filename, argv[iarg++], NPATHMAX); DBOPEN(&dbid, dbname, &accmode, &memmode, &ierr); check_error(ierr, "DBOPEN"); printf("\n\n DATABASE: %s SUCCESSFULLY OPENED\n",dbname); fp_out = check_fopen(filename,"w"); check_error( ((nblocks = get_nblocks()) < 0), "nblocks"); fprintf(fp_out, "/* Database summary for: %s */", dbname); fprintf(fp_out, "\n/* Number of blocks: %d */", nblocks); for (i=0; i