Reputation: 3934
I want to create a smart debugging utiliy that reads the stderr that was already printed to the tty (say, 1000 lines back).
Is there any type of UNIX API call that allows me to do so? I couldn't find one.
Upvotes: 1
Views: 857
Reputation: 54525
No, there is no "UNIX API" call which would do this. A few special cases may be useful:
A few terminal implementations can be told to provide a screen dump. As a rule, those are limited to the currently-visible screen:
setterm
in Dumping a Linux console scrollback buffer?, and other solutions in How to get the console o/p on Linux terminal that is lost due to scroll over, although it was not mentioned that setterm
requires privilege to read the screen). For those, there are ways to read the scrollback, but only by preparing in advance. As the question is phrased, the answer is no.As a rule, there also are no escape sequences to do this since that approach (allowing "any" program to see the screen contents) is often regarded as a security violation.
Upvotes: 1