ptyfwd: optionally, change ANSI background color of forwarded terminals
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Dec 2023 11:04:06 +0000 (12:04 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 21 Dec 2023 18:15:01 +0000 (19:15 +0100)
commit23d9fcc3c9f347cd4759e87e8f1aafd8f39f170d
treed8184f6619741bfeb96400e2d29ae0fb38b1284a
parent63e9c38370b8c13d3006920a160adbe1577fc73e
ptyfwd: optionally, change ANSI background color of forwarded terminals

As the bytes flow through our terminal forwarder we can color the
background of the terminal with a color of our choices, if that's
desired.

This will later allow us to color the background of the uid0 tool when
running as root with a slightly alarming red color.

This does two things:

1. When an ANSI sequence is seen that resets the background color, it is
   extended to immediately set the color to our choice.
2. When a newline is seen it is immeidately extended to set the
   background color again and clear the current line till the end.

Net effect: all lines written while we forward the ttys will be shown
with the background color of choice.
src/shared/ptyfwd.c
src/shared/ptyfwd.h