/* Bruce Bockius September 1996 Converts InFileName, a tab delinated file generated my FMPro into OutFileName, a HTML file indexing the many individual HTML files created in OutDir for each date. Modified 3/6/97 to correct build time/analysis time errors. */ #include ; #include ; #include ; #include ; #include ; #define InFileName "C:\\PROGRA~1\\FMPRO\\BUILD.TAB" #define OutTmpName "C:\\FRONTP~1\\Zodiac\\Zodiac\\BUILD.TMP" #define OutFileName "C:\\FRONTP~1\\Zodiac\\Zodiac\\LOG.HTM" #define OutDir "C:\\FRONTP~1\\Zodiac\\Zodiac\\BUILD\\" #define BufSize 10000 #define MaxEntries 350 main() { FILE *InLogFile,*InHTMLFile,*OutFile,*OutPage; int a,b,c,d,i,j,Entry,LastEntry; char *Buf,ShortDesc[128],*LongDesc,*p,*BI; char AsOfDate[12],Date[12],Date2[12],SubName[80],d2[12]; float BuildTime,AnalysisTime,TotalTime,RBuild,RAnalysis; struct date DosDate; char LinkData[MaxEntries][9]; clrscr(); printf("Converting " InFileName " to " OutFileName " and " OutDir "*.HTM\n\n"); /* InHTMLFile The old BUILD.HTM file from GNN Press InLogFile The new A:BUILD.TAB file from filemaker pro OutFile The new BUILD.TMP file for GNN Press OutPage The individual detailed descriptions */ printf("Opening original HTML file...\n"); if ((InHTMLFile=fopen(OutFileName,"r"))==NULL) { printf("ERROR OPENING INPUT HTML FILE: " OutFileName "\n\n"); abort(); } printf("Opening Temporary output file...\n"); if ((OutFile=fopen(OutTmpName,"w"))==NULL) { printf("ERROR OPENING TEMP OUTPUT FILE: " OutTmpName "\n\n"); fcloseall(); abort(); } printf("Opening Input Log file...\n"); if ((InLogFile=fopen(InFileName,"r"))==NULL) { printf("ERROR OPENING INPUT LOG FILE 1st TIME: " InFileName "\n\n"); fcloseall(); abort(); } /* Ok, copy everything before the first table */ printf("Allocating memory...\n"); if ((Buf=malloc(BufSize))==NULL) { fcloseall(); printf("MALLOC FAILED FOR Buf\n\n"); abort(); } if ((LongDesc=malloc(BufSize))==NULL) { fcloseall(); free(Buf); printf("MALLOC FAILED FOR LongDesc\n\n"); abort(); } printf("Copying start of original HTML file...\n"); do { p=fgets(Buf,BufSize,InHTMLFile); fprintf(OutFile,"%s",Buf); } while ((strncmp(Buf,"\n\nTotal build time as of\n\n\n"); fprintf(OutFile,"%s:\n",AsOfDate); fprintf(OutFile,"\n\n"); fprintf(OutFile,"%6.1f hours\n",RAnalysis); fprintf(OutFile,"\n\n\n\nTotal analysis time:\n\n\n\n\n"); fprintf(OutFile,"%6.1f hours\n\n\n",RBuild); fprintf(OutFile,"\n\nTOTAL TIME:\n\n\n\n\n"); fprintf(OutFile,"%6.1f hours\n\n\n\n",TotalTime); /* Construct table #2 */ printf("Creating table #2 in temporary file...\n"); fprintf(OutFile,"

\n\n"); fprintf(OutFile,"\n\n"); fprintf(OutFile,"\n"); fprintf(OutFile,"\n\n"); LastEntry=Entry-1; Entry=0; do { p=fgets(Buf,BufSize,InLogFile); if (p==NULL) continue; j=0; BI=Buf; for (i=0;i\n",Date); fprintf(OutFile,"\n",TotalTime); strcpy(SubName,"build/"); strcpy(Date2,Date); if (Date2[1]=='/') { strcpy(d2,Date2); d2[1]=d2[0]; d2[0]='0'; d2[2]=0; strcat(d2,"/"); strcat(d2,Date2+2); strcpy(Date2,d2); } /* now it looks like 02/5/97 */ if (Date2[4]=='/') { strcpy(d2,Date2); d2[4]=d2[3]; d2[3]='0'; d2[5]=0; strcat(d2,"/"); strcat(d2,Date2+5); strcpy(Date2,d2); } /* Now it looks like 02/05/97 */ for (i=0;i\n%s\n\n\n",SubName,ShortDesc); strcpy(SubName,OutDir); strcat(SubName,Date2); strcat(SubName,".HTM"); printf("Opening %s...\n",SubName); if ((OutPage=fopen(SubName,"w"))==NULL) { free(Buf); free(LongDesc); fcloseall(); printf("\n\nERROR OPENING OUTPUT FILE: %s\n\n",SubName); abort(); } fprintf(OutPage,"\n\n%s\n",ShortDesc); fprintf(OutPage,"\n"); fprintf(OutPage,"\n"); fprintf(OutPage,"

Builder's Log %s

\n",Date); fprintf(OutPage,"

%s

\n",ShortDesc); fprintf(OutPage,"

Build Time: %6.1f hours ... Analysis Time: %6.1f hours\n",BuildTime,AnalysisTime); fprintf(OutPage,"

%s

\n",LongDesc); if (Entry>0) fprintf(OutPage,"Next Log Entry . . . \n",LinkData[Entry-1]); if (EntryPrevious Log Entry\n",LinkData[Entry+1]); fprintf(OutPage,"

Back to Log Index

\n"); fprintf(OutPage,"

To First Page

\n"); fprintf(OutPage,"\n"); fclose(OutPage); Entry++; } while (p!=NULL); fprintf(OutFile,"

\nDATE\n

\nBUILD and\n

\nANALYSIS\n

\nTIME (hours)\n

\nDESCRIPTION SUMMARY\n

\n%s\n\n%6.1f\n
\n"); free(LongDesc); /* copy end of input file - first skip 2 tables */ printf("Copying end of original HTML file...\n"); do { p=fgets(Buf,BufSize,InHTMLFile); } while ((strncmp(Buf,"",8))&&(p!=NULL)); if (p==NULL) { printf("'' number one not found in input file\n\n"); fcloseall(); free(Buf); abort(); } do { p=fgets(Buf,BufSize,InHTMLFile); } while ((strncmp(Buf,"",8))&&(p!=NULL)); if (p==NULL) { printf("'' number two not found in input file\n\n"); fcloseall(); free(Buf); abort(); } do { p=fgets(Buf,1024,InHTMLFile); if (p!=NULL) fprintf(OutFile,"%s",Buf); } while ((strncmp(Buf,"