]> git.sur5r.net Git - gsconf/blobdiff - shell_port.c
Initial Commit
[gsconf] / shell_port.c
diff --git a/shell_port.c b/shell_port.c
new file mode 100644 (file)
index 0000000..258d966
--- /dev/null
@@ -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
+                        );
+                }
+        }
+}