File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,7 @@ static void output_prompt(void)
500500static void extract_args (char * src )
501501 {
502502 char * dest , * saved_src = src ;
503+ int quoting = 0 ;
503504
504505 // scout ahead to see if there are really any arguments
505506 while (* src == ' ' || * src == '\t' )
@@ -522,8 +523,10 @@ static void extract_args(char *src)
522523 while (* src == ' ' || * src == '\t' )
523524 src ++ ;
524525 dest = cmd_arg ;
525- while (* src != ' ' && * src != '\t' && * src != '\0' )
526+ while ((( * src != ' ' && * src != '\t' ) || quoting ) && * src != '\0' )
526527 {
528+ if (* src == '\"' )
529+ quoting ^= 1 ;
527530 * dest = * src ;
528531 dest ++ ;
529532 src ++ ;
@@ -1988,15 +1991,21 @@ static void perform_cd(const char *arg)
19881991 {
19891992 unsigned cur_drive , dummy ;
19901993 int rc ;
1994+ char arg1 [MAX_CMD_BUFLEN ];
1995+ char * p ;
19911996
19921997 if (arg [1 ] == ':' )
19931998 getdrive (& cur_drive );
1994- rc = chdir (arg );
1995- if (arg [1 ] == ':' && toupper (arg [0 ]) != 'A' + cur_drive - 1 )
1999+ strcpy (arg1 , arg );
2000+ /* unquote */
2001+ while ((p = strchr (arg1 , '\"' )))
2002+ memmove (p , p + 1 , strlen (p + 1 ) + 1 );
2003+ rc = chdir (arg1 );
2004+ if (arg1 [1 ] == ':' && toupper (arg1 [0 ]) != 'A' + cur_drive - 1 )
19962005 setdrive (cur_drive , & dummy );
19972006 if (rc != 0 )
19982007 {
1999- cprintf ("Directory does not exist - %s\r\n" ,arg );
2008+ cprintf ("Directory does not exist - %s\r\n" ,arg1 );
20002009 error_level = 1 ;
20012010 return ;
20022011 }
You can’t perform that action at this time.
0 commit comments