From 537cd9b367beece55691fb739f0834e2e96571b6 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sat, 18 Sep 2021 19:44:04 +0100 Subject: 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(). --- client.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'client.c') 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 -- cgit v1.3 From ef7919e64d09d4b29a1557641883e78f5896841d Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sat, 18 Sep 2021 23:40:40 +0100 Subject: main/client: add no-op "-e" command-line option --- CHANGELOG.md | 5 +++++ client.c | 8 ++++++-- doc/foot.1.scd | 10 ++++++++++ doc/footclient.1.scd | 4 ++++ main.c | 8 ++++++-- 5 files changed, 31 insertions(+), 4 deletions(-) (limited to 'client.c') diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b0c2011..d229c4ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,9 @@ (https://codeberg.org/dnkl/foot/issues/701). * Braille characters (U+2800 - U+28FF) are now rendered by foot itself (https://codeberg.org/dnkl/foot/issues/702). +* `-e` command-line option. This option is simply ignored, to appease + program launchers that blindly pass `-e` to any terminal emulator + (https://codeberg.org/dnkl/foot/issues/184). ### Changed @@ -67,6 +70,8 @@ ### Security ### Contributors +* [craigbarnes](https://codeberg.org/craigbarnes) + ## 1.9.0 diff --git a/client.c b/client.c index 7cfcb0ef..5c767e11 100644 --- a/client.c +++ b/client.c @@ -71,7 +71,8 @@ print_usage(const char *prog_name) " -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"; + " -v,--version show the version number and quit\n" + " -e ignored (for compatibility with xterm -e)\n"; printf("Usage: %s [OPTIONS...]\n", prog_name); printf("Usage: %s [OPTIONS...] command [ARGS...]\n", prog_name); @@ -145,7 +146,7 @@ main(int argc, char *const *argv) struct client_string *cargv = NULL; while (true) { - int c = getopt_long(argc, argv, "+t:T:a:w:W:mFLD:s:HNo:d:l::vh", longopts, NULL); + int c = getopt_long(argc, argv, "+t:T:a:w:W:mFLD:s:HNo:d:l::veh", longopts, NULL); if (c == -1) break; @@ -273,6 +274,9 @@ main(int argc, char *const *argv) ret = EXIT_SUCCESS; goto err; + case 'e': + break; + case '?': goto err; } diff --git a/doc/foot.1.scd b/doc/foot.1.scd index bbe784bc..91a7808a 100644 --- a/doc/foot.1.scd +++ b/doc/foot.1.scd @@ -141,6 +141,16 @@ the foot command line *-v*,*--version* Show the version number and quit. +*-e* + Ignored; for compatibility with *xterm -e*. + + This option was added in response to several program launchers + passing *-e* to arbitrary terminals, under the assumption that + they all implement the same semantics for it as *xterm*(1). + Ignoring it allows foot to be invoked as e.g. *foot -e man foot* + with the same results as with xterm, instead of producing an + "invalid option" error. + # EXIT STATUS Foot will exit with code 230 if there is a failure in foot itself. diff --git a/doc/footclient.1.scd b/doc/footclient.1.scd index b252d5e1..9cb4ef69 100644 --- a/doc/footclient.1.scd +++ b/doc/footclient.1.scd @@ -79,6 +79,10 @@ terminal has terminated. *-v*,*--version* Show the version number and quit +*-e* + Ignored; for compatibility with *xterm -e*. See *foot*(1) for more + details. + # EXIT STATUS Footlient will exit with code 220 if there is a failure in footclient diff --git a/main.c b/main.c index 7d4cbbcf..fd27aebd 100644 --- a/main.c +++ b/main.c @@ -78,7 +78,8 @@ 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"; + " -v,--version show the version number and quit\n" + " -e ignored (for compatibility with xterm -e)\n"; printf("Usage: %s [OPTIONS...]\n", prog_name); printf("Usage: %s [OPTIONS...] command [ARGS...]\n", prog_name); @@ -216,7 +217,7 @@ main(int argc, char *const *argv) config_override_t overrides = tll_init(); while (true) { - int c = getopt_long(argc, argv, "+c:Co:t:T:a:LD:f:w:W:s::HmFPp:d:l::Svh", longopts, NULL); + int c = getopt_long(argc, argv, "+c:Co:t:T:a:LD:f:w:W:s::HmFPp:d:l::Sveh", longopts, NULL); if (c == -1) break; @@ -375,6 +376,9 @@ main(int argc, char *const *argv) print_usage(prog_name); return EXIT_SUCCESS; + case 'e': + break; + case '?': return ret; } -- cgit v1.3