mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
New option --output-file.
This commit is contained in:
11
src/main.cc
11
src/main.cc
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
#include "input.h"
|
||||
#include "search.h"
|
||||
@@ -78,6 +79,16 @@ main (int argc, char *argv[])
|
||||
searcher.optimize ();
|
||||
list = searcher._head;
|
||||
|
||||
/* Open the output file. */
|
||||
if (option.get_output_file_name ())
|
||||
if (strcmp (option.get_output_file_name (), "-") != 0)
|
||||
if (!freopen (option.get_output_file_name (), "w", stdout))
|
||||
{
|
||||
fprintf (stderr, "Cannot open output file '%s'\n",
|
||||
option.get_output_file_name ());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
{
|
||||
/* Output the hash function code. */
|
||||
Output outputter (searcher._head,
|
||||
|
||||
Reference in New Issue
Block a user