From: Michael Wallner Date: Mon, 25 Jan 2021 12:57:42 +0000 (+0100) Subject: memcat: VC++ does not understand "?:" X-Git-Tag: 1.1.0-beta3~11 X-Git-Url: https://git.m6w6.name/?p=awesomized%2Flibmemcached;a=commitdiff_plain;h=5a37e1fc5d78f69d130cade2607595ce0f094a90 memcat: VC++ does not understand "?:" --- 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);