From 5a37e1fc5d78f69d130cade2607595ce0f094a90 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 25 Jan 2021 13:57:42 +0100 Subject: [PATCH] memcat: VC++ does not understand "?:" --- src/bin/memcat.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/memcat.cc b/src/bin/memcat.cc index ab8fc6db..1b0f36ca 100644 --- a/src/bin/memcat.cc +++ b/src/bin/memcat.cc @@ -96,11 +96,16 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); } + auto file_flag = opt.isset("file"); + auto file = opt.argof("file"); auto exit_code = EXIT_SUCCESS; for (auto arg = argp; *arg; ++arg) { auto key = *arg; if (*key) { - char *file = opt.isset("file") ? (opt.argof("file") ?: key) : nullptr; + if (!file && file_flag) { + file = key; + } + std::ofstream fstream{}; std::ostream *ostream = check_ostream(opt, file, fstream); -- 2.30.2