Mega Code Archive
Remove HTML markup
#include
#include
#define IN 0
#define OUT 1
int main(void) {
int c = 0;
int state = OUT;
int tstate = OUT;
char tagbuff[2048];
char *ptr1 = NULL;
ptr1 = tagbuff;
while((c = getchar()) != EOF) {
/* copy tag into tagbuff */
if(c == '<' || c == '&') state = IN;
if(state == IN) *ptr1++ = c;
if(c == '>' || c == ';') {
state = OUT; *ptr1++ = '\0';
/* search tagbuff, javascript, style tags */
if(strstr(tagbuff, "' && c != ';')
printf("%c", c);
}
return 0;
}