Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/ChangeLog	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -1,2 +1,15 @@
+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.
+
 2009-07-22	Joel Sherrill <joel.sherrill@OARcorp.com>
 
Index: cpukit/libmisc/Makefile.am
===================================================================
--- cpukit/libmisc/Makefile.am	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/Makefile.am	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -132,4 +132,5 @@
 libstringto_a_SOURCES = stringto/stringtodouble.c stringto/stringtofloat.c \
     stringto/stringtoint.c stringto/stringtolong.c stringto/stringtolonglong.c \
+    stringto/stringtopointer.c stringto/stringtounsignedint.c \
     stringto/stringtounsignedchar.c stringto/stringtounsignedint.c \
     stringto/stringtounsignedlong.c stringto/stringtounsignedlonglong.c
Index: cpukit/libmisc/shell/main_chmod.c
===================================================================
--- cpukit/libmisc/shell/main_chmod.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_chmod.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -46,5 +46,5 @@
    *  Convert arguments into numbers
    */
-  if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
     printf( "Mode argument (%s) is not a number\n", argv[1] );
     return -1;
Index: cpukit/libmisc/shell/main_mdump.c
===================================================================
--- cpukit/libmisc/shell/main_mdump.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_mdump.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -32,32 +32,28 @@
 )
 {
-  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 */
@@ -69,12 +65,11 @@
       }
     }
-  }
-  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++)
@@ -86,5 +81,5 @@
     }
     printf("\n");
-    addr += 16;
+    pb += 16;
   }
   return 0;
Index: cpukit/libmisc/shell/main_medit.c
===================================================================
--- cpukit/libmisc/shell/main_medit.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_medit.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -33,6 +33,6 @@
 )
 {
-  unsigned long  tmp;
   unsigned char *pb;
+  void          *tmpp;
   int            n;
   int            i;
@@ -46,9 +46,9 @@
    *  Convert arguments into numbers
    */
-  if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_pointer(argv[1], &tmpp, NULL) ) {
     printf( "Address argument (%s) is not a number\n", argv[1] );
     return -1;
   }
-  pb = (unsigned char *) tmp;
+  pb = tmpp;
 
   /*
@@ -59,5 +59,5 @@
     unsigned char tmpc;
 
-    if ( !rtems_string_to_unsigned_char(argv[i], &tmpc, NULL, 0) ) {
+    if ( rtems_string_to_unsigned_char(argv[i], &tmpc, NULL, 0) ) {
       printf( "Value (%s) is not a number\n", argv[i] );
       continue;
Index: cpukit/libmisc/shell/main_mfill.c
===================================================================
--- cpukit/libmisc/shell/main_mfill.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_mfill.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -31,8 +31,8 @@
 )
 {
-  unsigned long tmp;
-  uintptr_t     addr;
-  size_t        size;
-  unsigned char value;
+  unsigned long  tmp;
+  void          *addr;
+  size_t         size;
+  unsigned char  value;
 
   if ( argc != 4 ) {
@@ -44,11 +44,10 @@
    *  Convert arguments into numbers
    */
-  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 ( !rtems_string_to_unsigned_long(argv[2], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_unsigned_long(argv[2], &tmp, NULL, 0) ) {
     printf( "Size argument (%s) is not a number\n", argv[2] );
     return -1;
@@ -56,5 +55,5 @@
   size = (size_t) tmp;
 
-  if ( !rtems_string_to_unsigned_char(argv[3], &value, NULL, 0) ) {
+  if ( rtems_string_to_unsigned_char(argv[3], &value, NULL, 0) ) {
     printf( "Value argument (%s) is not a number\n", argv[3] );
     return -1;
@@ -64,5 +63,5 @@
    *  Now fill the memory.
    */
-  memset((unsigned char*)addr, size, value);
+  memset(addr, size, value);
 
   return 0;
Index: cpukit/libmisc/shell/main_mmove.c
===================================================================
--- cpukit/libmisc/shell/main_mmove.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_mmove.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -33,8 +33,8 @@
 )
 {
-  unsigned long tmp;
-  uintptr_t     src;
-  uintptr_t     dst;
-  size_t        length;
+  unsigned long  tmp;
+  void          *src;
+  void          *dst;
+  size_t         length;
 
   if ( argc < 4 ) {
@@ -46,17 +46,15 @@
    *  Convert arguments into numbers
    */
-  if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_pointer(argv[1], &dst, NULL) ) {
     printf( "Destination argument (%s) is not a number\n", argv[1] );
     return -1;
   }
-  dst = (uintptr_t) tmp;
 
-  if ( !rtems_string_to_unsigned_long(argv[2], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_pointer(argv[2], &src, NULL) ) {
     printf( "Source argument (%s) is not a number\n", argv[2] );
     return -1;
   }
-  src = (uintptr_t) tmp;
 
-  if ( !rtems_string_to_unsigned_long(argv[3], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_unsigned_long(argv[3], &tmp, NULL, 0) ) {
     printf( "Length argument (%s) is not a number\n", argv[3] );
     return -1;
@@ -67,5 +65,5 @@
    *  Now copy the memory.
    */
-  memcpy((unsigned char*)dst, (unsigned char*)src, length);
+  memcpy(dst, src, length);
 
  return 0;
Index: cpukit/libmisc/shell/main_msdosfmt.c
===================================================================
--- cpukit/libmisc/shell/main_msdosfmt.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_msdosfmt.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -65,5 +65,5 @@
           }
 
-          if ( !rtems_string_to_unsigned_long(argv[arg], &tmp, NULL, 0) ) {
+          if ( rtems_string_to_unsigned_long(argv[arg], &tmp, NULL, 0) ) {
             printf(
               "sector per cluster argument (%s) is not a number\n",
@@ -83,5 +83,5 @@
           }
 
-          if ( !rtems_string_to_unsigned_long(argv[arg], &tmp, NULL, 0) ) {
+          if ( rtems_string_to_unsigned_long(argv[arg], &tmp, NULL, 0) ) {
             printf(
               "root directory size argument (%s) is not a number\n",
Index: cpukit/libmisc/shell/main_mwdump.c
===================================================================
--- cpukit/libmisc/shell/main_mwdump.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_mwdump.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -32,22 +32,20 @@
 )
 {
-  unsigned long  tmp;
   unsigned char  n;
   unsigned char  m;
   int            max;
   int            res;
-  uintptr_t      addr = 0;
+  void          *addr = 0;
   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[2], &max, NULL, 0) ) {
+    if ( rtems_string_to_int(argv[2], &max, NULL, 0) ) {
       printf( "Address argument (%s) is not a number\n", argv[1] );
       return -1;
@@ -72,6 +70,6 @@
   }
 
+  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+=2)
@@ -83,5 +81,5 @@
     }
     printf("\n");
-    addr += 16;
+    pb += 16;
   }
   return 0;
Index: cpukit/libmisc/shell/main_sleep.c
===================================================================
--- cpukit/libmisc/shell/main_sleep.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_sleep.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -40,5 +40,5 @@
    *  Convert the seconds argument to a number
    */
-  if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+  if ( rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
     printf( "Seconds argument (%s) is not a number\n", argv[1] );
     return -1;
@@ -51,5 +51,5 @@
   delay.tv_nsec = 0;
   if (argc == 3) {
-    if ( !rtems_string_to_unsigned_long(argv[2], &tmp, NULL, 0) ) {
+    if ( rtems_string_to_unsigned_long(argv[2], &tmp, NULL, 0) ) {
       printf( "Seconds argument (%s) is not a number\n", argv[1] );
       return -1;
Index: cpukit/libmisc/shell/main_umask.c
===================================================================
--- cpukit/libmisc/shell/main_umask.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/main_umask.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -38,5 +38,5 @@
 
   if (argc == 2) {
-    if ( !rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
+    if ( rtems_string_to_unsigned_long(argv[1], &tmp, NULL, 0) ) {
       printf( "Mask argument (%s) is not a number\n", argv[1] );
       return -1;
Index: cpukit/libmisc/shell/shell_script.c
===================================================================
--- cpukit/libmisc/shell/shell_script.c	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/shell/shell_script.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -130,5 +130,5 @@
         const char *s = getopt_reent.optarg;
 
-	if ( !rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
+	if ( rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
 	  printf( "Task Priority argument (%s) is not a number\n", s );
 	  return -1;
@@ -140,5 +140,5 @@
         const char *s = getopt_reent.optarg;
 
-	if ( !rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
+	if ( rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
 	  printf( "Stack size argument (%s) is not a number\n", s );
 	  return -1;
Index: cpukit/libmisc/stringto/stringto.h
===================================================================
--- cpukit/libmisc/stringto/stringto.h	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/stringto/stringto.h	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -13,4 +13,26 @@
 #define __STRING_TO_A_TYPE_h__
 
+#include <rtems.h>
+
+/**
+ *  @brief Convert String to Pointer (with validation)
+ *
+ *  This method converts a string to a pointer (void *) with
+ *  basic numeric validation.
+ *
+ *  @param[in] s is the string to convert
+ *  @param[in] n points to the variable to place the converted output in
+ *  @param[in] endptr is used to keep track of the position in the string
+ *
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_pointer(
+  const char     *s,
+  void          **n,
+  char          **endptr
+);
+
 /**
  *  @brief Convert String to Unsigned Character (with validation)
@@ -24,8 +46,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_unsigned_char(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_unsigned_char(
   const char     *s,
   unsigned char  *n,
@@ -44,8 +67,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_int(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_int(
   const char  *s,
   int         *n,
@@ -65,8 +89,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_long(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_long(
   const char  *s,
   long        *n,
@@ -86,8 +111,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_unsigned_long(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_unsigned_long(
   const char     *s,
   unsigned long  *n,
@@ -107,8 +133,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_long_long(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_long_long(
   const char  *s,
   long long   *n,
@@ -128,8 +155,9 @@
  *  @param[in] base is the expected base of the number
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_unsigned_long_long(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_unsigned_long_long(
   const char           *s,
   unsigned long long   *n,
@@ -147,8 +175,9 @@
  *  @param[in] endptr is used to keep track of the position in the string
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_float(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_float(
   const char   *s,
   float        *n,
@@ -165,8 +194,9 @@
  *  @param[in] endptr is used to keep track of the position in the string
  *
- *  @return This method returns true on successful conversion and *n is
- *          filled in.
- */
-bool rtems_string_to_double(
+ *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ *          and *n is filled in.  Otherwise, the status indicates the
+ *          source of the error.
+ */
+rtems_status_code rtems_string_to_double(
   const char   *s,
   double       *n,
Index: cpukit/libmisc/stringto/stringto_template.h
===================================================================
--- cpukit/libmisc/stringto/stringto_template.h	(revision 73dfaf83a11177c1b5c7740acae406d226a02bae)
+++ cpukit/libmisc/stringto/stringto_template.h	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -10,4 +10,6 @@
  */
 
+#include <rtems/stringto.h>
+
 #include <errno.h>
 #include <stdlib.h>
@@ -15,5 +17,12 @@
 #include <stdbool.h>
 
-#include <math.h>
+/*
+ *  If we are doing floating point conversion, then we need math.h
+ */
+#if defined(STRING_TO_FLOAT)
+  #include <math.h>
+#endif
+
+#include <rtems.h>
 
 /*
@@ -21,4 +30,8 @@
  * it and should NOT be protected against multiple inclusions.
  */
+
+#if defined(STRING_TO_POINTER)
+  #define STRING_TO_INTEGER
+#endif
 
 #if !defined(STRING_TO_FLOAT) && !defined(STRING_TO_INTEGER)
@@ -53,9 +66,13 @@
 #endif
 
-bool STRING_TO_NAME (
+#if !defined(STRING_TO_INPUT_TYPE)
+  #define STRING_TO_INPUT_TYPE STRING_TO_TYPE
+#endif
+
+rtems_status_code STRING_TO_NAME (
   const char      *s,
   STRING_TO_TYPE  *n,
   char           **endptr
-  #if defined(STRING_TO_INTEGER)
+  #if defined(STRING_TO_INTEGER) && !defined(STRING_TO_POINTER)
     ,
     int              base
@@ -63,9 +80,9 @@
 )
 {
-  STRING_TO_TYPE  result;
-  char           *end;
+  STRING_TO_INPUT_TYPE  result;
+  char                 *end;
 
   if ( !n )
-    return false;
+    return RTEMS_INVALID_ADDRESS;
 
   errno = 0;
@@ -74,4 +91,6 @@
   #ifdef STRING_TO_FLOAT
     result = STRING_TO_METHOD( s, &end );
+  #elif defined(STRING_TO_POINTER)
+    result = STRING_TO_METHOD( s, &end, 16 );
   #elif defined(STRING_TO_INTEGER)
     result = STRING_TO_METHOD( s, &end, base );
@@ -84,14 +103,14 @@
   /* nothing was converted */
   if ( end == s )
-    return false;
+    return RTEMS_NOT_DEFINED;
 
   /* there was a conversion error */
   if ( (result == ZERO) && errno )
-    return false;
+    return RTEMS_INVALID_NUMBER;
 
   #ifdef STRING_TO_MAX
     /* there was an overflow */
     if ( (result == STRING_TO_MAX) && (errno == ERANGE))
-      return false;
+      return RTEMS_INVALID_NUMBER;
   #endif
 
@@ -99,9 +118,9 @@
     /* there was an underflow */
     if ( (result == STRING_TO_MIN) && (errno == ERANGE))
-      return false;
+      return RTEMS_INVALID_NUMBER;
   #endif
 
   *n = (STRING_TO_TYPE) result;
-  return true;
+  return RTEMS_SUCCESSFUL;
 }
 
Index: cpukit/libmisc/stringto/stringtopointer.c
===================================================================
--- cpukit/libmisc/stringto/stringtopointer.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
+++ cpukit/libmisc/stringto/stringtopointer.c	(revision 48751ab095bbbb23489c2e3243f57571cbfa9153)
@@ -0,0 +1,25 @@
+/*
+ *  COPYRIGHT (c) 2009.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+/*
+ *  Instantiate an error checking wrapper for strtoul which is
+ *  used to input a (void *)
+ *
+ *  NOTE: This is only an appropriate implementation when unsigned long
+ *        can represent a void *
+ */
+#define STRING_TO_POINTER
+#define STRING_TO_TYPE void *
+#define STRING_TO_INPUT_TYPE unsigned long
+#define STRING_TO_NAME rtems_string_to_pointer
+#define STRING_TO_METHOD strtoul
+#define STRING_TO_MAX ULONG_MAX
+#include "stringto_template.h"
