#include #include #include #include #include "globals.h" #include "functions.h" void change_tag(char *tag) { char *s,*r; int t,l; if (fixwin95paths==1) fixwinpath(tag); s=strcasestr_m(tag,".asp"); if (s!=0) { s[1]='p'; s[2]='h'; s[3]='p'; if (php==3 || php==4) { l=strlen(s)+1; for (t=l; t>=5; t--) { s[t]=s[t-1]; } s[4]=php+'0'; } } s=strcasestr_m(tag,".gif"); if (s!=0 && pngs==1) { s[1]='p'; s[2]='n'; s[3]='g'; } s=strcasestr_m(tag,".htm"); if (s!=0 && html==1) { if (strcasestr_m(s,".html")!=s) { s=s+4; r=tag+strlen(tag); while (1) { r[1]=r[0]; if (r==s) break; r--; } s[0]='l'; } } } /* parse_tag() will change occurances of .asp to .php/.php3/.php4 and change .htm to .html */ void parse_tag() { int ch,lastchar; int count=0; char extension[12]; while((ch=getc(in))!=EOF) { lastchar=ch; if (!((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')) || count>3) { break; } extension[count++]=ch; } extension[count]=0; if (strcasecmp(extension,"htm")==0 && html==1) { strcpy(extension,"html"); } else if (strcasecmp(extension,"asp")==0) { strcpy(extension,"php"); if (php==3) strcat(extension,"3"); else if (php==4) strcat(extension,"4"); } else if (strcasecmp(extension,"gif")==0 && pngs==1) { strcpy(extension,"png"); } fprintf(out,"%s",extension); putc(lastchar,out); } /* check and see if a tag is "; int endptr; endptr=0; while((ch=getc(in))!=EOF) { if (javascript==1) { if (tolower(ch)==endscript[endptr++]) { if (endscript[endptr]==0) { endptr=0; javascript=0; } } else { endptr=0; } } if (javascript==1 && (ch=='%' && lastchar=='<')) { if ((flags&1)==0) { fprintf(out,"