word spaceword;
textfile tf;
wchar_t *prefixextra;
- int nesting, nestindent;
+ int nesting, nestbase, nestindent;
int indentb, indenta;
IGNORE(unused);
/*
* Open the output file.
*/
- tf.fp = fopen(conf.filename, "w");
+ if (!strcmp(conf.filename, "-"))
+ tf.fp = stdout;
+ else
+ tf.fp = fopen(conf.filename, "w");
if (!tf.fp) {
error(err_cantopenw, conf.filename);
return;
conf.atitle, conf.indent, conf.width, &conf);
nestindent = conf.listindentbefore + conf.listindentafter;
- nesting = (conf.indent_preambles ? 0 : -conf.indent);
+ nestbase = (conf.indent_preambles ? 0 : -conf.indent);
+ nesting = nestbase;
/* Do the main document */
for (p = sourceform; p; p = p->next) switch (p->type) {
break;
case para_LcontPop:
nesting -= nestindent;
- assert(nesting >= 0);
+ assert(nesting >= nestbase);
break;
/*
* Tidy up
*/
text_output(&tf, NULL); /* end charset conversion */
- fclose(tf.fp);
+ if (tf.fp != stdout)
+ fclose(tf.fp);
sfree(conf.asect);
sfree(conf.filename);
}