40 fflush((FILE *)
fout);
42 if(
fin != 0) fclose((FILE *)
fin);
49 fin = (
void *) fopen(infile,
"r");
52 printf(
"could not open %s\n",infile);
57 fout = (
void *) fopen(outfile,
"w");
60 printf(
"could not write %s\n",outfile);
66 fout = (
void *) stdout;
80 fin = (
void *) fopen(infile,
"r");
83 printf(
"could not open %s\n",infile);
105 FILE *out = (FILE *)
fout;
106 int len = strlen(tag);
107 while(
line[i] !=
'\0' &&
line[i] !=
'\n')
109 if(strncmp(&
line[i],tag,len) == 0)
111 for(
int it=0; it<len; it++)
113 fputc(
line[i++],out);
115 if(
line[i] ==
'<') i--;
120 fputc(
line[i++],out);
128 FILE *out = (FILE *)
fout;
129 while(
line[i] !=
'\0' &&
line[i] !=
'\n')
137 if(
line[i] ==
' ' ||
line[i] ==
'\t')
143 fputc(
line[i++],out);
153 FILE *out = (FILE *)
fout;
154 while(
line[i] !=
'\0' &&
line[i] !=
'\n')
161 else if(
line[i] ==
'>')
167 else if(
line[i] ==
'/' &&
line[i+1] ==
'>')
170 fputc(
line[i++],out);
176 fputc(
line[i++],out);
185 FILE *out = (FILE *)
fout;
187 while(
line[i] !=
'\0' &&
line[i] !=
'\n')
189 while(
line[i] ==
' ' ||
line[i] ==
'\t' ) i++;
191 if (strncmp(&
line[i],
"<?",2) == 0)
193 fputc(
line[i++],out);
194 fputc(
line[i++],out);
198 else if(strncmp(&
line[i],
"<!",2) == 0)
200 fprintf(out,
"%s",&
line[i]);
201 if(strstr(&
line[i],
">") != NULL)
return;
202 while(fgets(
line,
sizeof(
line)-1,(FILE *)
fin) != 0)
204 fprintf(out,
"%s",
line);
205 if(strstr(
line,
">") != NULL)
return;
209 else if(strncmp(&
line[i],
"<desc",5) == 0)
211 fprintf(out,
"%s",&
line[i]);
214 else if(strncmp(&
line[i],
"</",2) == 0)
216 if(strncmp(&
line[i],
"</svg>",6) == 0)
218 fprintf(out,
"</svg>");
221 if(strncmp(&
line[i],
"</SVG>",6) == 0)
223 fprintf(out,
"</SVG>");
226 fputc(
line[i++],out);
227 fputc(
line[i++],out);
231 else if(strncmp(&
line[i],
"<",1) == 0)
233 fputc(
line[i++],out);
236 else if(strncmp(&
line[i],
"/>",2) == 0)
238 fputc(
line[i++],out);
239 fputc(
line[i++],out);
242 else if(strncmp(&
line[i],
">",1) == 0)
244 fputc(
line[i++],out);
int open(const char *infile, const char *outfile=0)
int outUntil(int i, const char *tag)
int reopenSocket(const char *infile, int s)