diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-02-20 17:37:16 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-02-20 17:37:16 +0000 |
| commit | bb3c20e284be6820d06e49d63887689f63f042c3 (patch) | |
| tree | 6cbd67601bd94cdf3efb404e009f39c1e8e50064 /client.c | |
| parent | README: list 'lightweigh' under features (diff) | |
| parent | doc: add --login-shell (diff) | |
Merge branch 'login-shell'
Diffstat (limited to 'client.c')
| -rw-r--r-- | client.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -33,6 +33,7 @@ print_usage(const char *prog_name) printf("\n"); printf("Options:\n"); printf(" -t,--term=TERM value to set the environment variable TERM to (foot)\n" + " --login-shell start shell as a login shell\n" " -s,--server-socket=PATH path to the server UNIX domain socket (default=XDG_RUNTIME_DIR/foot.sock)\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"); @@ -47,6 +48,7 @@ main(int argc, char *const *argv) static const struct option longopts[] = { {"term", required_argument, 0, 't'}, + {"login-shell", no_argument, 0, 'L'}, {"server-socket", required_argument, 0, 's'}, {"log-colorize", optional_argument, NULL, 'l'}, {"version", no_argument, 0, 'v'}, @@ -57,6 +59,7 @@ main(int argc, char *const *argv) const char *term = ""; const char *server_socket_path = NULL; enum log_colorize log_colorize = LOG_COLORIZE_AUTO; + bool login_shell = false; while (true) { int c = getopt_long(argc, argv, ":t:s:l::hv", longopts, NULL); @@ -68,6 +71,10 @@ main(int argc, char *const *argv) term = optarg; break; + case 'L': + login_shell = true; + break; + case 's': server_socket_path = optarg; break; @@ -154,6 +161,7 @@ main(int argc, char *const *argv) /* Calculate total length */ total_len += sizeof(cwd_len) + cwd_len; total_len += sizeof(term_len) + term_len; + total_len += sizeof(uint8_t); /* login_shell */ total_len += sizeof(argc); for (int i = 0; i < argc; i++) { @@ -183,6 +191,11 @@ main(int argc, char *const *argv) goto err; } + if (send(fd, &(uint8_t){login_shell}, sizeof(uint8_t), 0) != sizeof(uint8_t)) { + LOG_ERRNO("failed to send login-shell"); + goto err; + } + LOG_DBG("argc = %d", argc); if (send(fd, &argc, sizeof(argc), 0) != sizeof(argc)) { LOG_ERRNO("failed to send argc/argv to server"); |
