- in->currfp = fopen(in->filenames[in->currindex], "r");
- if (in->currfp) {
- setpos(in, in->filenames[in->currindex]);
- in->charset = in->defcharset;
- in->csstate = charset_init_state;
- in->wcpos = in->nwc = 0;
- in->pushback_chars = NULL;
+ setpos(in, in->filenames[in->currindex]);
+ in->charset = in->defcharset;
+ in->csstate = charset_init_state;
+ in->wcpos = in->nwc = 0;
+ in->pushback_chars = NULL;
+
+ if (!in->filenames[in->currindex]) {
+ in->currfp = stdin;
+ in->wantclose = FALSE; /* don't fclose stdin */
+ /*
+ * When reading standard input, we always expect to see
+ * an actual Halibut file and not any of the unusual
+ * input types like fonts.
+ */