You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/05/19 02:00:36 UTC

[incubator-nuttx-apps] branch master updated: nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new bd47c46  nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE
bd47c46 is described below

commit bd47c468c5d71a588b5472b4a387ac22c585c0f9
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue May 19 09:00:58 2020 +0900

    nshlib: Introduce CONFIG_NSH_WGET_BUFF_SIZE
    
    Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
 nshlib/Kconfig       | 8 ++++++++
 nshlib/nsh_netcmds.c | 5 +++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/nshlib/Kconfig b/nshlib/Kconfig
index 6d8b130..27f27d9 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 21e4725..e7945a0 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);