/*
* to preprocess using CYGWIN tools:
* cpp -E -P -C -o rgb2html.java rgb2html_in.java
*
* or, using BORLAND BCC55 tools:
* cpp32 -Sr -Sc -otextToHtml.java rgb2html_in.java
* cpp32 -Sr -Sc -otextToHtml.c txToHt.c
*/
#include %s
\n", thetitle);
while(getline(line) != 0){
printf("%s", line);
}
printf("
");
un_P = 1;
}
while((c = getchar()) != EOF)
{
if(c == '\t'){
tabon = 1;
tabulations = tabulations + 11;
continue;
}
if(c == ' ' && tabon == 1){
tabulations += 1;
continue;
}
if(c == '\n'){
s[i] = '<';
++i;
s[i] = '/';
++i;
s[i] = 'p';
++i;
s[i] = '>';
++i;
s[i] = '\n';
++i;
s[i] = '\0';
un_P = 0;
return lignevide(d, s);
}
if(32 < c <= 'z'){
if(tabulations>0){
printf("", tabulations);
tabulations = 0;
tabon = 0;
}
s[i] = c;
++i;
break;
}
s[i] = c;
++i;
}
while((c = getchar()) != EOF && c != '\n')
{
if(c == '\t'){ // \t = 9
tabon = 1;
tabulations = tabulations + 11;
continue;
}
if(c == ' ' && tabon == 1){
tabulations = tabulations + 1;
continue;
}
if(32 < c <= 'z' && tabulations>0){
printf("
", tabulations);
tabulations = 0;
tabon = 0;
}
s[i++] = c;
/* if (i%80 == 0 && split == 0)
{
while((c = getchar()) != ' ' && c != '\n' && c != EOF)
s[i++] = c;
if(un_P == 1){
s[i++] = '<';
s[i++] = 'b';
s[i++] = 'r';
s[i++] = '>';
split = 1;
}
}*/
}
if(c == '\n')
{
if(un_P == 1){
s[i] = '<';
++i;
s[i] = '/';
++i;
s[i] = 'b';
++i;
s[i] = 'r';
++i;
s[i] = '>';
++i;
s[i] = '\n';
++i;
}
s[i] = c;
}
s[i] = '\0';
return *s;
}
char lignevide(char to[], char from[])
{
int i;
for(i = 0; from[i] != '\0' ; i++){
if(to[i] != ' ' && to[i] != '\t')
to[i] = from[i];
}
//to[i+1] = '\0';
return *to;
}
void usage(){
printf("\nUsage: xtTohtm [ title ] [ < input file.txt ] [ > output file.html ]\n");
}