File: [Platon] / libplaton / platon / html / read.c (download)
Revision 1.5, Sat Oct 5 09:52:43 2002 UTC (21 years, 5 months ago) by nepto
Changes since 1.4: +3 -3
lines
CVS tag $Id was cahnged fro $Platon.
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <platon/html/read.h>
enum html_reads html_read(FILE *f, char *p, int len)
{
int i=0;
if(f==NULL||p==NULL)return(HTML_ERROR);
while(1){
if(i==len-1)break;
p[i]=getc(f);
if(feof(f))break;
if(p[i]=='\0')break;
if(p[0]==HTML_TAG_BEGIN){
if(p[i]==HTML_TAG_END){
if(i<=4||strncmp(p,"<!--",4)||(!strncmp(p,"<!--",4)&&!strncmp(p+i-2,"-->",3))){
i++;
break;
}
}
}
else{
if(p[i]==HTML_TAG_BEGIN){
ungetc(p[i],f);
break;
}
}
i++;
}
if(!i){
/* free(p); */
return(HTML_EOF);
}
else{
p[i]='\0';
return(p[0]==HTML_TAG_BEGIN?HTML_TAG:HTML_TEXT);
}
}
Platon Group <platon@platon.org> http://platon.org/
|