net-tools/net-tools-1.60-arbitrary-device-names.patch

71 lines
2.5 KiB
Diff
Raw Normal View History

diff -up net-tools-1.60/man/en_US/mii-tool.8.arbitrary-device-names net-tools-1.60/man/en_US/mii-tool.8
2011-12-06 18:15:09 +00:00
--- net-tools-1.60/man/en_US/mii-tool.8.arbitrary-device-names 2011-12-06 14:45:07.000000000 +0100
+++ net-tools-1.60/man/en_US/mii-tool.8 2011-12-06 14:47:48.406520671 +0100
@@ -16,7 +16,7 @@ mii\-tool \- view, manipulate media-inde
[\fB\-l\fR, \fB\-\-log\fR]
[\fB\-A\fR, \fB\-\-advertise=\fImedia,...\fR]
[\fB\-F\fR, \fB\-\-force=\fImedia\fR]
-.RI [ "interface\ ..." ]
2011-12-06 18:15:09 +00:00
+.RI "interface\ ..."
.SH NOTE
.P
@@ -42,9 +42,7 @@ one mode, instead of autonegotiating. T
options are mutually exclusive.
.PP
The default short output reports the negotiated link speed and link
-status for each interface. If an interface or interfaces are not
2011-12-06 18:15:09 +00:00
-specified on the command line, then \fBmii\-tool\fR will check any
-available interfaces from \fBeth0\fR through \fBeth7\fR.
+status for each interface.
.SH OPTIONS
.TP
\fB\-v\fR, \fB\-\-verbose\fR
diff -up net-tools-1.60/mii-tool.c.arbitrary-device-names net-tools-1.60/mii-tool.c
2011-12-06 18:15:09 +00:00
--- net-tools-1.60/mii-tool.c.arbitrary-device-names 2011-12-06 14:45:07.000000000 +0100
+++ net-tools-1.60/mii-tool.c 2011-12-06 14:53:39.823127359 +0100
@@ -424,7 +424,7 @@ static void watch_one_xcvr(int skfd, cha
/*--------------------------------------------------------------------*/
2011-12-06 18:15:09 +00:00
const char *usage =
-"usage: %s [-VvRrwl] [-A media,... | -F media] [interface ...]\n"
+"usage: %s [-VvRrwl] [-A media,... | -F media] <interface ...>\n"
" -V, --version display version information\n"
" -v, --verbose more verbose output\n"
" -R, --reset reset MII to poweron state\n"
@@ -491,13 +491,10 @@ int main(int argc, char **argv)
/* No remaining args means show all interfaces. */
if (optind == argc) {
- ret = 1;
- for (i = 0; i < MAX_ETH; i++) {
- sprintf(s, "eth%d", i);
- ret &= do_one_xcvr(skfd, s, 1);
- }
- if (ret)
- fprintf(stderr, "no MII interfaces found\n");
+ fprintf(stderr, "No interface specified\n");
+ fprintf(stderr, usage, argv[0]);
+ close(skfd);
+ return 2;
} else {
ret = 0;
for (i = optind; i < argc; i++) {
2011-12-06 18:15:09 +00:00
@@ -508,15 +505,8 @@ int main(int argc, char **argv)
if (opt_watch && (ret == 0)) {
while (1) {
sleep(1);
- if (optind == argc) {
- for (i = 0; i < MAX_ETH; i++) {
- sprintf(s, "eth%d", i);
- watch_one_xcvr(skfd, s, i);
- }
- } else {
- for (i = optind; i < argc; i++)
+ for (i = optind; i < argc; i++)
watch_one_xcvr(skfd, argv[i], i-optind);
- }
}
}