foot/doc
Daniel Eklöf 9da7152f83
slave: don't skip setting environment variables when using a custom environment
When launching footclient with -E,--client-environment the environment
variables that should be set by foot, wasn't.

Those variables are:

* TERM
* COLORTERM
* PWD
* SHELL

and all variables defined by the user in the [environment] section in
foot.ini.

In the same way, we did not *unset* TERM_PROGRAM and
TERM_PROGRAM_VERSION.

This patch fixes it by "cloning" the custom environment, making it
mutable, and then adding/removing the variables above from it.

Instead of calling setenv()/unsetenv() directly, we add the wrapper
functions add_to_env() and del_from_env().

When *not* using a custom environment, they simply call
setenv()/unsetenv().

When we *are* using a custom environment, add_to_env() first loops all
existing variables, looking for a match. If a match is found, it's
updated with the new value. If it's not found, a new entry is added.

del_from_env() loops all entries, and removes it when a match is
found. If no match is found, nothing is done.

The mutable environment is allocated on the heap, but never free:d. We
don't need to free it, since it's only allocated after forking, in the
child process.

Closes #1568
2024-01-11 16:37:17 +01:00
..
benchmark.md doc: benchmarks: update with desktop results for 1.12.1 (r9) 2022-05-12 13:10:24 +02:00
foot-ctlseqs.7.scd csi: implement DECSET/DECRST/DECRQM 2027 - grapheme cluster processing 2023-09-25 16:50:44 +02:00
foot.1.scd slave: don't skip setting environment variables when using a custom environment 2024-01-11 16:37:17 +01:00
foot.ini.5.scd man foo.ini.5: Add 'Comma separated list of fonts' example 2023-10-27 16:18:41 +02:00
footclient.1.scd slave: don't skip setting environment variables when using a custom environment 2024-01-11 16:37:17 +01:00
meson.build meson: use meson feed feature for scdoc input 2023-06-14 17:15:20 +00:00
sixel-wow.png README: add screenshot of sixel graphics 2020-02-22 22:04:28 +01:00