comparison src/text/gftp-text.c @ 204:9b2de8d3fafe

2003-6-25 Brian Masney <masneyb@gftp.org> * lib/misc.c (expand_path) - small improvements * lib/rfc2068.c src/text/gftp-gtk.c - fixes for path handling, namely when changing directories to the parent (..)
author masneyb
date Thu, 26 Jun 2003 02:14:24 +0000
parents 95e669973a84
children cf4098008615
comparison
equal deleted inserted replaced
203:95e669973a84 204:9b2de8d3fafe
420 420
421 421
422 int 422 int
423 gftp_text_cd (gftp_request * request, char *command, gpointer *data) 423 gftp_text_cd (gftp_request * request, char *command, gpointer *data)
424 { 424 {
425 char *newdir = NULL; 425 char *tempstr, *newdir = NULL;
426 426
427 if (!GFTP_IS_CONNECTED (request)) 427 if (!GFTP_IS_CONNECTED (request))
428 { 428 {
429 gftp_text_log (gftp_logging_error, request, 429 gftp_text_log (gftp_logging_error, request,
430 _("Error: Not connected to a remote site\n")); 430 _("Error: Not connected to a remote site\n"));
433 else if (*command == '\0') 433 else if (*command == '\0')
434 { 434 {
435 gftp_text_log (gftp_logging_error, request, 435 gftp_text_log (gftp_logging_error, request,
436 _("usage: chdir <directory>\n")); 436 _("usage: chdir <directory>\n"));
437 return (1); 437 return (1);
438 }
439 else if (request->protonum == GFTP_LOCAL_NUM)
440 {
441 if (*command != '/')
442 {
443 tempstr = g_strconcat (request->directory, "/", command, NULL);
444 newdir = expand_path (tempstr);
445 g_free (tempstr);
446 }
447 else
448 newdir = expand_path (command);
449
450 if (newdir == NULL)
451 {
452 gftp_text_log (gftp_logging_error, request,
453 _("usage: chdir <directory>\n"));
454 return (1);
455 }
438 } 456 }
439 457
440 gftp_set_directory (request, newdir != NULL ? newdir : command); 458 gftp_set_directory (request, newdir != NULL ? newdir : command);
441 459
442 if (newdir != NULL) 460 if (newdir != NULL)