projects
/
selector.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9073caf
)
*** empty log message ***
author
Francois Fleuret
<francois@fleuret.org>
Thu, 12 Mar 2009 13:58:48 +0000
(14:58 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Thu, 12 Mar 2009 13:58:48 +0000
(14:58 +0100)
selector.cc
patch
|
blob
|
history
diff --git
a/selector.cc
b/selector.cc
index
d719c1a
..
0865015
100644
(file)
--- a/
selector.cc
+++ b/
selector.cc
@@
-1,9
+1,10
@@
+
/*
* selector is a simple shell command for selection of strings with a
* dynamic pattern-matching.
*
* Copyright (c) 2009 Francois Fleuret
/*
* selector is a simple shell command for selection of strings with a
* dynamic pattern-matching.
*
* Copyright (c) 2009 Francois Fleuret
- * Written by Francois Fleuret <francois
.fleuret@idiap.ch
>
+ * Written by Francois Fleuret <francois
@fleuret.org
>
*
* This file is part of selector.
*
*
* This file is part of selector.
*
@@
-24,6
+25,9
@@
// Here is how to use it as a super-history-search
// ./selector -v -f ${HISTFILE}
// Here is how to use it as a super-history-search
// ./selector -v -f ${HISTFILE}
+// This software is highly Linux-specific, but I would be glad to get
+// patches to make it work on other OS
+
#include <fstream>
#include <iostream>
#include <fstream>
#include <iostream>
@@
-441,8
+445,8
@@
int main(int argc, char **argv) {
curs_set(1);
endwin();
curs_set(1);
endwin();
- if(
output_to_vt_buffer
) {
- if(
(key == KEY_ENTER || key == '\n') && temporary_line >= 0 && temporary_line < nb_lines
) {
+ if(
(key == KEY_ENTER || key == '\n') && temporary_line >= 0 && temporary_line < nb_lines
) {
+ if(
output_to_vt_buffer
) {
char *tty = ttyname (STDIN_FILENO);
int fd = open(tty, O_WRONLY);
char *tty = ttyname (STDIN_FILENO);
int fd = open(tty, O_WRONLY);
@@
-466,17
+470,13
@@
int main(int argc, char **argv) {
cerr << "Can not open " << tty << "." << endl;
exit(1);
}
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;
- exit(1);
} else {
} else {
- if((key == KEY_ENTER || key == '\n') && temporary_line >= 0 && temporary_line < nb_lines) {
- out << lines[temporary_line] << endl;
+ ofstream out(output_filename);
+ if(out.fail()) {
+ cerr << "Can not open " << output_filename << " for writing." << endl;
+ exit(1);
} else {
} else {
- out << endl;
+ out <<
lines[temporary_line] <<
endl;
}
out.flush();
}
}
out.flush();
}