1 |
|
/* |
2 |
< |
* i-scream central monitoring system |
2 |
> |
* i-scream libstatgrab |
3 |
|
* http://www.i-scream.org |
4 |
|
* Copyright (C) 2000-2004 i-scream |
5 |
|
* |
44 |
|
if(network_iface_stats == NULL){ |
45 |
|
fprintf(stderr, "Failed to get network interface stats\n"); |
46 |
|
exit(1); |
47 |
+ |
} |
48 |
+ |
|
49 |
+ |
if (argc != 1) { |
50 |
+ |
/* If an argument is given, use bsearch to find just that |
51 |
+ |
* interface. */ |
52 |
+ |
sg_network_iface_stats key; |
53 |
+ |
|
54 |
+ |
key.interface_name = argv[1]; |
55 |
+ |
network_iface_stats = bsearch(&key, network_iface_stats, |
56 |
+ |
iface_count, |
57 |
+ |
sizeof *network_iface_stats, |
58 |
+ |
sg_network_iface_compare_name); |
59 |
+ |
if (network_iface_stats == NULL) { |
60 |
+ |
fprintf(stderr, "Interface %s not found\n", argv[1]); |
61 |
+ |
exit(1); |
62 |
+ |
} |
63 |
+ |
iface_count = 1; |
64 |
|
} |
65 |
|
|
66 |
|
printf("Name\tSpeed\tDuplex\n"); |