mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04:00
features: include compile-time enable/disable state of features when printing version
This commit is contained in:
parent
2078e1675d
commit
77bc7c8b2c
4 changed files with 37 additions and 3 deletions
12
client.c
12
client.c
|
|
@ -16,6 +16,7 @@
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "client-protocol.h"
|
#include "client-protocol.h"
|
||||||
|
#include "foot-features.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
|
@ -27,6 +28,15 @@ sig_handler(int signo)
|
||||||
aborted = 1;
|
aborted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
version_and_features(void)
|
||||||
|
{
|
||||||
|
static char buf[256];
|
||||||
|
snprintf(buf, sizeof(buf), "version: %s %cime",
|
||||||
|
FOOT_VERSION, feature_ime() ? '+' : '-');
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_usage(const char *prog_name)
|
print_usage(const char *prog_name)
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +165,7 @@ main(int argc, char *const *argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("footclient version %s\n", FOOT_VERSION);
|
printf("footclient %s\n", version_and_features());
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
|
||||||
12
foot-features.h
Normal file
12
foot-features.h
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
static inline bool feature_ime(void)
|
||||||
|
{
|
||||||
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
14
main.c
14
main.c
|
|
@ -21,6 +21,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "foot-features.h"
|
||||||
#include "fdm.h"
|
#include "fdm.h"
|
||||||
#include "reaper.h"
|
#include "reaper.h"
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
|
|
@ -39,6 +40,15 @@ sig_handler(int signo)
|
||||||
aborted = 1;
|
aborted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
version_and_features(void)
|
||||||
|
{
|
||||||
|
static char buf[256];
|
||||||
|
snprintf(buf, sizeof(buf), "version: %s %cime",
|
||||||
|
FOOT_VERSION, feature_ime() ? '+' : '-');
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_usage(const char *prog_name)
|
print_usage(const char *prog_name)
|
||||||
{
|
{
|
||||||
|
|
@ -325,7 +335,7 @@ main(int argc, char *const *argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("foot version %s\n", FOOT_VERSION);
|
printf("foot %s\n", version_and_features());
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
@ -343,7 +353,7 @@ main(int argc, char *const *argv)
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
LOG_INFO("version: %s", FOOT_VERSION);
|
LOG_INFO("%s", version_and_features());
|
||||||
|
|
||||||
{
|
{
|
||||||
struct utsname name;
|
struct utsname name;
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ executable(
|
||||||
'commands.c', 'commands.h',
|
'commands.c', 'commands.h',
|
||||||
'extract.c', 'extract.h',
|
'extract.c', 'extract.h',
|
||||||
'fdm.c', 'fdm.h',
|
'fdm.c', 'fdm.h',
|
||||||
|
'foot-features.h',
|
||||||
'ime.c', 'ime.h',
|
'ime.c', 'ime.h',
|
||||||
'input.c', 'input.h',
|
'input.c', 'input.h',
|
||||||
'main.c',
|
'main.c',
|
||||||
|
|
@ -174,6 +175,7 @@ executable(
|
||||||
executable(
|
executable(
|
||||||
'footclient',
|
'footclient',
|
||||||
'client.c', 'client-protocol.h',
|
'client.c', 'client-protocol.h',
|
||||||
|
'foot-features.h',
|
||||||
'log.c', 'log.h',
|
'log.c', 'log.h',
|
||||||
'macros.h',
|
'macros.h',
|
||||||
'xmalloc.c', 'xmalloc.h',
|
'xmalloc.c', 'xmalloc.h',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue