diff options
| -rw-r--r-- | st.1 | 6 | ||||
| -rw-r--r-- | st.c | 14 |
2 files changed, 19 insertions, 1 deletions
| @@ -10,6 +10,8 @@ st \- simple terminal | |||
| 10 | .RB [ \-w | 10 | .RB [ \-w |
| 11 | .IR windowid ] | 11 | .IR windowid ] |
| 12 | .RB [ \-v ] | 12 | .RB [ \-v ] |
| 13 | .RB [ \-f | ||
| 14 | .IR file ] | ||
| 13 | .RB [ \-e | 15 | .RB [ \-e |
| 14 | .IR command ...] | 16 | .IR command ...] |
| 15 | .SH DESCRIPTION | 17 | .SH DESCRIPTION |
| @@ -30,6 +32,10 @@ embeds st within the window identified by | |||
| 30 | .B \-v | 32 | .B \-v |
| 31 | prints version information to stderr, then exits. | 33 | prints version information to stderr, then exits. |
| 32 | .TP | 34 | .TP |
| 35 | .BI \-f " file" | ||
| 36 | writes all the I/O to | ||
| 37 | .I file | ||
| 38 | .TP | ||
| 33 | .BI \-e " program " [ " arguments " "... ]" | 39 | .BI \-e " program " [ " arguments " "... ]" |
| 34 | st executes | 40 | st executes |
| 35 | .I program | 41 | .I program |
| @@ -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; | |||
| 342 | static int cmdfd; | 342 | static int cmdfd; |
| 343 | static pid_t pid; | 343 | static pid_t pid; |
| 344 | static Selection sel; | 344 | static Selection sel; |
| 345 | static FILE *fileio; | ||
| 345 | static char **opt_cmd = NULL; | 346 | static char **opt_cmd = NULL; |
| 347 | static char *opt_io = NULL; | ||
| 346 | static char *opt_title = NULL; | 348 | static char *opt_title = NULL; |
| 347 | static char *opt_embed = NULL; | 349 | static char *opt_embed = NULL; |
| 348 | static char *opt_class = NULL; | 350 | static 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) { | |||
| 1534 | void | 1540 | void |
| 1535 | tputc(char *c) { | 1541 | tputc(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]; |
