- help = make_message("%s\n\n", grab_client_args_info_usage);
- for (i = 0; grab_client_args_info_help[i]; i++) {
- char *tmp = make_message("%s%s\n", help,
- grab_client_args_info_help[i]);
- free(help);
- help = tmp;
- }
- err = client_write(fd, help);
- free(help);
+ if (err == -E_GC_HELP_GIVEN) {
+ msg = make_message("%s\n\n", grab_client_args_info_usage);
+ for (i = 0; grab_client_args_info_help[i]; i++) {
+ char *tmp = make_message("%s%s\n", msg,
+ grab_client_args_info_help[i]);
+ free(msg);
+ msg = tmp;
+ }
+ } else
+ msg = make_message("%s %s\n",
+ GRAB_CLIENT_CMDLINE_PARSER_PACKAGE,
+ GRAB_CLIENT_CMDLINE_PARSER_VERSION);
+ err = client_write(fd, msg);
+ free(msg);