/* dmp_msu.c */ /* 95/01/19 tl; first try */ /* 95/07/06 tl; first final version */ #include #include #include #include #include "msu.h" /*-------------------------------------------------------*/ main(argc, argv) int argc; char *argv[]; { /* declarations */ static int st = 0, nn = 0, i, np = 0; int max_blocks, max_prints; int no_files, files_read; unsigned short int ev[MAXEV], evlen; int err[20]; /* help */ if (argc != 4) { printf("use: dmp_msu <#blocks> <#events to print> <#files>\n"); return (0); }; /* hello */ printf("dmp_msu.c running on "); time_stamp(); fflush(stdout); /* get parameters */ max_blocks = atoi(argv[1]); max_prints = atoi(argv[2]); no_files = atoi(argv[3]); /* zap spectra */ for (i = 0; i < 20; i++) err[i] = 0; /* sort */ printf("sorting started @ "); time_stamp(); fflush(stdout); while (st >= 0 && err[1] <= max_blocks && files_read < no_files) { /* get an event and count */ st = get_msu_ev(&evlen, ev); nn++; /* keep log of the errors/counts */ if ((st > -1) && (st < 20)) err[st]++; /* count files */ if (st == FILEMARK) files_read++; /* print some events */ if (np < max_prints) if (st == 0) { np++; printf("event print @ call # %i:\n", nn); print_event(&evlen, ev); }; /* here the user can sort whatever ... */ } printf("\ndone sorting @ ", st); time_stamp(); err_print(st); printf("vas the last error code! (%i)\n\n", st); /* statistics */ printf("counts and errors encountered:\n"); for (i = 0; i < 20; i++) if (err[i] > 0) { err_print(i); printf(" %10i\n", err[i]); } /* done */ printf("** done **\n"); return (0); }