xxd: allow "-" as file name meaning stdin

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2017-07-14 16:29:30 +02:00
parent 63214a68f1
commit 90678f0cd7

View File

@ -339,11 +339,13 @@ static NOINLINE int next(priv_dumper_t *dumper)
if (fname) {
dumper->argv++;
if (NOT_LONE_DASH(fname)) {
if (!freopen(fname, "r", stdin)) {
bb_simple_perror_msg(fname);
dumper->exitval = 1;
continue;
}
}
} else {
if (dumper->next__done)
return 0; /* no next file */