提交 4fada1a1 编写于 作者: wuyangyong's avatar wuyangyong

MSH: perfect cmd ifconfig.

上级 8de05291
......@@ -182,14 +182,32 @@ FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkdir, __cmd_mkdir, Create the DIRECTORY.);
#ifdef RT_USING_LWIP
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);
#endif
#endif /* RT_USING_LWIP */
int cmd_ps(int argc, char** argv)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册