#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 wdc ---\n", datafile); strcpy(command,"wdc "); 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 dhz_wdc ---\n", datafile); strcpy(command,"dhz_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 magic ---\n", datafile); strcpy(command,"magic "); strcat(command,datafile); system(command); } pos = strpos(datatype, "greenland"); if (pos > -1) { done = 1; printf("--- processing file %s using greenland ---\n", datafile); strcpy(command,"greenland "); strcat(command,datafile); system(command); } pos = strpos(datatype, "green_asc"); if (pos > -1) { done = 1; printf("--- processing file %s using green_asc ---\n", datafile); strcpy(command,"green_asc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "green_iaga"); if (pos > -1) { done = 1; printf("--- processing file %s using green_iaga ---\n", datafile); strcpy(command,"green_iaga "); strcat(command,datafile); system(command); } pos = strpos(datatype, "themis_mag"); if (pos > -1) { done = 1; printf("--- processing file %s using themis_mag ---\n", datafile); strcpy(command,"themis_mag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "themis_txt"); if (pos > -1) { done = 1; printf("--- processing file %s using themis_txt--\n", datafile); strcpy(command,"themis_txt "); strcat(command,datafile); system(command); } pos = strpos(datatype, "basmag"); if (pos > -1) { done = 1; printf("--- processing file %s using basmag ---\n", datafile); strcpy(command,"basmag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "usaf"); if (pos > -1) { done = 1; printf("--- processing file %s using usaf ---\n", datafile); strcpy(command,"usaf "); strcat(command,datafile); system(command); } pos = strpos(datatype, "rus_uaf"); if (pos > -1) { done = 1; printf("--- processing file %s using rus_uaf ---\n", datafile); strcpy(command,"rus_uaf "); strcat(command,datafile); system(command); } pos = strpos(datatype, "gin_iaga"); if (pos > -1) { done = 1; printf("--- processing file %s using gin_iaga ---\n", datafile); strcpy(command,"gin_iaga "); strcat(command,datafile); system(command); } pos = strpos(datatype, "cpmn_iaga"); if (pos > -1) { done = 1; printf("--- processing file %s using cpmn_iaga ---\n", datafile); strcpy(command,"cpmn_iaga "); strcat(command,datafile); system(command); } pos = strpos(datatype, "gin_imfv"); if (pos > -1) { done = 1; printf("--- processing file %s using gin ---\n", datafile); strcpy(command,"gin "); strcat(command,datafile); system(command); } pos = strpos(datatype, "intermag"); if (pos > -1) { done = 1; printf("--- processing file %s using intermag ---\n", datafile); strcpy(command,"intermag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "canopus"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using canopus ---\n", datafile); strcpy(command,"canopus "); strcat(command,datafile); system(command); } pos = strpos(datatype, "can_new"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using can_new ---\n", datafile); strcpy(command,"can_new "); strcat(command,datafile); system(command); } pos = strpos(datatype, "supermag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using supermag ---\n", datafile); strcpy(command,"supermag "); 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, "image"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using image ---\n", datafile); strcpy(command,"image "); strcat(command,datafile); system(command); } pos = strpos(datatype, "img"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using img ---\n", datafile); strcpy(command,"img "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mac"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs ---\n", datafile); strcpy(command,"maccs "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_dat"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs_dat ---\n", datafile); strcpy(command,"maccs_dat "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_5sc"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs_5sc ---\n", datafile); strcpy(command,"maccs_5sc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "mcs_iaga"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs_5sc ---\n", datafile); strcpy(command,"maccs_iaga "); strcat(command,datafile); system(command); } if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs_5sc ---\n", datafile); strcpy(command,"maccs_5sc "); strcat(command,datafile); system(command); } if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using maccs_5sc ---\n", datafile); strcpy(command,"maccs_5sc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "samnet"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using samnet ---\n", datafile); strcpy(command,"samnet "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sam_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using sam_1sec ---\n", datafile); strcpy(command,"sam_1sec "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sam_5sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using sam_5sec ---\n", datafile); strcpy(command,"sam_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 syowa ---\n", datafile); strcpy(command,"syowa "); strcat(command,datafile); system(command); } pos = strpos(datatype, "sy_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using syowa_1min ---\n", datafile); strcpy(command,"syowa_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "jap"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using jap_can ---\n", datafile); strcpy(command,"jap_can "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using umd ---\n", datafile); strcpy(command,"umd "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using umd_1sec ---\n", datafile); strcpy(command,"umd_1sec "); strcat(command,datafile); system(command); } pos = strpos(datatype, "umd_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using umd_1min ---\n", datafile); strcpy(command,"umd_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ago_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using ago ---\n", datafile); strcpy(command,"ago "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ausmag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using aus ---\n", datafile); strcpy(command,"aus "); strcat(command,datafile); system(command); } pos = strpos(datatype, "aus_ips"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using aus_ips ---\n", datafile); strcpy(command,"aus_ips "); strcat(command,datafile); system(command); } pos = strpos(datatype, "aus_2"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using aus_2 ---\n", datafile); strcpy(command,"aus_2 "); strcat(command,datafile); system(command); } pos = strpos(datatype, "casey"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using casey ---\n", datafile); strcpy(command,"casey "); strcat(command,datafile); system(command); } pos = strpos(datatype, "usgs_mag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using usgs ---\n", datafile); strcpy(command,"usgs "); strcat(command,datafile); system(command); } pos = strpos(datatype, "generic"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using generic ---\n", datafile); strcpy(command,"generic "); strcat(command,datafile); system(command); } pos = strpos(datatype, "hbmag"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using hbmag ---\n", datafile); strcpy(command,"hbmag "); strcat(command,datafile); system(command); } pos = strpos(datatype, "hb_web"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using hb_web ---\n", datafile); strcpy(command,"hb_web "); strcat(command,datafile); system(command); } pos = strpos(datatype, "halley"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using halley ---\n", datafile); strcpy(command,"halley "); strcat(command,datafile); system(command); } pos = strpos(datatype, "alaska"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using alaska ---\n", datafile); strcpy(command,"alaska "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ak_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using ak_1min ---\n", datafile); strcpy(command,"ak_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "small"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using small ---\n", datafile); strcpy(command,"small "); strcat(command,datafile); system(command); } pos = strpos(datatype, "ucla"); if ((pos > -1) && (!done)) { done = 1; printf("--- processing file %s using ucla ---\n", datafile); strcpy(command,"ucla "); strcat(command,datafile); system(command); } pos = strpos(datatype, "210_1min"); if ((pos > -1) && (!done)) { done = 1; printf("--- process in file %s using 210mm_1min ---\n", datafile); strcpy(command,"210mm_1min "); strcat(command,datafile); system(command); } pos = strpos(datatype, "210_wdc"); if ((pos > -1) && (!done)) { done = 1; printf("--- process in file %s using 210mm_1min ---\n", datafile); strcpy(command,"210mm_wdc "); strcat(command,datafile); system(command); } pos = strpos(datatype, "210_1sec"); if ((pos > -1) && (!done)) { done = 1; printf("--- process in file %s using 210mm_1sec ---\n", datafile); strcpy(command,"210mm_1sec "); strcat(command,datafile); system(command); } } } fclose(fpin); } }