C Program used to create the Man pages index.html(not for you don't open it)

#include<stdio.h>
#include<string.h>
#define MAX_FILE_PATHLEN 512
#define MAX_DATA 512
#define MAX_COLMS 3
int main(void)
{
   FILE *fp,*fp2;
   int Count=0;
   char mFilePath[MAX_FILE_PATHLEN];
   char mDataIn[MAX_DATA];
   char mData[MAX_DATA];
   char mDataOut[2000];
   char percentile[2]={37,0};
 
   printf("enter the absolute path of the man files list \n");
   scanf("%s",mFilePath);
   fp = fopen(mFilePath,"r");
  
   printf("enter the absolute path of output index.html \n");
   scanf("%s",mFilePath);
   fp2 = fopen(mFilePath,"w+");
   if(fp == NULL || fp2 == NULL)
   {
      return -1;
   }

   fprintf(fp2,"<div id=Manpage></div>");
   fprintf(fp2,"%s","<table border=\"1\">");

   while(!feof(fp))
   {
      fscanf(fp,"%s",mDataIn);


      if(Count == 0)
      {
         fprintf(fp2,"%s","<tr>");
      }
      strncpy(mData,&mDataIn[7],(strlen(mDataIn)-12));
      mData[(strlen(mDataIn)-12)]=0;
      sprintf(mDataOut,"<td><input type=\"button\" value=\"%s\"name=\"B4\" onclick=\"document.getElementById('Manpage').innerHTML='&lt;iframe src=&quot; http://manpages.x10.bz/drupal/html-man-pages/",mData);
      strcat(mDataOut,&mDataIn[2]);
      strcat(mDataOut,"&quot; width=&quot;100");
      strcat(mDataOut,percentile);
      strcat(mDataOut,"&quot; height=&quot;100");
      strcat(mDataOut,percentile);
      strcat(mDataOut,"&quot; scrolling=&quot;yes&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;'\">\n");
      Count ++;
      fprintf(fp2,"%s",mDataOut);

      if(Count == MAX_COLMS)
      {
         Count = 0;
         fprintf(fp2,"%s","</tr>");
      }
   }
   if(Count != 0)
   {
      fprintf(fp2,"%s\n","</tr>");
   }
   fprintf(fp2,"%s","</table>");
   fclose(fp);
   fclose(fp2);
   return 0;
}

No comments:

Post a Comment

తెలుగులో వ్రాయడానికి http://www.google.com/ime/transliteration/ ఉపయోగించండి.