#include "stdio.h" #include "string.h" #include "astring.h" #include "stdlib.h" void main(int argc, char *argv[]) { FILE *fpin; int flag, flatf, helpf, ifilef, datef, error; int i, nfiles, pos, strl, done; char filein[100], line[80], datafile[80], datatype[80]; char command[1000], *filelist, sdate[10]; helpf = 0; ifilef = 0; error = 0; flatf = 0; if (argc >= 2) { for (i=2; i<=argc; i++) { if (strpos(argv[i-1],"-")==0) { flag = 0; if (strpos(argv[i-1],"f")>0) { flatf = 1; flag=1; } if (strpos(argv[i-1],"d")>0) { datef = 1; strcpy(sdate,strmid(argv[i-1],2,9)); flag=1; } if ((strpos(argv[i-1],"h")>0) || (!flag)) { helpf = 1; printf("usage : \n"); printf("process_all [-ddd-mon-yy] [file] \n"); printf(" -ddd-mon-yy use dd-mon-yy to locate files\n"); printf(" file file which contains list to process\n"); printf(" -h show help\n"); } } else { if (!ifilef) { ifilef = 1; strcpy(filein,argv[i-1]); } } } } if (!helpf) { error = 0; if (!ifilef) { strcpy(filein, "file.list"); } fpin = fopen(filein,"r"); printf("opening file : %s\n",filein); if (fpin == NULL) printf("file not opened...\n"); nfiles = 0; while (!feof(fpin)) { fgets(line,79,fpin); strl = strlen(line); if ((!feof(fpin)) && (strl > 0)) { nfiles++; pos = strpos(line, " "); strcpy(datafile,strmid(line,0,pos)); strcpy(datatype,strmid(line,pos+1,strlen(line)-pos)); done = 0; pos = strpos(datatype, "wdc"); if (pos > -1) { done = 1; printf("--- processing file %s using pwdc ---\n", datafile); strcpy(command,"pwdc "); strcat(command,datafile); if (datef) { strcat(command," -d"); strcat(command,sdate); } system(command); } pos = strpos(datatype, "dhz"); if (pos > -1) { done = 1; printf("--- processing file %s using pdhz_wdc ---\n", datafile); strcpy(command,"pdhz_wdc "); strcat(command,datafile); if (datef) { strcat(command," -d"); strcat(command,sdate); } system(command); } pos = strpos(datatype, "magic"); if (pos > -1) { done = 1; printf("--- processing file %s using pmagic ---\n", datafile); strcpy(command,"pmagic "); strcat(command,datafile); system(command); } pos = strpos(datatype, "greenland"); if (pos > -1) { done = 1; printf("--- processing file %s using pgreen ---\n", datafile); strcpy(command,"pgreen "); strcat(command,datafile); system(command); } pos = strpos(datatype, "green_asc"); if (pos > -1) { done = 1; printf("--- processing file %s using pgreen_asc ---\n", datafile); strcpy(command,"pgreen_asc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "usaf"); if (pos > -1) { done = 1; printf("--- processing file %s using pusaf ---\n", datafile); strcpy(command,"pusaf "); strcat(command,datafile); system(command); } pos = strpos(datatype, "rus_uaf"); if (pos > -1) { done = 1; printf("--- processing file %s using prus_uaf ---\n", datafile); strcpy(command,"prus_uaf "); strcat(command,datafile); system(command); } pos = strpos(datatype, "gin_iaga"); if (pos > -1) { done = 1; printf("--- processing file %s using pgin_iaga ---\n", datafile); strcpy(command,"pgin_iaga "); strcat(command,datafile); system(command); } pos = strpos(datatype, "cpmn_iaga"); if (pos > -1) { done = 1; printf("--- processing file %s using pcpmn_iaga ---\n", datafile); strcpy(command,"pcpmn_iaga "); strcat(command,datafile); system(command); } pos = strpos(datatype, "gin_imfv"); if (pos > -1) { done = 1; printf("--- processing file %s using pgin ---\n", datafile); strcpy(command,"pgin "); strcat(command,datafile); system(command); } pos = strpos(datatype, "intermag"); if (pos > -1) { done = 1; printf("--- processing file %s using pintermag ---\n", datafile); strcpy(command,"pintermag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "canopus"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pcan ---\n", datafile); strcpy(command,"pcan "); strcat(command,datafile); system(command); } pos = strpos(datatype, "can_new"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pcan_new ---\n", datafile); strcpy(command,"pcan_new "); strcat(command,datafile); system(command); } pos = strpos(datatype, "supermag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psupermag ---\n", datafile); strcpy(command,"psupermag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "can_nohead"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using can_nohead ---\n", datafile); strcpy(command,"can_nohead "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ima"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pimage ---\n", datafile); strcpy(command,"pimage "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mac"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs ---\n", datafile); strcpy(command,"pmaccs "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_dat"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs_dat ---\n", datafile); strcpy(command,"pmaccs_dat "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_5sc"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs_5sc ---\n", datafile); strcpy(command,"pmaccs_5sc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_iaga"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs_5sc ---\n", datafile); strcpy(command,"pmaccs_iaga "); strcat(command,datafile); system(command); } if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs_5sc ---\n", datafile); strcpy(command,"pmaccs_5sc "); strcat(command,datafile); system(command); } if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pmaccs_5sc ---\n", datafile); strcpy(command,"pmaccs_5sc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "samnet"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psam ---\n", datafile); strcpy(command,"psam "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sam_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psam_1sec ---\n", datafile); strcpy(command,"psam_1sec "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sam_5sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psam_5sec ---\n", datafile); strcpy(command,"psam_5sec "); strcat(command,datafile); system(command); } pos = strpos(datatype, "nor"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pnorway ---\n", datafile); strcpy(command,"pnorway "); strcat(command,datafile); system(command); } pos = strpos(datatype, "syowa"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psyowa ---\n", datafile); strcpy(command,"psyowa "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sy_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psyowa_1min ---\n", datafile); strcpy(command,"psyowa_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "jap"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pjap_can ---\n", datafile); strcpy(command,"pjap_can "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pumd ---\n", datafile); strcpy(command,"pumd "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pumd_1sec ---\n", datafile); strcpy(command,"pumd_1sec "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pumd_1min ---\n", datafile); strcpy(command,"pumd_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ago_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pago ---\n", datafile); strcpy(command,"pago "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ausmag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using paus ---\n", datafile); strcpy(command,"paus "); strcat(command,datafile); system(command); } pos = strpos(datatype, "aus_ips"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using paus_ips ---\n", datafile); strcpy(command,"paus_ips "); strcat(command,datafile); system(command); } pos = strpos(datatype, "casey"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pcasey ---\n", datafile); strcpy(command,"pcasey "); strcat(command,datafile); system(command); } pos = strpos(datatype, "usgs_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pusgs ---\n", datafile); strcpy(command,"pusgs "); strcat(command,datafile); system(command); } pos = strpos(datatype, "generic"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pgene ---\n", datafile); strcpy(command,"pgene "); strcat(command,datafile); system(command); } pos = strpos(datatype, "hbmag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using phbmag ---\n", datafile); strcpy(command,"phbmag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "hb_web"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using phb_web ---\n", datafile); strcpy(command,"phb_web "); strcat(command,datafile); system(command); } pos = strpos(datatype, "alaska"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using palaska ---\n", datafile); strcpy(command,"palaska "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ak_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pak_1min ---\n", datafile); strcpy(command,"pak_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "small"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using psmall ---\n", datafile); strcpy(command,"psmall "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ucla"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using pucla ---\n", datafile); strcpy(command,"pucla "); strcat(command,datafile); system(command); } pos = strpos(datatype, "210_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- process in file %s using p210_1min ---\n", datafile); strcpy(command,"p210_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "210_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- process in file %s using p210_1sec ---\n", datafile); strcpy(command,"p210_1sec "); strcat(command,datafile); system(command); } } } fclose(fpin); } }