1 /* Driver program for the Gen_Perf hash function generator
2 Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
3 written by Douglas C. Schmidt (schmidt@ics.uci.edu)
5 This file is part of GNU GPERF.
7 GNU GPERF is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
12 GNU GPERF is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU GPERF; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
21 /* Simple driver program for the Gen_Perf.hash function generator.
22 Most of the hard work is done in class Gen_Perf and its class methods. */
25 #include <sys/types.h>
26 #if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
27 #ifdef HAVE_SYS_TIME_H
30 #ifdef HAVE_SYS_RESOURCE_H
31 #include <sys/resource.h>
44 main (int argc, char *argv[])
48 #if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK)
49 /* Get rid of any avoidable limit on stack size. */
52 if (getrlimit (RLIMIT_STACK, &rlim) == 0)
53 if (rlim.rlim_cur < rlim.rlim_max)
55 rlim.rlim_cur = rlim.rlim_max;
56 setrlimit (RLIMIT_STACK, &rlim);
59 #endif /* RLIMIT_STACK */
61 /* Sets the Options. */
64 /* Initializes the key word list. */
65 Gen_Perf generate_table;
67 /* Generates and prints the Gen_Perf hash table. */
68 int status = generate_table ();
70 /* Check for write error on stdout. */
71 if (fflush (stdout) || ferror (stdout))
74 /* Don't use exit() here, it skips the destructors. */