[common,cmdline] add new functions

* Add freerdp_client_print_version_ex and
  freerdp_client_print_buildconfig_ex to print version and build
  configuration along with the binary name calling it
* Use these new functions instead of the ones that only print out
  version and/or buildconfig
This commit is contained in:
akallabeth 2024-11-04 08:48:06 +01:00
parent ecc84158b7
commit fb3a127d00
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
3 changed files with 46 additions and 3 deletions

View File

@ -316,7 +316,8 @@ int freerdp_client_settings_parse_command_line_ex(
status = -1; status = -1;
const char* name = (argc > 0) ? argv[0] : "argc < 1"; const char* name = (argc > 0) ? argv[0] : "argc < 1";
WLog_DBG(TAG, "This is [%s] %s %s", name, freerdp_get_version_string(), freerdp_get_build_config()); WLog_DBG(TAG, "This is [%s] %s %s", name, freerdp_get_version_string(),
freerdp_get_build_config());
return status; return status;
} }

View File

@ -288,12 +288,31 @@ BOOL freerdp_client_print_version(void)
return TRUE; return TRUE;
} }
BOOL freerdp_client_print_version_ex(int argc, char** argv)
{
WINPR_ASSERT(argc >= 0);
WINPR_ASSERT(argv || (argc == 0));
const char* name = (argc > 0) ? argv[0] : "argc < 1";
printf("This is FreeRDP version [%s] %s (%s)\n", name, FREERDP_VERSION_FULL,
FREERDP_GIT_REVISION);
return TRUE;
}
BOOL freerdp_client_print_buildconfig(void) BOOL freerdp_client_print_buildconfig(void)
{ {
printf("%s", freerdp_get_build_config()); printf("%s", freerdp_get_build_config());
return TRUE; return TRUE;
} }
BOOL freerdp_client_print_buildconfig_ex(int argc, char** argv)
{
WINPR_ASSERT(argc >= 0);
WINPR_ASSERT(argv || (argc == 0));
const char* name = (argc > 0) ? argv[0] : "argc < 1";
printf("[%s] %s", name, freerdp_get_build_config());
return TRUE;
}
static void freerdp_client_print_scancodes(void) static void freerdp_client_print_scancodes(void)
{ {
printf("RDP scancodes and their name for use with /kbd:remap\n"); printf("RDP scancodes and their name for use with /kbd:remap\n");
@ -1776,8 +1795,8 @@ int freerdp_client_settings_command_line_status_print_ex(rdpSettings* settings,
if (status == COMMAND_LINE_STATUS_PRINT_BUILDCONFIG) if (status == COMMAND_LINE_STATUS_PRINT_BUILDCONFIG)
{ {
freerdp_client_print_version(); freerdp_client_print_version_ex(argc, argv);
freerdp_client_print_buildconfig(); freerdp_client_print_buildconfig_ex(argc, argv);
goto out; goto out;
} }
else if (status == COMMAND_LINE_STATUS_PRINT) else if (status == COMMAND_LINE_STATUS_PRINT)

View File

@ -94,7 +94,30 @@ extern "C"
FREERDP_API void freerdp_client_warn_deprecated(int argc, char* argv[]); FREERDP_API void freerdp_client_warn_deprecated(int argc, char* argv[]);
FREERDP_API BOOL freerdp_client_print_version(void); FREERDP_API BOOL freerdp_client_print_version(void);
/** @brief prints the version of the client including the binary name extracted from \b argv
*
* @param argc the number of command line arguments, must be >= 0
* @param argv the array of command line argument strings
*
* @return \b TRUE for success
*
* @since version 3.10.0
*/
FREERDP_API BOOL freerdp_client_print_version_ex(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_buildconfig(void); FREERDP_API BOOL freerdp_client_print_buildconfig(void);
/** @brief prints the buidconfiguration of the client including the binary name extracted from
* \b argv
*
* @param argc the number of command line arguments, must be >= 0
* @param argv the array of command line argument strings
*
* @return \b TRUE for success
*
* @since version 3.10.0
*/
FREERDP_API BOOL freerdp_client_print_buildconfig_ex(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_command_line_help(int argc, char** argv); FREERDP_API BOOL freerdp_client_print_command_line_help(int argc, char** argv);
FREERDP_API BOOL freerdp_client_print_command_line_help_ex( FREERDP_API BOOL freerdp_client_print_command_line_help_ex(
int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom); int argc, char** argv, const COMMAND_LINE_ARGUMENT_A* custom);