Move code around
diff --git a/util/options.cc b/util/options.cc
index 4e75827..ff596d0 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -121,9 +121,10 @@
GError *parse_error = NULL;
if (!g_option_context_parse (context, argc, argv, &parse_error))
{
- if (parse_error != NULL)
+ if (parse_error != NULL) {
fail (TRUE, "%s", parse_error->message);
- else
+ //g_error_free (parse_error);
+ } else
fail (TRUE, "Option parse error");
}
}
@@ -543,3 +544,25 @@
*len = ret_len;
return ret;
}
+
+
+FILE *
+output_options_t::get_file_handle (void)
+{
+ if (fp)
+ return fp;
+
+ if (output_file)
+ fp = fopen (output_file, "wb");
+ else {
+#if HAVE_IO_H
+ _setmode (fileno (stdout), O_BINARY);
+#endif
+ fp = stdout;
+ }
+ if (!fp)
+ fail (FALSE, "Cannot open output file `%s': %s",
+ g_filename_display_name (output_file), strerror (errno));
+
+ return fp;
+}