comparison toys/netcat.c @ 328:48e0f1f45181

Fix netcat -f
author Rob Landley <rob@landley.net>
date Mon, 08 Dec 2008 00:16:07 -0600
parents 50c8afc263ee
children d44eb064da41
comparison
equal deleted inserted replaced
327:a50d2c0f96ed 328:48e0f1f45181
97 pollfds[0].events = pollfds[1].events = POLLIN; 97 pollfds[0].events = pollfds[1].events = POLLIN;
98 set_alarm(TT.wait); 98 set_alarm(TT.wait);
99 99
100 // The argument parsing logic can't make "<2" conditional on other 100 // The argument parsing logic can't make "<2" conditional on other
101 // arguments like -f and -l, so we do it by hand here. 101 // arguments like -f and -l, so we do it by hand here.
102 if ((toys.optflags&FLAG_f) && toys.optc!=1) toys.exithelp++; 102 if (toys.optflags&FLAG_f) {
103 if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++; 103 if (toys.optc) toys.exithelp++;
104 } else if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++;
104 105
105 if (toys.exithelp) error_exit("Argument count wrong"); 106 if (toys.exithelp) error_exit("Argument count wrong");
106 107
107 if (TT.filename) pollfds[0].fd = xopen(TT.filename, O_RDWR); 108 if (TT.filename) pollfds[0].fd = xopen(TT.filename, O_RDWR);
108 else { 109 else {