forked from Imagelibrary/rtems
2010-03-11 Andrei Mozzhuhin <nopscmn@gmail.com>
PR 1496/shell * libmisc/shell/shell_makeargs.c: Add support for quoted arguments.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2010-03-11 Andrei Mozzhuhin <nopscmn@gmail.com>
|
||||||
|
|
||||||
|
PR 1496/shell
|
||||||
|
* libmisc/shell/shell_makeargs.c: Add support for quoted arguments.
|
||||||
|
|
||||||
2010-03-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2010-03-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* score/include/rtems/score/interr.h,
|
* score/include/rtems/score/interr.h,
|
||||||
|
|||||||
@@ -25,22 +25,38 @@ int rtems_shell_make_args(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int argc;
|
int argc;
|
||||||
char *command;
|
char *ch;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
argc = 0;
|
argc = 0;
|
||||||
command = commandLine;
|
ch = commandLine;
|
||||||
|
|
||||||
while ( 1 ) {
|
while ( *ch ) {
|
||||||
command = strtok( command, " \t\r\n" );
|
|
||||||
if ( command == NULL )
|
while ( isspace(*ch) ) ch++;
|
||||||
break;
|
|
||||||
argv_p[ argc++ ] = command;
|
if ( *ch == '\0' )
|
||||||
command = '\0';
|
|
||||||
if ( argc == (max_args-1) ) {
|
|
||||||
status = -1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if ( *ch == '"' ) {
|
||||||
|
argv_p[ argc++ ] = ++ch;
|
||||||
|
while ( ( *ch == '\0' ) && ( *ch != '"' ) ) ch++;
|
||||||
|
} else {
|
||||||
|
argv_p[ argc++ ] = ch;
|
||||||
|
while ( ( *ch == '\0' ) && ( !isspace(*ch) ) ) ch++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( *ch == '\0' )
|
||||||
|
break;
|
||||||
|
|
||||||
|
*ch++ = '\0';
|
||||||
|
|
||||||
|
if ( argc == (max_args-1) ) {
|
||||||
|
status = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
argv_p[ argc ] = NULL;
|
argv_p[ argc ] = NULL;
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
|
|||||||
Reference in New Issue
Block a user