mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 21:19:24 +00:00
New option --output-file.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <stdlib.h> /* declares atoi(), abs(), exit() */
|
||||
#include <string.h> /* declares strcmp() */
|
||||
#include <ctype.h> /* declares isdigit() */
|
||||
#include <limits.h> /* defines CHAR_MAX */
|
||||
#include "getopt.h"
|
||||
#include "version.h"
|
||||
|
||||
@@ -84,6 +85,14 @@ Options::long_usage (FILE * stream) const
|
||||
"If a long option shows an argument as mandatory, then it is mandatory\n"
|
||||
"for the equivalent short option also.\n");
|
||||
fprintf (stream, "\n");
|
||||
fprintf (stream,
|
||||
"Output file location:\n");
|
||||
fprintf (stream,
|
||||
" --output-file=FILE Write output to specified file.\n");
|
||||
fprintf (stream,
|
||||
"The results are written to standard output if no output file is specified\n"
|
||||
"or if it is -.\n");
|
||||
fprintf (stream, "\n");
|
||||
fprintf (stream,
|
||||
"Input file interpretation:\n");
|
||||
fprintf (stream,
|
||||
@@ -417,6 +426,7 @@ PositionStringParser::nextPosition ()
|
||||
Options::Options ()
|
||||
: _option_word (C),
|
||||
_input_file_name (NULL),
|
||||
_output_file_name (NULL),
|
||||
_iterations (0),
|
||||
_jump (DEFAULT_JUMP_VALUE),
|
||||
_initial_asso_value (0),
|
||||
@@ -521,6 +531,7 @@ Options::~Options ()
|
||||
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
{ "output-file", required_argument, NULL, CHAR_MAX + 1 },
|
||||
{ "delimiters", required_argument, NULL, 'e' },
|
||||
{ "struct-type", no_argument, NULL, 't' },
|
||||
{ "language", required_argument, NULL, 'L' },
|
||||
@@ -826,6 +837,11 @@ Options::parse_options (int argc, char *argv[])
|
||||
_option_word |= SEVENBIT;
|
||||
break;
|
||||
}
|
||||
case CHAR_MAX + 1: /* Set the output file name. */
|
||||
{
|
||||
_output_file_name = /*getopt*/optarg;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
short_usage (stderr);
|
||||
exit (1);
|
||||
|
||||
Reference in New Issue
Block a user