aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2012-09-06 00:00:50 +0200
committerChristoph Lohmann <20h@r-36.net>2012-09-06 00:00:50 +0200
commit25cdfc84833981aded624bfb6854b39a9f0e5d31 (patch)
tree005debb669f3bbc5a6c259cc4ac0d94c123cd153
parentb576d2c551ed47eaa8258bb7d9d7ee409bb4d9b7 (diff)
downloadst-25cdfc84833981aded624bfb6854b39a9f0e5d31.tar.gz
st-25cdfc84833981aded624bfb6854b39a9f0e5d31.tar.bz2
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));
+ }
+ }
}
}
}