Ticket #2120: command.c.diff
File command.c.diff, 1.8 KB (added by alexander.stohr, 14 years ago) |
---|
-
command.c
old new 302 302 do_cd_command (char *orig_cmd) 303 303 { 304 304 int len; 305 int operand_pos = 3; 305 306 const char *cmd; 306 307 307 308 /* Any final whitespace should be removed here … … 319 320 320 321 cmd = orig_cmd; 321 322 if (cmd[2] == 0) 322 cmd = "cd "; 323 cmd = "cd "; /* 0..2 => given text, 3 => \0 */ 324 325 /* allow any amount of white space in front of the path operand */ 326 while (cmd[operand_pos] == ' ' || cmd[operand_pos] == '\t') 327 operand_pos++; 323 328 324 329 if (get_current_type () == view_tree) 325 330 { … … 327 332 { 328 333 sync_tree (mc_config_get_home_dir ()); 329 334 } 330 else if (strcmp (cmd + 3, "..") == 0)335 else if (strcmp (cmd + operand_pos, "..") == 0) 331 336 { 332 337 char *dir = current_panel->cwd; 333 338 len = strlen (dir); … … 338 343 else 339 344 sync_tree (PATH_SEP_STR); 340 345 } 341 else if (cmd[ 3] == PATH_SEP)346 else if (cmd[operand_pos] == PATH_SEP) 342 347 { 343 sync_tree (cmd + 3);348 sync_tree (cmd + operand_pos); 344 349 } 345 350 else 346 351 { 347 352 char *old = current_panel->cwd; 348 353 char *new; 349 new = concat_dir_and_file (old, cmd + 3);354 new = concat_dir_and_file (old, cmd + operand_pos); 350 355 sync_tree (new); 351 356 g_free (new); 352 357 } 353 358 } 354 else if (!examine_cd (&cmd[ 3]))359 else if (!examine_cd (&cmd[operand_pos])) 355 360 { 356 char *d = strip_password (g_strdup (&cmd[ 3]), 1);361 char *d = strip_password (g_strdup (&cmd[operand_pos]), 1); 357 362 message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"), d, unix_error_string (errno)); 358 363 g_free (d); 359 364 return;