X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=selector.cc;h=f1b4ad81e93c52f34a550cf924d1ef4ecd4f9e59;hb=1010fbd95939c306a10db5519ca3670fc74d85e5;hp=42a54d64ac24455b7a20bde5a5a654d43a2fa928;hpb=c4f59cde9021b072b04c072ca6148e0593841587;p=selector.git diff --git a/selector.cc b/selector.cc index 42a54d6..f1b4ad8 100644 --- a/selector.cc +++ b/selector.cc @@ -21,9 +21,8 @@ * */ -// Here is how to use it as a super-history-search in bash -// -// ./selector -v -f ${HISTFILE} +// Here is how to use it as a super-history-search +// ./selector -v -f ${HISTFILE} #include #include @@ -440,13 +439,10 @@ int main(int argc, char **argv) { // Save current port settings tcgetattr(fd,&oldtio); bzero(&newtio, sizeof(newtio)); - newtio.c_cflag = 0; - newtio.c_iflag = 0; - newtio.c_oflag = 0; // Set input mode (non-canonical, *no echo*,...) - newtio.c_lflag = 0; tcflush(fd, TCIFLUSH); tcsetattr(fd,TCSANOW, &newtio); + // Put the selected line in the tty input buffer for(char *k = lines[temporary_line]; *k; k++) { ioctl(fd, TIOCSTI, k); } @@ -454,12 +450,11 @@ int main(int argc, char **argv) { tcsetattr(fd,TCSANOW, &oldtio); close(fd); } else { - cerr << "Can not open " << tty << endl; + cerr << "Can not open " << tty << "." << endl; exit(1); } } } else { - ofstream out(output_filename); if(out.fail()) { cerr << "Can not open " << output_filename << " for writing." << endl;