bin: factor version display.

* src/bin/common_setup.cc (display_version): New function.
(setup): Hook the display_version function.
(argp_program_bug_address): Define this common variable here.
* src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc,
src/bin/ltlfilt.cc, src/bin/randltl.cc (argp_program_bug_address,
argp_program_version): Remove these definitions.
This commit is contained in:
Alexandre Duret-Lutz 2012-09-29 17:34:53 +02:00
parent 489f719dc1
commit 7854f629e5
6 changed files with 17 additions and 55 deletions

View file

@ -20,6 +20,21 @@
// 02111-1307, USA.
#include "common_setup.hh"
#include "argp.h"
const char* argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
static void
display_version(FILE *stream, struct argp_state*)
{
fputs(program_name, stream);
fputs(" (" PACKAGE_STRING ")\n\
\n\
Copyright (C) 2012 Laboratoire de Recherche et Développement de l'Epita.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,\n\
to the extent permitted by law.\n", stream);
}
void
setup(char** argv)
@ -28,4 +43,6 @@ setup(char** argv)
// errors and display help text.
set_program_name(argv[0]);
argv[0] = const_cast<char*>(program_name);
argp_program_version_hook = display_version;
}