main/client: simplify code for printing --version string

This commit is contained in:
Craig Barnes 2025-03-14 20:15:11 +00:00
parent d48a1c53f5
commit eb9357709b
5 changed files with 42 additions and 68 deletions

View file

@ -22,7 +22,6 @@
#include "foot-features.h"
#include "macros.h"
#include "util.h"
#include "version.h"
#include "xmalloc.h"
extern char **environ;
@ -62,20 +61,6 @@ sendall(int sock, const void *_buf, size_t len)
return len;
}
static const char *
version_and_features(void)
{
static char buf[256];
snprintf(buf, sizeof(buf),
"version: %s %cpgo %cime %cgraphemes %cassertions",
FOOT_VERSION,
feature_pgo() ? '+' : '-',
feature_ime() ? '+' : '-',
feature_graphemes() ? '+' : '-',
feature_assertions() ? '+' : '-');
return buf;
}
static void
print_usage(const char *prog_name)
{
@ -328,7 +313,7 @@ main(int argc, char *const *argv)
break;
case 'v':
printf("footclient %s\n", version_and_features());
print_version_and_features("footclient ");
ret = EXIT_SUCCESS;
goto err;