Import data from stdin when the import file is "-"
Support "-" as file name to the -i/--import option and read from stdin when that file is specified. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
2994ea7003
commit
39a3c04144
5
src/io.c
5
src/io.c
@ -1169,7 +1169,10 @@ void io_import_data(enum import_type type, const char *stream_name, int list)
|
||||
|| type >= IO_IMPORT_NBTYPES, _("unknown import type"));
|
||||
switch (ui_mode) {
|
||||
case UI_CMDLINE:
|
||||
stream = fopen(stream_name, "r");
|
||||
if (!strcmp(stream_name, "-"))
|
||||
stream = stdin;
|
||||
else
|
||||
stream = fopen(stream_name, "r");
|
||||
EXIT_IF(stream == NULL,
|
||||
_("FATAL ERROR: the input file cannot be accessed, "
|
||||
"Aborting..."));
|
||||
|
Loading…
x
Reference in New Issue
Block a user