Currently the format of the first line of the help output varies
between executables, for example:
para_afh git (0.4.12.12.g15a4: spectral gravity)
para_audioc git
This difference comes from the fact that para_afh has its own
->print_help method which uses the VERSION_SINGLE_LINE macro of
version.h while para_audioc relies on gengetopt's help output.
The latter uses the make variable PACKAGE_VERSION which gets
initialized at configure time through the second argument in AC_INIT
of configure.ac. This value is either the version number for or the
string "git".
It's a good thing to have the abbreviated git version encoded in
all executables, so this commit changes the argument of gengetopt's
--set-version to the git version string including the codename. With
the patch applied, the output of all commands looks like this if
--version was given:
para_filter 0.4.12.12.g11d7 (spectral gravity)
To make sure things stay consistent, the patch introduces the
VERSION_SINGLE_LINE macro and changes all commands to use it instead
of open coding the version string.
const char **p = d? audiod_args_info_detailed_help
: audiod_args_info_help;
const char **p = d? audiod_args_info_detailed_help
: audiod_args_info_help;
- printf_or_die("%s\n\n", AUDIOD_CMDLINE_PARSER_PACKAGE "-"
- AUDIOD_CMDLINE_PARSER_VERSION);
+ printf_or_die("%s\n\n", VERSION_SINGLE_LINE("audiod"));
printf_or_die("%s\n\n", audiod_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
printf_or_die("%s\n\n", audiod_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
const char **p = d? filter_args_info_detailed_help
: filter_args_info_help;
const char **p = d? filter_args_info_detailed_help
: filter_args_info_help;
- printf_or_die("%s\n\n", FILTER_CMDLINE_PARSER_PACKAGE "-"
- FILTER_CMDLINE_PARSER_VERSION);
+ printf_or_die("%s\n\n", VERSION_SINGLE_LINE("filter"));
printf_or_die("%s\n\n", filter_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
printf_or_die("%s\n\n", filter_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
define ggo_opts
--output-dir=$(cmdline_dir) \
define ggo_opts
--output-dir=$(cmdline_dir) \
- --set-version="$(PACKAGE_VERSION)" \
+ --set-version="$(GIT_VERSION) ($(codename))" \
--arg-struct-name=$(*F)_args_info \
--file-name=$(*F).cmdline \
--func-name=$(*F)_cmdline_parser \
--arg-struct-name=$(*F)_args_info \
--file-name=$(*F).cmdline \
--func-name=$(*F)_cmdline_parser \
.PRECIOUS: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h $(ggo_dir)/%.ggo
.PRECIOUS: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h $(ggo_dir)/%.ggo
-$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo | $(cmdline_dir)
+$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo git-version.h | $(cmdline_dir)
@[ -z "$(Q)" ] || echo 'GGO $<'
$(Q) $(GENGETOPT) $(ggo_opts) < $<
@[ -z "$(Q)" ] || echo 'GGO $<'
$(Q) $(GENGETOPT) $(ggo_opts) < $<
const char **p = d? play_args_info_detailed_help
: play_args_info_help;
const char **p = d? play_args_info_detailed_help
: play_args_info_help;
-// printf_or_die("%s\n\n", PLAY_CMDLINE_PARSER_PACKAGE "-"
-// PLAY_CMDLINE_PARSER_VERSION);
-
+ printf_or_die("%s\n\n", VERSION_SINGLE_LINE("play"));
printf_or_die("%s\n\n", play_args_info_usage);
if (d)
printf_or_die("%s\n", PP_DESC);
printf_or_die("%s\n\n", play_args_info_usage);
if (d)
printf_or_die("%s\n", PP_DESC);
const char **p = d? recv_args_info_detailed_help
: recv_args_info_help;
const char **p = d? recv_args_info_detailed_help
: recv_args_info_help;
- printf_or_die("%s\n\n", RECV_CMDLINE_PARSER_PACKAGE "-"
- RECV_CMDLINE_PARSER_VERSION);
+ printf_or_die("%s\n\n", VERSION_SINGLE_LINE("recv"));
printf_or_die("%s\n\n", recv_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
printf_or_die("%s\n\n", recv_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
+#define VERSION_SINGLE_LINE(prefix) "para_" prefix \
+ " " GIT_VERSION " (" CODENAME ")"
+
/** Version text printed by all executables if -V was given. */
/** Version text printed by all executables if -V was given. */
-#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
- " (" GIT_VERSION ": " CODENAME ")" "\n" \
+#define VERSION_TEXT(prefix) VERSION_SINGLE_LINE(prefix) "\n" \
"Copyright (C) 2013 Andre Noll\n" \
"This is free software with ABSOLUTELY NO WARRANTY." \
" See COPYING for details.\n" \
"Copyright (C) 2013 Andre Noll\n" \
"This is free software with ABSOLUTELY NO WARRANTY." \
" See COPYING for details.\n" \
const char **p = d? write_args_info_detailed_help
: write_args_info_help;
const char **p = d? write_args_info_detailed_help
: write_args_info_help;
- printf_or_die("%s\n\n", WRITE_CMDLINE_PARSER_PACKAGE "-"
- WRITE_CMDLINE_PARSER_VERSION);
+ printf_or_die("%s\n\n", VERSION_SINGLE_LINE("write"));
printf_or_die("%s\n\n", write_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);
printf_or_die("%s\n\n", write_args_info_usage);
for (; *p; p++)
printf_or_die("%s\n", *p);