Public feed #377342

Untitled

public text v1 · immutable
Raw Edit
·published 2007-03-01 17:55 UTC
rendered paste body
#include <stdio.h>
#define BUFSIZE 1024

main(int argc, char *argv[])
{
        int x = 1;
        if(argc == 1) {
           fprintf(stderr, "Usage: %s file\n", argv[0]); 
           exit(1);
        }

        FILE *fp;
        char str[BUFSIZE];

        while(--argc > 0) {
                int y;
                if((fp = fopen(*++argv, "r")) == NULL) {

                        fprintf(stderr, "Kan bestand %s niet openen\n", *argv);
                        exit(1);
                }
                while(fgets(str, BUFSIZE, fp) != NULL) {
                        y = 0;
                        //printf("DEBUGGING: %s", str);
                        while(str[y] != '\0') {
                        if(str[y] == '<' && str[y+1] == '!' && str[y+2] == '-' && str[y+3] == '-') {
                           for(y=y+4; str[y] != '-' && str[y+1] != '-' && str[y+2] != '>'; y++)
                                        printf("%c", str[y]);
                           }
                        y++;
                        }
                }
        }
}