summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorDaniel Campello <campello@chromium.org>2021-04-15 10:36:04 -0600
committerEdward O'Callaghan <quasisec@chromium.org>2021-04-29 23:53:21 +0000
commitd4063bf3a7f5fd7831ee0321def13161976676d2 (patch)
tree1d6e44bb4c9f2aea393d7764e7885aa48ada2dbb /cli_classic.c
parent4cc7363d2520825aa300d81a67de71aede193f15 (diff)
downloadflashrom-d4063bf3a7f5fd7831ee0321def13161976676d2.tar.gz
flashrom-d4063bf3a7f5fd7831ee0321def13161976676d2.tar.bz2
flashrom-d4063bf3a7f5fd7831ee0321def13161976676d2.zip
flashrom.c: allow - as filename for stdin
Allows - as filename for -w/-v options. It is sometimes useful to script flashrom and allowing it to work with pipes allows for more flexibility in this specific use-case. Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: I97889cfdf7ba9a257e182c4ee2b20075cfa58d4d Reviewed-on: https://review.coreboot.org/c/flashrom/+/52383 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cli_classic.c b/cli_classic.c
index a22d642d4..7d4dee053 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -48,8 +48,10 @@ static void cli_classic_usage(const char *name)
printf(" -h | --help print this help text\n"
" -R | --version print version (release)\n"
" -r | --read <file> read flash and save to <file>\n"
- " -w | --write <file> write <file> to flash\n"
- " -v | --verify <file> verify flash against <file>\n"
+ " -w | --write <file|-> write <file> or the content provided\n"
+ " on the standard input to flash\n"
+ " -v | --verify <file|-> verify flash against <file>\n"
+ " or the content provided on the standard input\n"
" -E | --erase erase flash memory\n"
" -V | --verbose more verbose output\n"
" -c | --chip <chipname> probe only for specified flash chip\n"
@@ -107,7 +109,7 @@ static int check_filename(char *filename, const char *type)
return 1;
}
/* Not an error, but maybe the user intended to specify a CLI option instead of a file name. */
- if (filename[0] == '-')
+ if (filename[0] == '-' && filename[1] != '\0')
fprintf(stderr, "Warning: Supplied %s file name starts with -\n", type);
return 0;
}