]> git.sur5r.net Git - gsconf/blob - shell_ip.c
A bunch of fixes for various compiler warnings
[gsconf] / shell_ip.c
1 #include "shell.h"
2 void shell_ip(char ** argv, int elem) {
3
4         if (elem == 1) {
5                 printf(" ip [show|dhcp|set] \n");
6                 return;
7         }
8         
9         if (strncmp(argv[1], "show", 2) == 0) {
10                 
11                 printf("IP:\t\t");
12                 printIp(settings.ip);
13                 printf("DHCP:\t\t%s\n", settings.dhcp == 0x01 ? "ON":"OFF");
14                 printf("Subnetmask:\t");
15                 printIp(settings.subnetmask);
16                 printf("Gateway:\t");
17                 printIp(settings.gateway);
18                 printf("\n");
19                 return;
20         }
21         if (strncmp(argv[1], "dhcp", 4) == 0) {
22                 if (elem == 2) {
23                         printf("ip dhcp [on|off|renew]\n");
24                         printf("         on: Turn on DHCP\n");
25                         printf("         off: Turn off DHCP, current IP will be taken\n");
26                         printf("         renew: renew IP-Address via DHCP (turns on DHCP too)\n");
27                 }else {
28                         password();
29                         if (strncmp(argv[2], "on", 2) == 0) {
30                                 printError(gs105e_dhcpSettings(DHCP_ON));
31                         } else if (strncmp(argv[2], "off", 3) == 0) {
32                                 printError(gs105e_dhcpSettings(DHCP_OFF));
33                         } else if (strncmp(argv[2], "renew", 5) == 0) {
34                                 printError(gs105e_dhcpSettings(DHCP_RENEW));
35                         }
36                         
37                 }
38         }
39 }