// Generic HTML handler/parser
//
#include
#include
#include
#include
#include "urlencode.c"
#include "htmtag.c"
#define MAXSTRLEN 4096
#define HTMLSTRLEN MAXSTRLEN
char htmlstr[HTMLSTRLEN];
char*htmls=htmlstr;
char*absURL;
char linestr[MAXSTRLEN];
int linestrlen=0;
FILE*fo;
int istag=0;
int pref=0;
int rowlen=0,lastchr=' ';
int lastchr;
int form=0;
int desiredform=32767;
char desiredformname[]="postcomment";
int usesubmit=0;
int textarea=0;
int formnum=0;
char formname[256]="";
char selectname[256]="";
int isheader=0;
long inputline=0;
void xfputs(char*s)
{ char*sp;
sp=s;while(sp[0]){if(sp[0]==0x02)sp[0]=' ';sp++;}
fprintf(fo,"%s",s);
}
void flushtag()
{ htmls[0]=0;
if(allowoutput())xfputs(htmlstr);
htmls=htmlstr;
}
void normalizetag(char*s)
{ char*s1;
int t;
char c;
int quot=0;
for(t=0;t1)printf("\n");
printf("FORM:%i:%s|METHOD:%s|ACTION:%s\n",formnum,formname,s3,s1);
}
void handlebasetag(char*s)
{ char s1[4096],s2[4096],s3[4096],s4[4096];
s1[0]=0;s2[0]=0;s3[0]=0;s4[0]=0;
formname[0]=0;formnum++;
gethtmltagvalue(s,"HREF",s1);
printf("BASE|HREF:%s\n",s1);
}
void handleformtag(char*s)
{ int n=0;
if(!strncmpi(s,"