foot/client-protocol.h
Daniel Eklöf d02124902b
client: add -E,--client-environment
When this option is used, the child process in the new terminal
instance will inherit its environment from the footclient process,
instead of the foot server’s.

Implemented by sending (yet another) dynamic string list as part of
the client -> server setup packet. When the new option is *not* used,
the setup packet is now 2 bytes larger than before.

On the server side, the slave process now uses execvpe() instead of
execvp(). There’s plumbing to propagate a new ‘envp’ argument from
term_init() all the way down to slave_exec(). If ‘envp’ is NULL, we
use ‘environ’ instead (thus matching the old behavior of execvp()).

Closes #1004
2022-04-12 15:07:40 +02:00

31 lines
731 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
struct client_string {
uint16_t len;
/* char str[static len]; */
};
struct client_data {
bool hold:1;
bool no_wait:1;
bool xdga_token:1;
uint8_t reserved:5;
uint8_t token_len;
uint16_t cwd_len;
uint16_t override_count;
uint16_t argc;
uint16_t env_count;
/* char cwd[static cwd_len]; */
/* char token[static token_len]; */
/* struct client_string overrides[static override_count]; */
/* struct client_string argv[static argc]; */
/* struct client_string envp[static env_count]; */
} __attribute__((packed));
_Static_assert(sizeof(struct client_data) == 10, "protocol struct size error");