summaryrefslogtreecommitdiffabout
path: root/src/main.c
Side-by-side diff
Diffstat (limited to 'src/main.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 78f615d..96d6aad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,46 +1,47 @@
/* This file is part of GNU cflow
Copyright (C) 1997,2005 Sergey Poznyakoff
GNU cflow is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GNU cflow is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with GNU cflow; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA */
#include <cflow.h>
#include <argp.h>
#include <stdarg.h>
#include <parser.h>
+#include <version-etc.h>
const char *argp_program_version = "cflow (" PACKAGE_NAME ") " VERSION;
const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
static char doc[] = N_("generate a program flowgraph")
"\v"
N_("* The effect of each option marked with an asterisk is reversed if the option's long name is prefixed with `no-'. For example, --no-cpp cancels --cpp.");
enum option_code {
OPT_DEFINES = 256,
OPT_LEVEL_INDENT,
OPT_DEBUG,
OPT_PREPROCESS,
OPT_NO_PREPROCESS,
OPT_EMACS,
OPT_NO_USE_INDENTATION,
OPT_NO_ANSI,
OPT_NO_TREE,
OPT_NO_BRIEF,
OPT_NO_EMACS,
OPT_NO_VERBOSE,
OPT_NO_NUMBER,
OPT_NO_PRINT_LEVEL,
OPT_NO_REVERSE,
OPT_OMIT_ARGUMENTS,
@@ -726,54 +727,68 @@ include_symbol(Symbol *sym)
}
void
xalloc_die(void)
{
error(1, ENOMEM, _("Exiting"));
}
void
init()
{
if (level_indent[0] == NULL)
level_indent[0] = " "; /* 4 spaces */
if (level_indent[1] == NULL)
level_indent[1] = level_indent[0];
if (level_end[0] == NULL)
level_end[0] = "";
if (level_end[1] == NULL)
level_end[1] = "";
init_lex(debug > 1);
init_parse();
}
+const char version_etc_copyright[] =
+ /* Do *not* mark this string for translation. %s is a copyright
+ symbol suitable for this locale, and %d is the copyright
+ year. */
+ "Copyright %s 2005, 2006, %d Sergey Poznyakoff";
+
+static void
+cflow_version(FILE *stream, struct argp_state *state)
+{
+ version_etc(stream, "cflow", PACKAGE_NAME, PACKAGE_VERSION,
+ "Sergey Poznyakoff", NULL);
+}
+
int
main(int argc, char **argv)
{
int index;
program_name = argv[0]; /* Until gnulib provides a better way */
+ argp_program_version_hook = cflow_version;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
register_output("gnu", gnu_output_handler, NULL);
register_output("posix", posix_output_handler, NULL);
symbol_map = SM_FUNCTIONS|SM_STATIC|SM_UNDEFINED;
if (getenv("POSIXLY_CORRECT")) {
if (select_output_driver("posix"))
error(1, 0, _("%s: No such output driver"), "posix");
output_init();
}
sourcerc(&argc, &argv);
if (argp_parse(&argp, argc, argv, ARGP_IN_ORDER, &index, NULL))
exit(1);
if (print_option == 0)
print_option = PRINT_TREE;
init();

Return to:

Send suggestions and report system problems to the System administrator.