mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-09-10 18:56:33 +00:00
apps/examples/webserver: nxstyle fixes
apps/examples/webserver/webserver_main.c:
* Fix nxstyle errors.
This commit is contained in:
parent
819454ee6e
commit
538c757340
1 changed files with 21 additions and 20 deletions
|
|
@ -110,7 +110,7 @@ int main(int argc, FAR char *argv[])
|
|||
void *handle;
|
||||
#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
|
||||
mac[0] = 0x00;
|
||||
|
|
@ -156,34 +156,35 @@ int main(int argc, FAR char *argv[])
|
|||
|
||||
handle = dhcpc_open("eth0", &mac, IFHWADDRLEN);
|
||||
|
||||
/* Get an IP address. Note: there is no logic here for renewing the address in this
|
||||
* example. The address should be renewed in ds.lease_time/2 seconds.
|
||||
/* Get an IP address. Note: there is no logic here for renewing the
|
||||
* address in this example. The address should be renewed in
|
||||
* ds.lease_time/2 seconds.
|
||||
*/
|
||||
|
||||
printf("Getting IP address\n");
|
||||
if (handle)
|
||||
{
|
||||
struct dhcpc_state ds;
|
||||
dhcpc_request(handle, &ds);
|
||||
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||
struct dhcpc_state ds;
|
||||
dhcpc_request(handle, &ds);
|
||||
netlib_set_ipv4addr("eth0", &ds.ipaddr);
|
||||
|
||||
if (ds.netmask.s_addr != 0)
|
||||
{
|
||||
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||
}
|
||||
if (ds.netmask.s_addr != 0)
|
||||
{
|
||||
netlib_set_ipv4netmask("eth0", &ds.netmask);
|
||||
}
|
||||
|
||||
if (ds.default_router.s_addr != 0)
|
||||
{
|
||||
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||
}
|
||||
if (ds.default_router.s_addr != 0)
|
||||
{
|
||||
netlib_set_dripv4addr("eth0", &ds.default_router);
|
||||
}
|
||||
|
||||
if (ds.dnsaddr.s_addr != 0)
|
||||
{
|
||||
netlib_set_ipv4dnsaddr(&ds.dnsaddr);
|
||||
}
|
||||
if (ds.dnsaddr.s_addr != 0)
|
||||
{
|
||||
netlib_set_ipv4dnsaddr(&ds.dnsaddr);
|
||||
}
|
||||
|
||||
dhcpc_close(handle);
|
||||
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
||||
dhcpc_close(handle);
|
||||
printf("IP: %s\n", inet_ntoa(ds.ipaddr));
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_NSH_NETINIT */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue