]> git.sur5r.net Git - gsconf/blob - shell_port.c
Initial Commit
[gsconf] / shell_port.c
1 #include "shell.h"
2
3 void shell_port(char ** argv, int elem) {
4         
5         int n;
6         
7         if (elem == 1) {
8         
9                 return;
10         }
11         if (strncmp(argv[1], "show", 4) == 0) {
12                 printf("Port\tSpeed\t\tBytes In\t\tBytes Out\n");
13                 for (n = 0; n< 5; n++) {
14                         printf("%i\t%s\t% 8lu\t\t% 8lu\n", n, 
15                         (settings.portStatistics[n].state == 0x05 ? "1000 Mbit/s" : (settings.portStatistics[n].state == 0x04 ? "100 Mbit/s" : (settings.portStatistics[n].state == 0x03 ? "10 Mbit/s":  (settings.portStatistics[n].state == 0x00 ? "No Cable": "???")))),
16                         settings.portStatistics[n].bytesIn,
17                         settings.portStatistics[n].bytesOut
18                         );
19                 }
20         }
21 }