mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-18 18:03:31 +08:00
MSH: perfect cmd ifconfig.
This commit is contained in:
parent
8de052915f
commit
4fada1a13a
@ -182,14 +182,32 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkdir, __cmd_mkdir, Create the DIRECTORY.);
|
|||||||
#ifdef RT_USING_LWIP
|
#ifdef RT_USING_LWIP
|
||||||
int cmd_ifconfig(int argc, char** argv)
|
int cmd_ifconfig(int argc, char** argv)
|
||||||
{
|
{
|
||||||
extern void list_if(void);
|
extern void list_if(void);
|
||||||
|
extern void set_if(char* netif_name, char* ip_addr, char* gw_addr, char* nm_addr);
|
||||||
|
|
||||||
list_if();
|
|
||||||
return 0;
|
if(argc == 1)
|
||||||
|
{
|
||||||
|
list_if();
|
||||||
|
}
|
||||||
|
else if(argc == 5)
|
||||||
|
{
|
||||||
|
rt_kprintf("config : %s\n", argv[1]);
|
||||||
|
rt_kprintf("IP addr: %s\n", argv[2]);
|
||||||
|
rt_kprintf("Gateway: %s\n", argv[3]);
|
||||||
|
rt_kprintf("netmask: %s\n", argv[4]);
|
||||||
|
set_if(argv[1], argv[2], argv[3], argv[4]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rt_kprintf("bad parameter! e.g: ifconfig e0 192.168.1.30 192.168.1.1 255.255.255.0\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information of network interfaces);
|
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information of network interfaces);
|
||||||
|
|
||||||
#endif
|
#endif /* RT_USING_LWIP */
|
||||||
|
|
||||||
int cmd_ps(int argc, char** argv)
|
int cmd_ps(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user