It looks like the program requires a terminal. Instead of using screen
, you can always write your own terminal emulator, and control the program that way -- the emulator is
the screen and the keyboard, as far as the program is concerned.
I think the libvterm
library should help you in developing the terminal emulator; you should be able to provide all the functionality screen
provides, but under complete control of your own program. If you don't need that much control, you could very likely just use forkpty()
and emulate a simple, fixed terminal instead, by just reading from and writing to the master side of the terminal. That should take a few hundred lines of code, because there are quite a few ANSI escape sequences to handle, but it should be quite straightforward code.
You can also take a look at the screen
sources for how it is done.