summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann2012-09-06 00:00:50 +0200
committerChristoph Lohmann2012-09-06 00:00:50 +0200
commita1cd28f8099eac3938461f9e63ff6b74d4d824ef (patch)
tree005debb669f3bbc5a6c259cc4ac0d94c123cd153
parentf2da43a0b66f76532ebef5ed2b2c9135aca771a5 (diff)
downloadst-a1cd28f8099eac3938461f9e63ff6b74d4d824ef.tar.gz
st-a1cd28f8099eac3938461f9e63ff6b74d4d824ef.tar.xz
st-a1cd28f8099eac3938461f9e63ff6b74d4d824ef.zip
Allow simpler stdout -f handling.
-rw-r--r--st.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/st.c b/st.c
index fd5e0fd..7852de0 100644
--- a/st.c
+++ b/st.c
@@ -801,9 +801,15 @@ ttynew(void) {
close(s);
cmdfd = m;
signal(SIGCHLD, sigchld);
- if(opt_io && !(fileio = fopen(opt_io, "w"))) {
- fprintf(stderr, "Error opening %s:%s\n",
- opt_io, strerror(errno));
+ if(opt_io) {
+ if(!strcmp(opt_io, "-")) {
+ fileio = stdout;
+ } else {
+ if(!(fileio = fopen(opt_io, "w"))) {
+ fprintf(stderr, "Error opening %s:%s\n",
+ opt_io, strerror(errno));
+ }
+ }
}
}
}