From bd47c468c5d71a588b5472b4a387ac22c585c0f9 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 19 May 2020 09:00:58 +0900 Subject: [PATCH] nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE Signed-off-by: Masayuki Ishikawa --- nshlib/Kconfig | 8 ++++++++ nshlib/nsh_netcmds.c | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/nshlib/Kconfig b/nshlib/Kconfig index 6d8b13051..27f27d93c 100644 --- a/nshlib/Kconfig +++ b/nshlib/Kconfig @@ -1121,6 +1121,14 @@ config NSH_NETINIT ---help--- This option enables/disables all network initialization in NSH. +if !NSH_DISABLE_WGET +config NSH_WGET_BUFF_SIZE + int "wget buffer size" + default 512 + ---help--- + Buffer size for wget command +endif # NSH_DISABLE_WGET + endmenu # Networking Configuration" menu "Telnet Configuration" diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c index 21e472595..e7945a091 100644 --- a/nshlib/nsh_netcmds.c +++ b/nshlib/nsh_netcmds.c @@ -1345,7 +1345,7 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* Allocate an I/O buffer */ - buffer = malloc(512); + buffer = malloc(CONFIG_NSH_WGET_BUFF_SIZE); if (buffer == NULL) { fmt = g_fmtcmdoutofmemory; @@ -1354,7 +1354,8 @@ int cmd_wget(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* And perform the wget */ - ret = wget(url, buffer, 512, wget_callback, (FAR void *)((intptr_t)fd)); + ret = wget(url, buffer, CONFIG_NSH_WGET_BUFF_SIZE, + wget_callback, (FAR void *)((intptr_t)fd)); if (ret < 0) { nsh_error(vtbl, g_fmtcmdfailed, argv[0], "wget", NSH_ERRNO);