Signed-off-by: Olivier Matz <zer0@droids-corp.org>
-cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
+cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path,
+ int use_stdout)
{
int fd;
fd = open(path, O_RDONLY, 0);
{
int fd;
fd = open(path, O_RDONLY, 0);
dprintf("open() failed\n");
return NULL;
}
dprintf("open() failed\n");
return NULL;
}
- return (cmdline_new(ctx, prompt, fd, -1));
+ return (cmdline_new(ctx, prompt, fd, use_stdout ? 1 : -1));
struct cmdline *cmdline_accept(cmdline_parse_ctx_t *ctx, const char *prompt, int s);
#endif
struct cmdline *cmdline_accept(cmdline_parse_ctx_t *ctx, const char *prompt, int s);
#endif
-struct cmdline *cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path);
+struct cmdline *cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt,
+ const char *path, int use_stdout);
struct cmdline *cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt);
void cmdline_stdin_exit(struct cmdline *cl);
struct cmdline *cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt);
void cmdline_stdin_exit(struct cmdline *cl);