Reputation: 11
How do we call the (shift + pageup) and (shift + pagedown) functions, for linux terminal, from within a C program using any other keys (e.g, up down arrows). What system calls do I need to make.
Upvotes: 0
Views: 818
Reputation: 54505
Those features are manipulated by sending escape sequences, i.e., sequences of characters (usually beginning with the "escape" character) to the terminal.
The detailed sequences for the Linux console are documented in the console_codes manual page. However, every terminal emulator (for instance, any terminal program which you run in a desktop environment) differs from that. Some are documented (xterm and rxvt), others are not (gnome-terminal, konsole).
Most refer to themselves as VT100-like, for the DEC VT100 terminal. Here are sources of information at opposite ends of the scale
To provide a better programmatic interface to these features, there are libraries (ncurses and slang), using a terminal database (listing what is provided by a given terminal, and how to do it).
From the command-line, shell scripts can use the tput program to send escape sequences. (It is common for shell scripts to just hardcode these as well, at the expense of lack of portability and readability).
Upvotes: 1