fail (true, "At least one of text or text-file must be set");
if (0 != strcmp (text_file, "-"))
- {
fp = fopen (text_file, "r");
- close_fp = true;
- }
else
fp = stdin;
return fp;
if (output_file)
- {
fp = fopen (output_file, "wb");
- close_fp = true;
- }
else {
#if defined(_WIN32) || defined(__CYGWIN__)
setmode (fileno (stdout), O_BINARY);
text_file = nullptr;
fp = nullptr;
- close_fp = false;
gs = nullptr;
line = nullptr;
line_len = (unsigned int) -1;
g_free (text_file);
if (gs)
g_string_free (gs, true);
- if (close_fp)
+ if (fp && fp != stdin)
fclose (fp);
}
private:
FILE *fp;
- bool close_fp;
GString *gs;
char *line;
unsigned int line_len;
explicit_output_format = false;
fp = nullptr;
- close_fp = false;
add_options (parser);
}
{
g_free (output_file);
g_free (output_format);
- if (close_fp)
+ if (fp && fp != stdout)
fclose (fp);
}
bool explicit_output_format;
mutable FILE *fp;
- bool close_fp;
};
struct format_options_t : option_group_t