apps/examples/webserver: nxstyle fixes
apps/examples/webserver/webserver_main.c: * Fix nxstyle errors.
This commit is contained in:
parent
819454ee6e
commit
538c757340
@ -110,7 +110,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
void *handle;
|
void *handle;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Many embedded network interfaces must have a software assigned MAC */
|
/* Many embedded network interfaces must have a software assigned MAC */
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_WEBSERVER_NOMAC
|
#ifdef CONFIG_EXAMPLES_WEBSERVER_NOMAC
|
||||||
mac[0] = 0x00;
|
mac[0] = 0x00;
|
||||||
@ -156,34 +156,35 @@ int main(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
handle = dhcpc_open("eth0", &mac, IFHWADDRLEN);
|
handle = dhcpc_open("eth0", &mac, IFHWADDRLEN);
|
||||||
|
|
||||||
/* Get an IP address. Note: there is no logic here for renewing the address in this
|
/* Get an IP address. Note: there is no logic here for renewing the
|
||||||
* example. The address should be renewed in ds.lease_time/2 seconds.
|
* address in this example. The address should be renewed in
|
||||||
|
* ds.lease_time/2 seconds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printf("Getting IP address\n");
|
printf("Getting IP address\n");
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
struct dhcpc_state ds;
|
struct dhcpc_state ds;
|
||||||
dhcpc_request(handle, &ds);
|
dhcpc_request(handle, &ds);
|
||||||
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||||
|
|
||||||
if (ds.netmask.s_addr != 0)
|
if (ds.netmask.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.default_router.s_addr != 0)
|
if (ds.default_router.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_set_dripv4addr("eth0", &ds.default_router);
|
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds.dnsaddr.s_addr != 0)
|
if (ds.dnsaddr.s_addr != 0)
|
||||||
{
|
{
|
||||||
netlib_set_ipv4dnsaddr(&ds.dnsaddr);
|
netlib_set_ipv4dnsaddr(&ds.dnsaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
dhcpc_close(handle);
|
dhcpc_close(handle);
|
||||||
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_NSH_NETINIT */
|
#endif /* CONFIG_NSH_NETINIT */
|
||||||
|
Loading…
Reference in New Issue
Block a user