#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