Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sunflsks committed Feb 25, 2022
1 parent e9f2467 commit 03b193e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
8 changes: 4 additions & 4 deletions monitor/monitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@
};

int nctl_monitor(int argc, char** argv) {
if (argc < 2) {
if (argc < 1) {
errno = EINVAL;
errx(1, "not enough args");
}

BOOL monitorTCP = NO;
BOOL monitorUDP = NO;

if (!strcmp(argv[1], "tcp")) {
if (!strcmp(argv[0], "tcp")) {
monitorTCP = YES;
}
if (!strcmp(argv[1], "udp")) {
if (!strcmp(argv[0], "udp")) {
monitorUDP = YES;
}
if (!strcmp(argv[1], "all")) {
if (!strcmp(argv[0], "all")) {
monitorTCP = YES;
monitorUDP = YES;
}
Expand Down
16 changes: 7 additions & 9 deletions netctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@ int main(int argc, char *argv[]) {
}

#if NO_WIFI == 0
if (!strcmp(argv[1], "wifi"))
return wifi(argc, argv);
if (!strcmp(argv[1], "wifi")) return wifi(argc, argv);
#endif

#if NO_CELLULAR == 0
if (!strcmp(argv[1], "cellular"))
return cellular(argc, argv);
if (!strcmp(argv[1], "cellular")) return cellular(argc, argv);
#endif

#if NO_AIRDROP == 0
if (!strcmp(argv[1], "airdrop"))
return airdrop(argc, argv);
if (!strcmp(argv[1], "airdrop")) return airdrop(argc, argv);
#endif

#if NO_AIRPLANE == 0
Expand All @@ -37,14 +34,15 @@ int main(int argc, char *argv[]) {
#endif

#if NO_MONITOR == 0
if (!strcmp(argv[1], "monitor"))
return nctl_monitor(argc-1, argv+1);
if (!strcmp(argv[1], "monitor")) return nctl_monitor(argc - 2, argv + 2);
#endif

usage();
return 1;
}

void usage() {
fprintf(stderr, "Usage: netctl [airdrop | cellular | wifi | monitor] [arguments]\n");
fprintf(
stderr,
"Usage: netctl [airdrop | cellular | wifi | monitor] [arguments]\n");
}

0 comments on commit 03b193e

Please sign in to comment.