mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 07:12:06 +08:00
nshlib/cmd_memdump: support new command: memdump
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
33
nshlib/nsh.h
33
nshlib/nsh.h
@@ -565,9 +565,15 @@
|
||||
# define CONFIG_NSH_DISABLE_FREE 1
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS) || defined(CONFIG_FS_PROCFS_EXCLUDE_MEMDUMP)
|
||||
# undef CONFIG_NSH_DISABLE_MEMDUMP
|
||||
# define CONFIG_NSH_DISABLE_MEMDUMP 1
|
||||
#endif
|
||||
|
||||
/* Suppress unused file utilities */
|
||||
|
||||
#define NSH_HAVE_CATFILE 1
|
||||
#define NSH_HAVE_WRITEFILE 1
|
||||
#define NSH_HAVE_READFILE 1
|
||||
#define NSH_HAVE_FOREACH_DIRENTRY 1
|
||||
#define NSH_HAVE_TRIMDIR 1
|
||||
@@ -940,6 +946,9 @@ void nsh_usbtrace(void);
|
||||
#ifndef CONFIG_NSH_DISABLE_FREE
|
||||
int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_NSH_DISABLE_MEMDUMP
|
||||
int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef CONFIG_NSH_DISABLE_TIME
|
||||
int cmd_time(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||
#endif
|
||||
@@ -1294,6 +1303,30 @@ int nsh_readfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
FAR const char *filepath, FAR char *buffer, size_t buflen);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_writefile
|
||||
*
|
||||
* Description:
|
||||
* Dump the contents of a file to the current NSH terminal.
|
||||
*
|
||||
* Input Paratemets:
|
||||
* vtbl - session vtbl
|
||||
* cmd - NSH command name to use in error reporting
|
||||
* buffer - The pointer of writting buffer
|
||||
* len - The length of writting buffer
|
||||
* filepath - The full path to the file to be dumped
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; -1 (ERROR) on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_WRITEFILE
|
||||
int nsh_writefile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
FAR const char *buffer, size_t len,
|
||||
FAR const char *filepath);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_foreach_direntry
|
||||
*
|
||||
|
Reference in New Issue
Block a user