summary |
log |
commit |
diff |
tree
raw |
patch |
inline | side by side (from parent 1:
cfefa05)
This is a theorical feature listed in http://st.suckless.org/goals. All the
input/output of the terminal will be written to a file, which can be very
useful for debugging, and also allow interconnect st to other process
through named pipes.
---
st.1 | 6 ++++++
st.c | 14 +++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
.RB [ \-w
.IR windowid ]
.RB [ \-v ]
.RB [ \-w
.IR windowid ]
.RB [ \-v ]
.RB [ \-e
.IR command ...]
.SH DESCRIPTION
.RB [ \-e
.IR command ...]
.SH DESCRIPTION
.B \-v
prints version information to stderr, then exits.
.TP
.B \-v
prints version information to stderr, then exits.
.TP
+.BI \-f " file"
+writes all the I/O to
+.I file
+.TP
.BI \-e " program " [ " arguments " "... ]"
st executes
.I program
.BI \-e " program " [ " arguments " "... ]"
st executes
.I program
#define USAGE \
"st " VERSION " (c) 2010-2012 st engineers\n" \
#define USAGE \
"st " VERSION " (c) 2010-2012 st engineers\n" \
- "usage: st [-t title] [-c class] [-w windowid] [-v] [-e command...]\n"
+ "usage: st [-t title] [-c class] [-w windowid] [-v] [-f file] [-e command...]\n"
/* XEMBED messages */
#define XEMBED_FOCUS_IN 4
/* XEMBED messages */
#define XEMBED_FOCUS_IN 4
static int cmdfd;
static pid_t pid;
static Selection sel;
static int cmdfd;
static pid_t pid;
static Selection sel;
static char **opt_cmd = NULL;
static char **opt_cmd = NULL;
+static char *opt_io = NULL;
static char *opt_title = NULL;
static char *opt_embed = NULL;
static char *opt_class = NULL;
static char *opt_title = NULL;
static char *opt_embed = NULL;
static char *opt_class = NULL;
close(s);
cmdfd = m;
signal(SIGCHLD, sigchld);
close(s);
cmdfd = m;
signal(SIGCHLD, sigchld);
+ if (opt_io && !(fileio = fopen(opt_io, "w"))) {
+ fprintf(stderr, "Error opening %s:%s",
+ opt_io, strerror(errno));
+ }
void
tputc(char *c) {
char ascii = *c;
void
tputc(char *c) {
char ascii = *c;
+
+ if (fileio)
+ putc(ascii, fileio);
if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {
csiescseq.buf[csiescseq.len++] = ascii;
if(term.esc & ESC_START) {
if(term.esc & ESC_CSI) {
csiescseq.buf[csiescseq.len++] = ascii;
case 'w':
if(++i < argc) opt_embed = argv[i];
break;
case 'w':
if(++i < argc) opt_embed = argv[i];
break;
+ case 'f':
+ if (++i < argc) opt_io = argv[i];
+ break;
case 'e':
/* eat every remaining arguments */
if(++i < argc) opt_cmd = &argv[i];
case 'e':
/* eat every remaining arguments */
if(++i < argc) opt_cmd = &argv[i];