#include #include #include #include #include #include #include main(int argc,char *argv[]){ char *a,*b,*c,*d,*e,*f,*g,*h,*ci,*ei,*fi,*hold1,*hold2; extern char **environ; FILE *fpin,*fpout,*fpind,*fin1,*fin2,*fin3,*fhead; int i,j,k,l,m,n,ico1,idir; int c1,c2,c3,c4; char hol1,ait[1024]; char dirname[24]; fpind=fopen("bobmay.txt","r"); idir=0; c=(char *)malloc(1024); hold1=(char *)malloc(1024); d=(char *)malloc(1024); hold2=(char *)malloc(1024); e=(char *)malloc(1024); g=(char *)malloc(10); ci=(char *)malloc(100); ei=(char *)malloc(100); fi=(char *)malloc(100); fin1=fopen("index.html","w"); fputs("Classified Index",fin1); fputs("\n",fin1); fputs("

Classified Index

",fin1); fputs("

\n",fin1); fhead=fopen("header.html","r"); c1=getc(fhead); while(c1!=EOF){ putc(c1,fin1); c1=getc(fhead); } fclose(fhead); fclose(fin1); while (fgets(ait,1024,fpind)!=NULL) { printf("ait is %s",ait); if (strstr(ait,"HEADERS")!=NULL) { if ((a=strstr(ait,";"))!=NULL){ a++; while(!isalnum(*a)){ a++; } b=strstr(ait,"Classified"); b--; while(!isalnum(*b)){ b--; } i=b-a+1; c=(char *)realloc(c,i+1); hold1=(char *)realloc(hold1,i+1); ci=(char *)realloc(ci,i+12); idir=1; strncpy(c,a,i); *(c+i)=0; strcpy(hold1,c); printf("%d %d %s \n",i,strlen(c),c); for(j=0;j\n",fin1); fputs("",fin1); fputs(hold1,fin1); fputs("",fin1); fputs("

\n",fin1); fputs("\n",fin1); printf("this is c in brackets (%s)\n",c); fin2=fopen(ci,"w"); fputs("",fin2); fputs(hold1,fin2); fputs(" Index",fin2); fhead=fopen("header.html","r"); c1=getc(fhead); while(c1!=EOF){ putc(c1,fin2); c1=getc(fhead); } fclose(fhead); fputs("

",fin2); fputs(hold1,fin2); fputs(" Index

",fin2); fclose(fin2); } else if((a=strstr(ait,"-"))!=NULL) { printf("one more level...\n"); a++; while(!isalnum(*a)){ a++; } if((b=strstr(ait,"Classified"))==NULL){ b=strstr(ait,"Editorial"); } b--; while(!isalnum(*b)){ b--; } i=b-a+1; d=(char *)realloc(d,i+1); hold2=(char *)realloc(hold2,i+1); e=(char *)realloc(e,i+strlen(c)+strlen(d)+2); ei=(char *)realloc(ei,i+strlen(c)+strlen(d)+13); idir=2; strncpy(d,a,i); *(d+i)=0; strcpy(hold2,d); for(j=0;j\n",fin2); fputs("",fin2); fputs(hold2,fin2); fputs("",fin2); fclose(fin2); fin3=fopen(ei,"w"); fputs("",fin3); fputs(hold2,fin3); fputs(" Index",fin3); fhead=fopen("header.html","r"); c1=getc(fhead); while(c1!=EOF){ putc(c1,fin3); c1=getc(fhead); } fclose(fhead); fputs("

",fin3); fputs(hold2,fin3); fputs(" Index

",fin3); fputs("
",fin3); fputs("Back up one level.
",fin3); fputs("",fin3); fclose(fin3); printf("this is e in brackets %s\n",e); printf("(%s)\n",e); } } else if((f=strstr(ait,"ADSCOPY"))!=NULL) { if ((g=strstr(ait,".EPS"))!=NULL){ f=f+8; k=g-f+1; printf(" k is %d\n",k); h=(char *)realloc(h,k+4); strncpy(h,f,k); *(h+k)=0; strcat(h,"eps"); printf("h %s e %s ei %s\n",h,e,ei); printf("\n"); fflush(NULL); if (fork()==0){ execlp("bar4","bar4",h,e,ei,NULL); } wait(&l); } } printf("getting line ...\n"); } fclose(fin1); }