Skip to content

Commit 594a863

Browse files
committed
Merge pull request #9 from opsmezzo/stdio-default
[fix] Use stdio as default output
2 parents d7958c5 + b5d9e96 commit 594a863

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/aeternum.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,19 @@ int stdio_redirect(char *dest, int fd) {
146146
}
147147

148148
void configure_stdio() {
149-
outfile = opts.outfile;
150-
errfile = opts.errfile;
151-
stdio_redirect(opts.infile, STDIN_FILENO);
152-
stdio_redirect(opts.outfile, STDOUT_FILENO);
153-
if (opts.errfile != NULL) {
154-
stdio_redirect(opts.errfile, STDERR_FILENO);
149+
if (opts.infile != NULL) {
150+
stdio_redirect(opts.infile, STDIN_FILENO);
155151
}
156-
else {
157-
stdio_redirect(opts.outfile, STDERR_FILENO);
152+
153+
if (opts.outfile != NULL) {
154+
stdio_redirect(opts.outfile, STDOUT_FILENO);
155+
156+
if (opts.errfile != NULL) {
157+
stdio_redirect(opts.errfile, STDERR_FILENO);
158+
}
159+
else {
160+
stdio_redirect(opts.outfile, STDERR_FILENO);
161+
}
158162
}
159163
}
160164

0 commit comments

Comments
 (0)