2009-07-22 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.h, libmisc/shell/shell_script.c,
	libmisc/stringto/stringto_template.h: Convert all shell code to use
	stringto.h mehods with better error checking.
	* libmisc/shell/str2int.c: Removed.
This commit is contained in:
Joel Sherrill
2009-07-22 15:17:37 +00:00
parent e8d59ca6af
commit 35d09baa84
15 changed files with 252 additions and 184 deletions

View File

@@ -30,6 +30,7 @@
#include <rtems.h>
#include <rtems/shell.h>
#include <rtems/stringto.h>
#include "internal.h"
static void rtems_shell_joel_usage(void)
@@ -107,6 +108,7 @@ int rtems_shell_main_joel(
char **argv
)
{
unsigned long tmp;
int option;
int sc;
int verbose = 0;
@@ -124,13 +126,26 @@ int rtems_shell_main_joel(
case 'o':
outputFile = getopt_reent.optarg;
break;
case 'p':
taskPriority =
(rtems_task_priority) rtems_shell_str2int(getopt_reent.optarg);
case 'p': {
const char *s = getopt_reent.optarg;
if ( !rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
printf( "Task Priority argument (%s) is not a number\n", s );
return -1;
}
taskPriority = (rtems_task_priority) tmp;
break;
case 's':
stackSize = (uint32_t) rtems_shell_str2int(getopt_reent.optarg);
}
case 's': {
const char *s = getopt_reent.optarg;
if ( !rtems_string_to_unsigned_long( s, &tmp, NULL, 0) ) {
printf( "Stack size argument (%s) is not a number\n", s );
return -1;
}
stackSize = (uint32_t) tmp;
break;
}
case 't':
taskName = getopt_reent.optarg;
break;