summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/main_mdump.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-23 14:32:34 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-23 14:32:34 +0000
commit48751ab095bbbb23489c2e3243f57571cbfa9153 (patch)
tree7a15647c01c3acdb2d1c61142bb13616ad03a2aa /cpukit/libmisc/shell/main_mdump.c
parent2009-07-23 Santosh G Vattam <vattam.santosh@gmail.com> (diff)
downloadrtems-48751ab095bbbb23489c2e3243f57571cbfa9153.tar.bz2
2009-07-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am, libmisc/shell/main_chmod.c, libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c, libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c, libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c, libmisc/shell/shell_script.c, libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h: Convert return type from bool to rtems_status_code and add rtems_string_to_pointer. Perform associated clean up and changes for return type change. * libmisc/stringto/stringtopointer.c: New file.
Diffstat (limited to 'cpukit/libmisc/shell/main_mdump.c')
-rw-r--r--cpukit/libmisc/shell/main_mdump.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/cpukit/libmisc/shell/main_mdump.c b/cpukit/libmisc/shell/main_mdump.c
index 9d597a9436..297ab6db0e 100644
--- a/cpukit/libmisc/shell/main_mdump.c
+++ b/cpukit/libmisc/shell/main_mdump.c
@@ -31,34 +31,30 @@ int rtems_shell_main_mdump(
char *argv[]
)
{
- unsigned long tmp;
unsigned char n;
unsigned char m;
int max;
int res;
- uintptr_t addr = 0;
+ void *addr = NULL;
unsigned char *pb;
if (argc > 1) {
- if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+ if ( rtems_string_to_pointer(argv[1], &addr, NULL) ) {
printf( "Address argument (%s) is not a number\n", argv[1] );
return -1;
}
- addr = (uintptr_t) tmp;
}
- if (argc>2) {
- if ( !rtems_string_to_int(argv[1], &max, NULL, 0) ) {
+ if (argc > 2) {
+ if ( rtems_string_to_int(argv[1], &max, NULL, 0) ) {
printf( "Length argument (%s) is not a number\n", argv[1] );
return -1;
}
- addr = (uintptr_t) tmp;
if (max <= 0) {
max = 1; /* print 1 item if 0 or neg. */
res = 0;
- }
- else {
+ } else {
max--;
res = max & 0xf;/* num bytes in last row */
max >>= 4; /* div by 16 */
@@ -68,14 +64,13 @@ int rtems_shell_main_mdump(
res = 0xf; /* 16 bytes print in last row */
}
}
- }
- else {
+ } else {
max = 20;
res = 0xf;
}
+ pb = addr;
for (m=0; m<max; m++) {
- pb = (unsigned char*) addr;
printf("%10p ", pb);
for (n=0;n<=(m==(max-1)?res:0xf);n++)
printf("%02X%c",pb[n],n==7?'-':' ');
@@ -85,7 +80,7 @@ int rtems_shell_main_mdump(
printf("%c", isprint(pb[n]) ? pb[n] : '.');
}
printf("\n");
- addr += 16;
+ pb += 16;
}
return 0;
}