examples/wget: wget example to work without NSH_NETINIT config
- Network initialization codes are not needed with NSH_NETINIT config. - Suppport commandline argument to set the URL to get. - Change stack size to independent
This commit is contained in:
parent
7a1d626504
commit
10386cf5b5
@ -12,6 +12,13 @@ config EXAMPLES_WGET
|
||||
|
||||
if EXAMPLES_WGET
|
||||
|
||||
config EXAMPLES_WGET_STACKSIZE
|
||||
int "wget stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
---help---
|
||||
Stack size of "wget" command. If you use SSL connection,
|
||||
you should increase this value around 8096.
|
||||
|
||||
config EXAMPLES_WGET_URL
|
||||
string "File URL"
|
||||
default ""
|
||||
@ -20,6 +27,7 @@ config EXAMPLES_WGET_URL
|
||||
|
||||
config EXAMPLES_WGET_NOMAC
|
||||
bool "Use Canned MAC Address"
|
||||
depends on !NSH_NETINIT
|
||||
default n
|
||||
|
||||
config EXAMPLES_WGET_IPADDR
|
||||
|
@ -41,7 +41,7 @@ MAINSRC = wget_main.c
|
||||
|
||||
PROGNAME = wget
|
||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||
STACKSIZE = $(CONFIG_DEFAULT_TASK_STACKSIZE)
|
||||
STACKSIZE = $(CONFIG_EXAMPLES_WGET_STACKSIZE)
|
||||
MODULE = $(CONFIG_EXAMPLES_WGET)
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
|
@ -108,6 +108,7 @@ static void callback(FAR char **buffer, int offset, int datend,
|
||||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
#ifndef CONFIG_NSH_NETINIT
|
||||
struct in_addr addr;
|
||||
#if defined(CONFIG_EXAMPLES_WGET_NOMAC)
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
@ -145,9 +146,18 @@ int main(int argc, FAR char *argv[])
|
||||
*/
|
||||
|
||||
netlib_ifup("eth0");
|
||||
#endif /* CONFIG_NSH_NETINIT */
|
||||
|
||||
/* Then start the server */
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
wget(argv[1], g_iobuffer, 512, callback, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
wget(CONFIG_EXAMPLES_WGET_URL, g_iobuffer, 512, callback, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user