blind

suckless command-line video editing utility
git clone git://git.suckless.org/blind
Log | Files | Refs | README | LICENSE

commit 8c5fcaffb6461ef5706f3dc90653f11eb0065734
parent 77edf68c1a986fa3f80f5d5c986a736cbb5d24c4
Author: Mattias Andrée <maandree@kth.se>
Date:   Sun, 30 Apr 2017 14:12:21 +0200

Use stdin or stdout (depending on access mode) when opening -

Signed-off-by: Mattias Andrée <maandree@kth.se>

Diffstat:
Msrc/util.c | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/util.c b/src/util.c @@ -243,6 +243,11 @@ xenopen(int status, const char *path, int flags, int mode, ...) return STDOUT_FILENO; } else if (!strcmp(path, "/dev/stderr")) { return STDERR_FILENO; + } else if (!strcmp(path, "-")) { + if ((flags & O_ACCMODE) == O_RDONLY) + return STDIN_FILENO; + else + return STDOUT_FILENO; } fd = open(path, flags, mode); if (fd < 0)