mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
slave: set TERM environment variable in slave process
This commit is contained in:
parent
d2b395bd43
commit
69d62d3cd2
4 changed files with 6 additions and 4 deletions
1
main.c
1
main.c
|
|
@ -161,7 +161,6 @@ main(int argc, char *const *argv)
|
|||
argv += optind;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
setenv("TERM", conf.term, 1);
|
||||
|
||||
struct fdm *fdm = NULL;
|
||||
struct wayland *wayl = NULL;
|
||||
|
|
|
|||
5
slave.c
5
slave.c
|
|
@ -1,5 +1,6 @@
|
|||
#define _XOPEN_SOURCE 500
|
||||
#include "slave.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -68,7 +69,7 @@ err:
|
|||
|
||||
pid_t
|
||||
slave_spawn(int ptmx, int argc, char *const *argv,
|
||||
const char *conf_shell)
|
||||
const char *term_env, const char *conf_shell)
|
||||
{
|
||||
int fork_pipe[2];
|
||||
if (pipe2(fork_pipe, O_CLOEXEC) < 0) {
|
||||
|
|
@ -88,6 +89,8 @@ slave_spawn(int ptmx, int argc, char *const *argv,
|
|||
/* Child */
|
||||
close(fork_pipe[0]); /* Close read end */
|
||||
|
||||
setenv("TERM", term_env, 1);
|
||||
|
||||
char **_shell_argv = NULL;
|
||||
char *const *shell_argv = argv;
|
||||
|
||||
|
|
|
|||
2
slave.h
2
slave.h
|
|
@ -4,4 +4,4 @@
|
|||
#include <sys/types.h>
|
||||
|
||||
pid_t slave_spawn(
|
||||
int ptmx, int argc, char *const *argv, const char *conf_shell);
|
||||
int ptmx, int argc, char *const *argv, const char *term_env, const char *conf_shell);
|
||||
|
|
|
|||
|
|
@ -428,7 +428,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct wayland *wayl,
|
|||
LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height);
|
||||
|
||||
/* Start the slave/client */
|
||||
if ((term->slave = slave_spawn(term->ptmx, argc, argv, conf->shell)) == -1)
|
||||
if ((term->slave = slave_spawn(term->ptmx, argc, argv, conf->term, conf->shell)) == -1)
|
||||
goto err;
|
||||
|
||||
/* Initiailze the Wayland window backend */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue