mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
io: support stdio by using "-" as a path
This commit is contained in:
parent
2d05c0853a
commit
0ba5034954
1 changed files with 6 additions and 2 deletions
8
lib/io.c
8
lib/io.c
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "io.h"
|
||||
#include "io_format.h"
|
||||
|
@ -56,7 +57,10 @@ int io_stream_open(struct io *io, const char *uri)
|
|||
int ret;
|
||||
|
||||
if (uri) {
|
||||
if (aislocal(uri)) {
|
||||
if (strcmp(uri, "-")) {
|
||||
goto stdio;
|
||||
}
|
||||
else if (aislocal(uri)) {
|
||||
io->mode = IO_MODE_STDIO;
|
||||
|
||||
io->stdio.output = fopen(uri, "a+");
|
||||
|
@ -80,7 +84,7 @@ int io_stream_open(struct io *io, const char *uri)
|
|||
}
|
||||
}
|
||||
else {
|
||||
io->mode = IO_MODE_STDIO;
|
||||
stdio: io->mode = IO_MODE_STDIO;
|
||||
io->flags |= IO_FLUSH;
|
||||
|
||||
io->stdio.input = stdin;
|
||||
|
|
Loading…
Add table
Reference in a new issue