Refactor print_rtt detection
This commit is contained in:
parent
d009065c33
commit
f7d469bb00
|
@ -8,16 +8,11 @@
|
|||
#include <string.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
bool print_rtt = false;
|
||||
if (argc == 1) {
|
||||
printf("%s", USAGE_STRING);
|
||||
return 1;
|
||||
}
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (strcmp(argv[i], RTT_FLAG) == 0) {
|
||||
print_rtt = true;
|
||||
}
|
||||
}
|
||||
bool print_rtt = strcmp(argv[1], RTT_FLAG) == 0;
|
||||
if ((print_rtt && argc != 4) || (!print_rtt && argc != 3)) {
|
||||
printf("%s", USAGE_STRING);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue