[BACK]Return to oxgen-index.c CVS log [TXT][DIR] Up to [local] / OpenXM / doc / OpenXM-web / src

Annotation of OpenXM/doc/OpenXM-web/src/oxgen-index.c, Revision 1.1

1.1     ! takayama    1: #include <stdio.h>
        !             2: #include <string.h>
        !             3: #define BSIZE (2024*10)
        !             4:
        !             5: int main(int argc,char *argv[]) {
        !             6:   char comm[1024];
        !             7:   char base[1014];
        !             8:   FILE *fp;
        !             9:   char line[BSIZE];
        !            10:   if (argc < 2) strcpy(base,".");
        !            11:   else strcpy(base,argv[1]);
        !            12:
        !            13:   printf("<html><body>\n");
        !            14:   sprintf(comm,"find %s -name \"*.pdf\" -print >tmp-pdf.tmp",base);
        !            15:   system(comm);
        !            16:   printf("<h1> PDF documents in this folder </h1>\n<ol>\n");
        !            17:   fp = fopen("tmp-pdf.tmp","r");
        !            18:   while (fgets(line,BSIZE-2,fp) !=NULL) {
        !            19:     if (line[strlen(line)-1] == '\n') {
        !            20:       line[strlen(line)-1]=0;
        !            21:     }
        !            22:     printf("<li><a href=\"%s\"> %s </a>\n",line,line);
        !            23:   }
        !            24:   printf("</ol>\n\n");
        !            25:   fclose(fp);
        !            26:
        !            27:   sprintf(comm,"find %s -name \"*.html\" -print >tmp-pdf.tmp",base);
        !            28:   system(comm);
        !            29:   printf("<h1> HTML documents in this folder </h1>\n<ol>\n");
        !            30:   fp = fopen("tmp-pdf.tmp","r");
        !            31:   while (fgets(line,BSIZE-2,fp) !=NULL) {
        !            32:     if (line[strlen(line)-1] == '\n') {
        !            33:       line[strlen(line)-1]=0;
        !            34:     }
        !            35:     printf("<li><a href=\"%s\"> %s </a>\n",line,line);
        !            36:   }
        !            37:   printf("</ol>\n\n");
        !            38:   fclose(fp);
        !            39:
        !            40:   printf("</body></html>\n");
        !            41:   return(0);
        !            42: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>