Antonio Ragagnin
Antonio Ragagnin

Reputation: 2327

creating a new screen (like vi and less does) in a textual program

Programs like vi, less, screen, when executed, they fill the terminal with their data, and then, if you press c - Z (or terminate the program) the terminal return as it was before the execution of these programs.

How usually a program do that? What is the correct terminology this kind of thing?

PS: The words used in the title may be not correct since I've no even idea about the terminology of this kind of things.

EDIT: Thank to @Atropo I now know the correct name of these is foreground process, but, how a program do that? How the program can clear the screen, do its writing and, at the end of the execution, let the shell reappear with all the old writings?

Upvotes: 0

Views: 94

Answers (2)

nopsoft
nopsoft

Reputation: 942

By default CTRL-C generates SIGINT signal and CTRL-Z SIGTSTP: https://en.wikipedia.org/wiki/Unix_signal

To change the behavior you can:

Upvotes: 0

Atropo
Atropo

Reputation: 12541

They're called foreground processes.

Usually a foreground processes show the user an interface, through which the user can interact with the program. So the user must wait for one foreground process to complete before running another one. While you use a foreground process the shell prompt disappears until you close the process or you put it in the background.

Upvotes: 1

Related Questions