aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/st.c b/st.c
index bd230a3..fde0493 100644
--- a/st.c
+++ b/st.c
@@ -36,7 +36,7 @@
36 36
37#define USAGE \ 37#define USAGE \
38 "st " VERSION " (c) 2010-2012 st engineers\n" \ 38 "st " VERSION " (c) 2010-2012 st engineers\n" \
39 "usage: st [-t title] [-c class] [-w windowid] [-v] [-e command...]\n" 39 "usage: st [-t title] [-c class] [-w windowid] [-v] [-f file] [-e command...]\n"
40 40
41/* XEMBED messages */ 41/* XEMBED messages */
42#define XEMBED_FOCUS_IN 4 42#define XEMBED_FOCUS_IN 4
@@ -342,7 +342,9 @@ static STREscape strescseq;
342static int cmdfd; 342static int cmdfd;
343static pid_t pid; 343static pid_t pid;
344static Selection sel; 344static Selection sel;
345static FILE *fileio;
345static char **opt_cmd = NULL; 346static char **opt_cmd = NULL;
347static char *opt_io = NULL;
346static char *opt_title = NULL; 348static char *opt_title = NULL;
347static char *opt_embed = NULL; 349static char *opt_embed = NULL;
348static char *opt_class = NULL; 350static char *opt_class = NULL;
@@ -776,6 +778,10 @@ ttynew(void) {
776 close(s); 778 close(s);
777 cmdfd = m; 779 cmdfd = m;
778 signal(SIGCHLD, sigchld); 780 signal(SIGCHLD, sigchld);
781 if (opt_io && !(fileio = fopen(opt_io, "w"))) {
782 fprintf(stderr, "Error opening %s:%s",
783 opt_io, strerror(errno));
784 }
779 } 785 }
780} 786}
781 787
@@ -1534,6 +1540,9 @@ tputtab(bool forward) {
1534void 1540void
1535tputc(char *c) { 1541tputc(char *c) {
1536 char ascii = *c; 1542 char ascii = *c;
1543
1544 if (fileio)
1545 putc(ascii, fileio);
1537 if(term.esc & ESC_START) { 1546 if(term.esc & ESC_START) {
1538 if(term.esc & ESC_CSI) { 1547 if(term.esc & ESC_CSI) {
1539 csiescseq.buf[csiescseq.len++] = ascii; 1548 csiescseq.buf[csiescseq.len++] = ascii;
@@ -2269,6 +2278,9 @@ main(int argc, char *argv[]) {
2269 case 'w': 2278 case 'w':
2270 if(++i < argc) opt_embed = argv[i]; 2279 if(++i < argc) opt_embed = argv[i];
2271 break; 2280 break;
2281 case 'f':
2282 if (++i < argc) opt_io = argv[i];
2283 break;
2272 case 'e': 2284 case 'e':
2273 /* eat every remaining arguments */ 2285 /* eat every remaining arguments */
2274 if(++i < argc) opt_cmd = &argv[i]; 2286 if(++i < argc) opt_cmd = &argv[i];