Skip to content

Commit

Permalink
[fix] Use stdio as default output
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Aug 29, 2013
1 parent 93443bd commit b5d9e96
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/aeternum.c
Expand Up @@ -144,15 +144,19 @@ int stdio_redirect(char *dest, int fd) {
}

void configure_stdio() {
outfile = opts.outfile;
errfile = opts.errfile;
stdio_redirect(opts.infile, STDIN_FILENO);
stdio_redirect(opts.outfile, STDOUT_FILENO);
if (opts.errfile != NULL) {
stdio_redirect(opts.errfile, STDERR_FILENO);
if (opts.infile != NULL) {
stdio_redirect(opts.infile, STDIN_FILENO);
}
else {
stdio_redirect(opts.outfile, STDERR_FILENO);

if (opts.outfile != NULL) {
stdio_redirect(opts.outfile, STDOUT_FILENO);

if (opts.errfile != NULL) {
stdio_redirect(opts.errfile, STDERR_FILENO);
}
else {
stdio_redirect(opts.outfile, STDERR_FILENO);
}
}
}

Expand Down

0 comments on commit b5d9e96

Please sign in to comment.