Get rid of ctx->fout, use stdout instead
This commit is contained in:
2
shell.h
2
shell.h
@@ -19,8 +19,6 @@ struct shell_var {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct shell_ctx {
|
struct shell_ctx {
|
||||||
FILE *fin;
|
|
||||||
FILE *fout;
|
|
||||||
int reproducible;
|
int reproducible;
|
||||||
const char *hist_file;
|
const char *hist_file;
|
||||||
struct shell_var *var;
|
struct shell_var *var;
|
||||||
|
@@ -57,8 +57,8 @@ main(int argc, char **argv) {
|
|||||||
" -r reproducible logs (without pointers and datetime)\n"
|
" -r reproducible logs (without pointers and datetime)\n"
|
||||||
" -c collect coverage";
|
" -c collect coverage";
|
||||||
const char *infile = NULL, *outfile = NULL;
|
const char *infile = NULL, *outfile = NULL;
|
||||||
struct shell_ctx ctx = {.fin = stdin, .fout = stdout, .reproducible = 0,
|
struct shell_ctx ctx = {.reproducible = 0, .hist_file = history_filename,
|
||||||
.hist_file = history_filename, .var = NULL};
|
.var = NULL};
|
||||||
build_history_filename();
|
build_history_filename();
|
||||||
/*
|
/*
|
||||||
kos_boot.memmap_block_cnt = 3;
|
kos_boot.memmap_block_cnt = 3;
|
||||||
@@ -98,11 +98,11 @@ main(int argc, char **argv) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (infile && !(ctx.fin = freopen(infile, "r", stdin))) {
|
if (infile && !freopen(infile, "r", stdin)) {
|
||||||
fprintf(stderr, "[!] can't open file for reading: %s", infile);
|
fprintf(stderr, "[!] can't open file for reading: %s", infile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (outfile && !(ctx.fout = freopen(outfile, "w", stdout))) {
|
if (outfile && !freopen(outfile, "w", stdout)) {
|
||||||
fprintf(stderr, "[!] can't open file for writing: %s", outfile);
|
fprintf(stderr, "[!] can't open file for writing: %s", outfile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user