133 |
open_input_file(file) |
open_input_file(file) |
134 |
const char *file; |
const char *file; |
135 |
{ |
{ |
|
char command[MAXFILLEN]; |
|
136 |
FILE *ip; |
FILE *ip; |
137 |
|
|
138 |
snprintf(command, sizeof(command), "gtags --expand -%d < %s", tabs, file); |
ip = fopen(file, "r"); |
|
ip = popen(command, "r"); |
|
139 |
if (!ip) |
if (!ip) |
140 |
die("cannot execute '%s'.", command); |
die("cannot open file '%s'.", file); |
141 |
curpfile = file; |
curpfile = file; |
142 |
warned = 0; |
warned = 0; |
143 |
return ip; |
return ip; |
149 |
close_input_file(ip) |
close_input_file(ip) |
150 |
FILE *ip; |
FILE *ip; |
151 |
{ |
{ |
152 |
if (pclose(ip) != 0) |
fclose(ip); |
|
die("command 'gtags --expand -%d' failed.", tabs); |
|
153 |
} |
} |
154 |
/* |
/* |
155 |
* Open HTML file. |
* Open HTML file. |
753 |
fputs_nl(verbatim_begin, out); |
fputs_nl(verbatim_begin, out); |
754 |
last_lineno = 0; |
last_lineno = 0; |
755 |
while ((_ = strbuf_fgets(sb, in, STRBUF_NOCRLF)) != NULL) { |
while ((_ = strbuf_fgets(sb, in, STRBUF_NOCRLF)) != NULL) { |
756 |
|
int dst = 0; |
757 |
|
|
758 |
fputs(gen_name_number(++last_lineno), out); |
fputs(gen_name_number(++last_lineno), out); |
759 |
for (; *_; _++) { |
for (; *_; _++) { |
760 |
int c = *_; |
int c = *_; |
761 |
|
|
762 |
if (c == '&') |
if (c == '\t') { |
763 |
fputs(quote_amp, out); |
do { |
764 |
else if (c == '<') |
putc(' ', out); |
765 |
fputs(quote_little, out); |
} while (++dst % tabs); |
766 |
else if (c == '>') |
} else { |
767 |
fputs(quote_great, out); |
if (c == '&') |
768 |
else |
fputs(quote_amp, out); |
769 |
fputc(c, out); |
else if (c == '<') |
770 |
|
fputs(quote_little, out); |
771 |
|
else if (c == '>') |
772 |
|
fputs(quote_great, out); |
773 |
|
else |
774 |
|
fputc(c, out); |
775 |
|
dst++; |
776 |
|
} |
777 |
} |
} |
778 |
fputc('\n', out); |
fputc('\n', out); |
779 |
} |
} |