This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 538c757340eb7a07a8ae26d35570a84e4d59481a Author: Nathan Hartman <[email protected]> AuthorDate: Sun Jan 3 18:00:55 2021 -0500 apps/examples/webserver: nxstyle fixes apps/examples/webserver/webserver_main.c: * Fix nxstyle errors. --- examples/webserver/webserver_main.c | 49 +++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/examples/webserver/webserver_main.c b/examples/webserver/webserver_main.c index 9d2313f..0222190 100644 --- a/examples/webserver/webserver_main.c +++ b/examples/webserver/webserver_main.c @@ -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); - - 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.dnsaddr.s_addr != 0) - { - netlib_set_ipv4dnsaddr(&ds.dnsaddr); - } - - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(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.default_router.s_addr != 0) + { + netlib_set_dripv4addr("eth0", &ds.default_router); + } + + if (ds.dnsaddr.s_addr != 0) + { + netlib_set_ipv4dnsaddr(&ds.dnsaddr); + } + + dhcpc_close(handle); + printf("IP: %s\n", inet_ntoa(ds.ipaddr)); } #endif #endif /* CONFIG_NSH_NETINIT */
