Skip to content

Commit 5a37e1f

Browse files
committed
memcat: VC++ does not understand "?:"
1 parent 491fe2d commit 5a37e1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/memcat.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ int main(int argc, char *argv[]) {
9696
exit(EXIT_FAILURE);
9797
}
9898

99+
auto file_flag = opt.isset("file");
100+
auto file = opt.argof("file");
99101
auto exit_code = EXIT_SUCCESS;
100102
for (auto arg = argp; *arg; ++arg) {
101103
auto key = *arg;
102104
if (*key) {
103-
char *file = opt.isset("file") ? (opt.argof("file") ?: key) : nullptr;
105+
if (!file && file_flag) {
106+
file = key;
107+
}
108+
104109
std::ofstream fstream{};
105110
std::ostream *ostream = check_ostream(opt, file, fstream);
106111

0 commit comments

Comments
 (0)