aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2021-09-18 18:44:04 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2021-09-18 18:44:04 +0000
commit537cd9b367beece55691fb739f0834e2e96571b6 (patch)
tree222a7c6964b5e749c32ebbbf954550431033a761
parentlog: simplify Boolean logic for setting "colorize" var in log_init() (diff)
main/client: replace some uses of printf() with puts() in print_usage()
FOOT_DEFAULT_TERM is a string literal passed as a -D argument to the compiler, so it can just be concatenated with the other string literals, instead of being formatted with printf().
-rw-r--r--client.c39
-rw-r--r--main.c16
2 files changed, 28 insertions, 27 deletions
diff --git a/client.c b/client.c
index e5b9a777..7cfcb0ef 100644
--- a/client.c
+++ b/client.c
@@ -54,27 +54,28 @@ version_and_features(void)
static void
print_usage(const char *prog_name)
{
+ static const char options[] =
+ "\nOptions:\n"
+ " -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n"
+ " -T,--title=TITLE initial window title (foot)\n"
+ " -a,--app-id=ID window application ID (foot)\n"
+ " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
+ " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
+ " -m,--maximized start in maximized mode\n"
+ " -F,--fullscreen start in fullscreen mode\n"
+ " -L,--login-shell start shell as a login shell\n"
+ " -D,--working-directory=DIR directory to start in (CWD)\n"
+ " -s,--server-socket=PATH path to the server UNIX domain socket (default=$XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)\n"
+ " -H,--hold remain open after child process exits\n"
+ " -N,--no-wait detach the client process from the running terminal, exiting immediately\n"
+ " -o,--override=[section.]key=value override configuration option\n"
+ " -d,--log-level={info|warning|error|none} log level (info)\n"
+ " -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
+ " -v,--version show the version number and quit\n";
+
printf("Usage: %s [OPTIONS...]\n", prog_name);
printf("Usage: %s [OPTIONS...] command [ARGS...]\n", prog_name);
- printf("\n");
- printf("Options:\n");
- printf(" -t,--term=TERM value to set the environment variable TERM to (%s)\n"
- " -T,--title=TITLE initial window title (foot)\n"
- " -a,--app-id=ID window application ID (foot)\n"
- " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
- " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
- " -m,--maximized start in maximized mode\n"
- " -F,--fullscreen start in fullscreen mode\n"
- " -L,--login-shell start shell as a login shell\n"
- " -D,--working-directory=DIR directory to start in (CWD)\n"
- " -s,--server-socket=PATH path to the server UNIX domain socket (default=$XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock)\n"
- " -H,--hold remain open after child process exits\n"
- " -N,--no-wait detach the client process from the running terminal, exiting immediately\n"
- " -o,--override=[section.]key=value override configuration option\n"
- " -d,--log-level={info|warning|error|none} log level (info)\n"
- " -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
- " -v,--version show the version number and quit\n",
- FOOT_DEFAULT_TERM);
+ puts(options);
}
static bool NOINLINE
diff --git a/main.c b/main.c
index 4f7b027d..7d4cbbcf 100644
--- a/main.c
+++ b/main.c
@@ -56,16 +56,13 @@ version_and_features(void)
static void
print_usage(const char *prog_name)
{
- printf(
- "Usage: %s [OPTIONS...]\n"
- "Usage: %s [OPTIONS...] command [ARGS...]\n"
- "\n"
- "Options:\n"
+ static const char options[] =
+ "\nOptions:\n"
" -c,--config=PATH load configuration from PATH ($XDG_CONFIG_HOME/foot/foot.ini)\n"
" -C,--check-config verify configuration, exit with 0 if ok, otherwise exit with 1\n"
" -o,--override=[section.]key=value override configuration option\n"
" -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n"
- " -t,--term=TERM value to set the environment variable TERM to (%s)\n"
+ " -t,--term=TERM value to set the environment variable TERM to (" FOOT_DEFAULT_TERM ")\n"
" -T,--title=TITLE initial window title (foot)\n"
" -a,--app-id=ID window application ID (foot)\n"
" -m,--maximized start in maximized mode\n"
@@ -81,8 +78,11 @@ print_usage(const char *prog_name)
" -d,--log-level={info|warning|error|none} log level (info)\n"
" -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
" -s,--log-no-syslog disable syslog logging (only applicable in server mode)\n"
- " -v,--version show the version number and quit\n",
- prog_name, prog_name, FOOT_DEFAULT_TERM);
+ " -v,--version show the version number and quit\n";
+
+ printf("Usage: %s [OPTIONS...]\n", prog_name);
+ printf("Usage: %s [OPTIONS...] command [ARGS...]\n", prog_name);
+ puts(options);
}
bool