#ident "@(#)RELEASE VERSION html request form: version 5.2 by psm@leadbelly.lanl.gov compiled on 3/26/97" #include #include #include #include #include main(argc, argv) int argc; char *argv[]; { char name[8000],output[8000],timeres[81],units[81],compression[81],letters[10],satname[20]; char outfile[81],mailname[121],echoname[181],mailname2[121],mailname3[121], rmoutfile[81]; char dummy[81],compress[81]; int count,i,j,k,year,month,day; double start,stop; long lhex; char hexstr[3],chr1,chr2,*end; FILE *outfi; char rcsid[] = "$Id: html request form: version 5.2 by psm@leadbelly.lanl.gov compiled on 3/26/97 $"; time_t *tloc; struct timeb *tp; int t2; short int error, namerr, emailerr, phonerr, adderr,usedforerr, timerr, colonerr, daterr, datelttr, datecolon,energyerr,yearerr, montherr, dayerr, starterr, stoperr; /*initialize*/ adderr=0;error=0;namerr=0;emailerr=0;phonerr=0;timerr=0;colonerr=0;daterr=0;datelttr=0;datecolon=0;energyerr=0;usedforerr=0; yearerr=0; montherr=0; dayerr=0; starterr=0; stoperr=0; t2=time(NULL); /* sprintf(outfile,"/belly1/www/htdocs/psm/request/%d",t2); */ sprintf(rmoutfile,"rm /belly1/home/lanl_geo/newrequests/%d",t2); sprintf(outfile,"/belly1/home/lanl_geo/newrequests/%d",t2); sprintf(mailname,"cat /belly1/home/lanl_geo/newrequests/%d|/usr/ucb/mail -s NewRequestCalled:%d reeves",t2,t2); sprintf(mailname2,"cat /belly1/home/lanl_geo/newrequests/%d|/usr/ucb/mail -s NewRequestCalled:%d rdbelian@lanl.gov",t2,t2); sprintf(mailname3,"cat /belly1/home/lanl_geo/newrequests/%d|/usr/ucb/mail -s NewRequestCalled:%d psm",t2,t2); if ((outfi=fopen(outfile,"w"))==NULL) { printf("cannot open file\n"); exit(1); } fscanf(stdin, "%s",name); /* fprintf(outfi,"%s\n\n",name); */ fprintf(outfi,"*** Name ***\n"); for(count=0;;count++) if (name[count]=='=') break; count++; fprintf(outfi," "); if (name[count]=='&') {error=1; namerr=1;} for(;;count++) { if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[++count]); lhex=strtol(hexstr,&end,16); if (lhex==13) {count+=3; fprintf(outfi,"%c%c ",lhex,10);} else fprintf(outfi,"%c",lhex); } else if (name[count]=='&') break; else { if (name[count]=='+') name[count]=' '; fprintf(outfi,"%c",name[count]); } } fprintf(outfi,"\n\n"); fprintf(outfi,"*** E-mail Address ***\n"); for(;;count++)if (name[count]=='=') break; count++; fprintf(outfi," "); if (name[count]=='&') {error=1; emailerr=1;} for(;;count++) { if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[++count]); lhex=strtol(hexstr,&end,16); if (lhex==13) {count+=3; fprintf(outfi,"%c%c ",lhex,10);} else fprintf(outfi,"%c",lhex); } else if (name[count]=='&') break; else { if (name[count]=='+') name[count]=' '; fprintf(outfi,"%c",name[count]); } } fprintf(outfi,"\n\n"); fprintf(outfi,"*** Postal Address ***\n"); for(j=0;j<5;j++) { for(;;count++)if (name[count]=='=') break; count++; fprintf(outfi," "); for(;;count++) { if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[++count]); lhex=strtol(hexstr,&end,16); if (lhex==13) {count+=3; fprintf(outfi,"%c%c ",lhex,10);} else fprintf(outfi,"%c",lhex); } else if (name[count]=='&') break; else { if (name[count]=='+') name[count]=' '; fprintf(outfi,"%c",name[count]); } } fprintf(outfi,"\n"); } fprintf(outfi,"\n\n"); fprintf(outfi,"*** Phone Number ***\n"); for(;;count++)if (name[count]=='=') break; count++; fprintf(outfi," "); if (name[count]=='&') {error=1; phonerr=1;} for(;;count++) { if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[++count]); lhex=strtol(hexstr,&end,16); if (lhex==13) {count+=3; fprintf(outfi,"%c%c ",lhex,10);} else fprintf(outfi,"%c",lhex); } else if (name[count]=='&') break; else { if (name[count]=='+') name[count]=' '; fprintf(outfi,"%c",name[count]); } } fprintf(outfi,"\n\n"); fprintf(outfi,"*** What the data will be used for ***\n"); for(;;count++)if (name[count]=='=') break; count++; fprintf(outfi," "); if (name[count]=='&') {error=1; usedforerr=1;} for(;;count++) { if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[++count]); lhex=strtol(hexstr,&end,16); if (lhex==13) {count+=3; fprintf(outfi,"%c%c ",lhex,10);} else fprintf(outfi,"%c",lhex); } else if (name[count]=='&') break; else { if (name[count]=='+') name[count]=' '; fprintf(outfi,"%c",name[count]); } } fprintf(outfi,"\n\n"); fprintf(outfi,"*** Compression ***\n"); for(;;count++)if (name[count]=='=') break; count++; fprintf(outfi," "); compression[0]=name[count]; for(;;count++) { if (name[count]=='&') break; } if (compression[0]=='u') {sprintf(compress,"");fprintf(outfi,"uncompressed\n");} if (compression[0]=='g') {sprintf(compress,"gzipped,");fprintf(outfi,"gzipped\n");} if (compression[0]=='z') {sprintf(compress,"zipped,");fprintf(outfi,"zipped\n");} fprintf(outfi,"\n@\n\n***\n\n"); i=0; count++; sprintf(output,"\n"); if (name[count]=='s') {error=1; energyerr=1;} for(;;count++) { if (name[count]=='s') break; else { letters[i]=name[count]; count+=10; i++; } } letters[i]='\0'; for(;;count++)if (name[count]=='=') break; count++; i=0; for(;;count++) { if (name[count]=='&') break; satname[i]=name[count]; i++; } satname[i++]='\0'; fprintf(outfi,"*** Data is requested for the following satellites: %s ***\n",satname); fprintf(outfi,"\n#cg: ***Grouped energy channels for CPA***\n"); fprintf(outfi,"%s\n",letters); fprintf(outfi,"\n#sg: ***Grouped energy channels for SOPA ***\n"); fprintf(outfi,"%s\n\n",letters); for(;;count++)if (name[count]=='=') break; count++; i=0; sprintf(timeres,"\n"); if (name[count]=='&') {error=1; timerr=1;} for(;;count++) { if (name[count]=='&') break; if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[count+1]); lhex=strtol(hexstr,&end,16); if (lhex==58) {error=1; colonerr=1;} } timeres[i]=name[count]; i++; } timeres[i++]='\0'; fprintf(outfi,"*** Time resolution=%s seconds***\n\n",timeres); for(;;count++)if (name[count]=='=') break; count++; i=0; sprintf(units,"\n"); for(;;count++) { if (name[count]=='&') break; units[i]=name[count]; i++; } units[i++]='\0'; fprintf(outfi,"***The data will be expressed as: %s ***\n",units); /*channel grouping hasn't been implemented in extract yet */ /* for(;;count++)if (name[count]=='=') break; count++; i=0; sprintf(output,"\n"); for(;;count++) { if (name[count]=='&') break; output[i]=name[count]; i++; } output[i++]='\0'; fprintf(outfi,"***The grouping will be expressed as: %s channels ***\n",output); */ /*----------------------------------------------------------*/ fprintf(outfi,"\n***Requested days for data***"); fprintf(outfi,"\n YEAR MONTH DAY START STOP\n"); for(;;count++)if (name[count]=='=') break; if (name[count+1]=='&') {error=1; daterr=1;} for(j=0;j<14;j++)/*full day loop*/ { if (name[count+1]=='&') { for(k=0;k<5;k++) { count++; for(;;count++)if (name[count]=='=') break; } continue; } fprintf(outfi,"$\n"); /*year*/ { i=0; count++; for(;;count++) { if (name[count]=='&') break; if (isalpha(name[count])) {datelttr=1; error=1;} if (name[count]=='+') name[count]='\0'; if (name[count]=='%') { sprintf(hexstr,"%c%c",name[++count],name[count+1]); lhex=strtol(hexstr,&end,16); if (lhex==58) {error=1; datecolon=1;} } output[i]=name[count]; i++; } output[i++]='\0'; year=atoi(output); if ((1975 Error Detected

An error has been detected, please go back and edit the lines indicated by the blinking message
Background Information
Your Name: "); if (namerr) printf("Name required"); else printf("sufficient"); printf("
Your E-mail Address: "); if (emailerr) printf("Email required"); else printf("sufficient"); printf("
Your Postal Address: not required"); printf("
Your Phone Number: "); if (phonerr) printf("Phone required"); else printf("sufficient"); printf("
What will the data be used for?: "); if (usedforerr) printf("Information Required"); else printf("sufficient"); printf("
Energy Channels: "); if (energyerr) printf("You must select an energy"); else printf("sufficient"); printf("
Satellites: %s",satname); printf("
Time Resolution: "); if (colonerr) printf("You must enter a decimal time *without* a colon."); else if (timerr) printf("You must enter a decimal time."); else printf("%s seconds",timeres); printf("
Units: %s",units); printf("
Dates and Times: "); if (daterr) printf("Make sure you have enterred a full line of information."); else if (datelttr) printf("All dates and times should be written as numbers."); else if (datecolon) printf("You must enter a decimal time *without* a colon."); else if (yearerr) printf("You must enter an integer year beteen 1975 and today."); else if (montherr) printf("You must enter an integer month from 1 and 12."); else if (dayerr) printf("You must enter an integer day from 1 to 31."); else if (starterr) printf("You must enter a decimal start time from 0.0 to 24.0 "); else if (stoperr) printf("You must enter a decimal stop time from 0.0 to 24.0 "); else printf("sufficient"); printf("

"); } else{ /* Write acceptance message back to the browser */ printf("Content-Type: text/html%c%c", 10, 10); printf(" Request Received

Your request has been recorded. The computer is now attempting to process your data request. The data will be in %s ascii, tab-delimited format with a one line header. The data processing will probably be complete within 1 hour. You will be notified by e-mail when the data are ready and you will receive instructions for downloading them. When available, your data will be placed in an anonymous ftp directory on leadbelly.lanl.gov called:/pub/%d If you wish to use your web browser to access the data the url will be ftp://leadbelly.lanl.gov/pub/%d

If you have any questions or difficulties please contact:

  • Richard D. Belian, rbelian@lanl.gov
    Principal Investigator for the CPA and SOPA instruments
  • Geoff Reeves, reeves@lanl.gov
    Co-I & primary data analyst for the CPA and SOPA data
  • Peter McLachlan, psm@nis.lanl.gov
    Software designer for the LANL-EP data request system



[ EP Home | Requests| Browse | Projects | Information ]

\"Geoff Produced and Maintains the LANL Energetic Particle Web Pages.
Last updated Wednesday March 5, 1997
",compress,t2,t2,t2); }; fclose(outfi); if (error != 1) { system(mailname); system(mailname2); system(mailname3); sprintf(echoname,"echo>/belly1/home/lanl_geo/support/queue/%d",t2); system(echoname); } /**/ }