Fix reading text from stdin
diff --git a/util/options.hh b/util/options.hh
index c521e75..a101f7d 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -178,14 +178,17 @@
text = NULL;
text_file = NULL;
- file = NULL;
+ fp = NULL;
+ gs = NULL;
text_len = (unsigned int) -1;
add_options (parser);
}
~text_options_t (void) {
- if (file)
- g_mapped_file_unref (file);
+ if (gs)
+ g_string_free (gs, TRUE);
+ if (fp)
+ fclose (fp);
}
void add_options (option_parser_t *parser);
@@ -204,8 +207,9 @@
const char *text_file;
private:
- mutable GMappedFile *file;
- mutable unsigned int text_len;
+ FILE *fp;
+ GString *gs;
+ unsigned int text_len;
};
struct output_options_t : option_group_t
@@ -219,7 +223,7 @@
add_options (parser);
}
~output_options_t (void) {
- if (fp && fp != stdout)
+ if (fp)
fclose (fp);
}