X-Git-Url: https://git.sur5r.net/?p=gsconf;a=blobdiff_plain;f=shell_port.c;fp=shell_port.c;h=258d966a37a0db7363d0e30d1e42f025e2c3ff7d;hp=0000000000000000000000000000000000000000;hb=84795a4c9a792a8ab63f71174fef707a4776a078;hpb=b5931e7e2b854225e3556b3edf20174bcdd64c66 diff --git a/shell_port.c b/shell_port.c new file mode 100644 index 0000000..258d966 --- /dev/null +++ b/shell_port.c @@ -0,0 +1,21 @@ +#include "shell.h" + +void shell_port(char ** argv, int elem) { + + int n; + + if (elem == 1) { + + return; + } + if (strncmp(argv[1], "show", 4) == 0) { + printf("Port\tSpeed\t\tBytes In\t\tBytes Out\n"); + for (n = 0; n< 5; n++) { + printf("%i\t%s\t% 8lu\t\t% 8lu\n", n, + (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": "???")))), + settings.portStatistics[n].bytesIn, + settings.portStatistics[n].bytesOut + ); + } + } +}