[hackers] [st] Allow simpler stdout -f handling. || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Thu, 6 Sep 2012 00:02:38 +0200 (CEST)

changeset: 289:c2341ed56abf
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Thu Sep 06 00:00:50 2012 +0200
files: st.c
description:
Allow simpler stdout -f handling.


diff -r aaa4519098f5 -r c2341ed56abf st.c
--- a/st.c Wed Sep 05 23:38:57 2012 +0200
+++ b/st.c Thu Sep 06 00:00:50 2012 +0200
_AT_@ -801,9 +801,15 @@
                 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));
+ }
+ }
                 }
         }
 }
Received on Thu Sep 06 2012 - 00:02:38 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 06 2012 - 00:12:15 CEST