Skip to content

Commit 4044f8f

Browse files
authored
main.cpp: fixed handling of options without value (#645)
1 parent 7e7a525 commit 4044f8f

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

main.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int main(int argc, char **argv)
8686
break;
8787
}
8888
dui.includes.emplace_back(std::move(value));
89-
} else if (std::strncmp(arg, "-is",3)==0) {
89+
} else if (std::strcmp(arg, "-is")==0) {
9090
found = true;
9191
use_istream = true;
9292
}
@@ -104,20 +104,28 @@ int main(int argc, char **argv)
104104
}
105105
break;
106106
case 'q':
107-
found = true;
108-
quiet = true;
107+
if (std::strcmp(arg, "-q")==0) {
108+
found = true;
109+
quiet = true;
110+
}
109111
break;
110112
case 'e':
111-
found = true;
112-
error_only = true;
113+
if (std::strcmp(arg, "-e")==0) {
114+
found = true;
115+
error_only = true;
116+
}
113117
break;
114118
case 'f':
115-
found = true;
116-
fail_on_error = true;
119+
if (std::strcmp(arg, "-f")==0) {
120+
found = true;
121+
fail_on_error = true;
122+
}
117123
break;
118124
case 'l':
119-
linenrs = true;
120-
found = true;
125+
if (std::strcmp(arg, "-l")==0) {
126+
linenrs = true;
127+
found = true;
128+
}
121129
break;
122130
}
123131
if (!found) {

0 commit comments

Comments
 (0)