memset(&newtio, 0, sizeof(newtio));
// Set input mode (non-canonical, *no echo*,...)
tcsetattr(STDIN_FILENO, TCSANOW, &newtio);
- // Put the selected string in the tty input buffer
char control_q = '\021';
+ // Put the selected string in the tty input buffer
for(char *k = string; *k; k++) {
if(add_control_qs) {
+ // Add ^Q to quote control characters
ioctl(STDIN_FILENO, TIOCSTI, &control_q);
}
ioctl(STDIN_FILENO, TIOCSTI, k);