aboutsummaryrefslogtreecommitdiff
path: root/toys/other/netcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other/netcat.c')
-rw-r--r--toys/other/netcat.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/toys/other/netcat.c b/toys/other/netcat.c
index 9d0c3cf3..3cc3f0a0 100644
--- a/toys/other/netcat.c
+++ b/toys/other/netcat.c
@@ -91,11 +91,9 @@ void netcat_main(void)
// The argument parsing logic can't make "<2" conditional on other
// arguments like -f and -l, so we do it by hand here.
- if (toys.optflags&FLAG_f) {
- if (toys.optc) toys.exithelp++;
- } else if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++;
-
- if (toys.exithelp) error_exit("Argument count wrong");
+ if ((toys.optflags&FLAG_f) ? toys.optc :
+ (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2))
+ help_exit("Argument count wrong");
if (TT.filename) pollfds[0].fd = xopen(TT.filename, O_RDWR);
else {