summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/main_mdump.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2007-12-17 00:12:01 +0000
committerChris Johns <chrisj@rtems.org>2007-12-17 00:12:01 +0000
commit2eeb648c35eef0a378470f3cca523963978ffd09 (patch)
tree1c9ad13fdbf0117c6c953979da82cad8daf48d76 /cpukit/libmisc/shell/main_mdump.c
parent2007-12-16 Ralf Corsépius <ralf.corsepius@rtems.org> (diff)
downloadrtems-2eeb648c35eef0a378470f3cca523963978ffd09.tar.bz2
2007-12-17 Chris Johns <chrisj@rtems.org>
* libnetworking/rtems/tftp.h: Provide a decl to the TFTP file system opts table. * libnetworking/rtems/ftpfs.h: Provide a decl to the FTP file system opts table. * libmisc/Makefile.am: Add the mount command and supporting files. * libmisc/preinstall.am: Rebuilt. * libmisc/shell/cat_file.c, libmisc/shell/cmds.c, libmisc/shell/main_alias.c, libmisc/shell/main_cat.c, libmisc/shell/main_cd.c, libmisc/shell/main_chdir.c, libmisc/shell/main_chmod.c, libmisc/shell/main_chroot.c, libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c, libmisc/shell/main_dir.c, libmisc/shell/main_exit.c, libmisc/shell/main_help.c, libmisc/shell/main_id.c, libmisc/shell/main_logoff.c, libmisc/shell/main_ls.c, libmisc/shell/main_mallocdump.c, libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c, libmisc/shell/main_mkdir.c, libmisc/shell/main_mmove.c, libmisc/shell/main_mwdump.c, libmisc/shell/main_pwd.c, libmisc/shell/main_rm.c, libmisc/shell/main_rmdir.c, libmisc/shell/main_stackuse.c, libmisc/shell/main_tty.c, libmisc/shell/main_umask.c, libmisc/shell/main_whoami.c, libmisc/shell/shell.c, libmisc/shell/shell_cmdset.c, libmisc/shell/shell_makeargs.c, libmisc/shell/str2int.c, libmisc/shell/write_file.c: Move all shell_* types, variables and functions to rtems_shell_* to avoid namespace clashes with applications. The is an RTEMS shell after all. * libmisc/shell/shell.h, libmisc/shell/internal.h, libmisc/shell/shellconfig.h: Move all shell_* types, variables and functions to rtems_shell_* to avoid namespace clashes with applications. Add the mount command supporting types. * libmisc/shell/main_mount.c, libmisc/shell/main_mount_ftp.c, libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_nfs.c, libmisc/shell/main_mount_tftp.c: New.
Diffstat (limited to 'cpukit/libmisc/shell/main_mdump.c')
-rw-r--r--cpukit/libmisc/shell/main_mdump.c140
1 files changed, 8 insertions, 132 deletions
diff --git a/cpukit/libmisc/shell/main_mdump.c b/cpukit/libmisc/shell/main_mdump.c
index efb57303fc..bc7cd816f8 100644
--- a/cpukit/libmisc/shell/main_mdump.c
+++ b/cpukit/libmisc/shell/main_mdump.c
@@ -28,16 +28,16 @@
* RAM MEMORY COMMANDS
*----------------------------------------------------------------------------*/
-int main_mdump(int argc,char * argv[]) {
+int rtems_shell_main_mdump(int argc,char * argv[]) {
unsigned char n,m,max=0;
uintptr_t addr;
unsigned char *pb;
- addr = current_shell_env->mdump_addr;
+ addr = rtems_current_shell_env->mdump_addr;
if (argc>1)
- addr = str2int(argv[1]);
+ addr = rtems_shell_str2int(argv[1]);
if (argc>2)
- max = str2int(argv[2]);
+ max = rtems_shell_str2int(argv[2]);
max /= 16;
@@ -45,7 +45,7 @@ int main_mdump(int argc,char * argv[]) {
max = 20;
for (m=0;m<max;m++) {
- fprintf(stdout,"0x%08X ",addr);
+ fprintf(stdout,"0x%08lX ",addr);
pb = (unsigned char*) addr;
for (n=0;n<16;n++)
fprintf(stdout,"%02X%c",pb[n],n==7?'-':' ');
@@ -55,140 +55,16 @@ int main_mdump(int argc,char * argv[]) {
fprintf(stdout,"\n");
addr += 16;
}
- current_shell_env->mdump_addr = addr;
+ rtems_current_shell_env->mdump_addr = addr;
return 0;
}
-shell_cmd_t Shell_MDUMP_Command = {
+rtems_shell_cmd_t rtems_Shell_MDUMP_Command = {
"mdump", /* name */
"mdump [addr [size]]", /* usage */
"mem", /* topic */
- main_mdump, /* command */
+ rtems_shell_main_mdump, /* command */
NULL, /* alias */
NULL /* next */
};
-
-/*----------------------------------------------------------------------------*/
-int main_mwdump(int argc,char * argv[]) {
- unsigned char n,m,max=0;
- int addr=current_shell_env->mdump_addr;
- unsigned short * pw;
-
- if (argc>1)
- addr = str2int(argv[1]);
- if (argc>2)
- max = str2int(argv[2]);
-
- max /= 16;
-
- if (!max)
- max = 20;
-
- for (m=0;m<max;m++) {
- fprintf(stdout,"0x%08X ",addr);
- pw = (unsigned short*) addr;
- for (n=0;n<8;n++)
- fprintf(stdout,"%02X %02X%c",pw[n]/0x100,pw[n]%0x100,n==3?'-':' ');
- for (n=0;n<8;n++) {
- fprintf(stdout,"%c",isprint(pw[n]/0x100)?pw[n]/0x100:'.');
- fprintf(stdout,"%c",isprint(pw[n]%0x100)?pw[n]%0x100:'.');
- }
- fprintf(stdout,"\n");
- addr += 16;
- }
- current_shell_env->mdump_addr = addr;
- return 0;
-}
-
-shell_cmd_t Shell_WDUMP_Command = {
- "wdump", /* name */
- "wdump [addr [size]]", /* usage */
- "mem", /* topic */
- main_mwdump, /* command */
- NULL, /* alias */
- NULL /* next */
-};
-
-/*----------------------------------------------------------------------------*/
-int main_medit(int argc,char * argv[]) {
- unsigned char * pb;
- int n,i;
-
- if (argc<3) {
- fprintf(stdout,"too few arguments\n");
- return 0;
- }
-
- pb = (unsigned char*)str2int(argv[1]);
- i = 2;
- n = 0;
- while (i<=argc) {
- pb[n++] = str2int(argv[i++])%0x100;
- }
- current_shell_env->mdump_addr = (int)pb;
- return main_mdump(0,NULL);
-}
-
-shell_cmd_t Shell_MEDIT_Command = {
- "medit", /* name */
- "medit addr value [value ...]", /* usage */
- "mem", /* topic */
- main_medit, /* command */
- NULL, /* alias */
- NULL /* next */
-};
-
-/*----------------------------------------------------------------------------*/
-int main_mfill(int argc,char * argv[]) {
- int addr;
- int size;
- unsigned char value;
-
- if (argc<4) {
- fprintf(stdout,"too few arguments\n");
- return 0;
- }
- addr = str2int(argv[1]);
- size = str2int(argv[2]);
- value= str2int(argv[3]) % 0x100;
- memset((unsigned char*)addr,size,value);
- current_shell_env->mdump_addr = addr;
- return main_mdump(0,NULL);
-}
-
-shell_cmd_t Shell_MFILL_Command = {
- "mfill", /* name */
- "mfill addr size value", /* usage */
- "mem", /* topic */
- main_mfill, /* command */
- NULL, /* alias */
- NULL /* next */
-};
-
-/*----------------------------------------------------------------------------*/
-int main_mmove(int argc,char * argv[]) {
- int src;
- int dst;
- int size;
-
- if (argc<4) {
- fprintf(stdout,"too few arguments\n");
- return 0;
- }
- dst = str2int(argv[1]);
- src = str2int(argv[2]);
- size = str2int(argv[3]);
- memcpy((unsigned char*)dst,(unsigned char*)src,size);
- current_shell_env->mdump_addr = dst;
- return main_mdump(0,NULL);
-}
-
-shell_cmd_t Shell_MMOVE_Command = {
- "mmove", /* name */
- "mmove dst src size", /* usage */
- "mem", /* topic */
- main_mmove, /* command */
- NULL, /* alias */
- NULL /* next */
-};