Refactor print_rtt detection

This commit is contained in:
Nick Krichevsky 2018-09-02 22:57:19 -04:00
parent d009065c33
commit f7d469bb00

View file

@ -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;