|
C-Menu 0.2.9
A User Interface Toolkit
|
Enter a single character from keyboard. More...
#include "cm.h"#include <fcntl.h>#include <stdbool.h>#include <string.h>#include <sys/ioctl.h>#include <termios.h>#include <unistd.h>Go to the source code of this file.
Macros | |
| #define | _(String) |
| #define | bindtextdomain(Package, Directory) |
| #define | N_(String) |
| #define | textdomain(Domain) |
Functions | |
| int | main (int argc, char **argv) |
| Capture the current terminal settings for later restoration. | |
| #define _ | ( | String | ) |
Definition at line 24 of file enterchr.c.
| #define bindtextdomain | ( | Package, | |
| Directory ) |
Definition at line 27 of file enterchr.c.
| #define N_ | ( | String | ) |
Definition at line 25 of file enterchr.c.
| #define textdomain | ( | Domain | ) |
Definition at line 26 of file enterchr.c.
| int main | ( | int | argc, |
| char ** | argv ) |
Capture the current terminal settings for later restoration.
can be used in scripts to get a single character response from a user. For example: response=$(./enterchr "Enter Y or N: ") if [ "$response" = "Y" ]; then echo "You entered Yes" else echo "You entered No" fi This function saves the current terminal settings into a global variable so that they can be restored later. It should be called before modifying the terminal settings to ensure that the original settings can be restored when the program exits or is interrupted.
Definition at line 50 of file enterchr.c.
References capture_shell_tioctl(), mk_raw_tioctl(), restore_shell_tioctl(), and shell_tioctl.