|
@@ -56,9 +56,11 @@ typedef struct ctx_s {
|
|
|
tri_t pager_working;
|
|
|
FILE *pager_pipe;
|
|
|
client_mode_e mode;
|
|
|
+
|
|
|
faux_list_node_t *cmdline_iter;
|
|
|
faux_list_node_t *files_iter;
|
|
|
faux_file_t *files_fd;
|
|
|
+ faux_file_t *stdin_fd;
|
|
|
} ctx_t;
|
|
|
|
|
|
|
|
@@ -216,17 +218,6 @@ int main(int argc, char **argv)
|
|
|
|
|
|
|
|
|
} else if (ctx.mode == MODE_STDIN) {
|
|
|
- char *line = NULL;
|
|
|
- faux_file_t *fd = faux_file_fdopen(STDIN_FILENO);
|
|
|
- while ((line = faux_file_getline(fd))) {
|
|
|
-
|
|
|
-
|
|
|
- faux_str_free(line);
|
|
|
-
|
|
|
- if (opts->stop_on_error && (retcode != 0))
|
|
|
- break;
|
|
|
- }
|
|
|
- faux_file_close(fd);
|
|
|
|
|
|
|
|
|
} else {
|
|
@@ -299,6 +290,15 @@ static bool_t send_next_command(ctx_t *ctx)
|
|
|
ctx->files_fd = NULL;
|
|
|
}
|
|
|
} while (!line);
|
|
|
+
|
|
|
+
|
|
|
+ } else if (ctx->mode == MODE_STDIN) {
|
|
|
+ if (!ctx->stdin_fd)
|
|
|
+ ctx->stdin_fd = faux_file_fdopen(STDIN_FILENO);
|
|
|
+ if (ctx->stdin_fd)
|
|
|
+ line = faux_file_getline(ctx->stdin_fd);
|
|
|
+ if (!line)
|
|
|
+ faux_file_close(ctx->stdin_fd);
|
|
|
}
|
|
|
|
|
|
if (!line) {
|