From 610a0f5c6ef56e6084ff62aef5ebba28b4a54812 Mon Sep 17 00:00:00 2001 From: "Rustem Gimadutdinov (rgimad)" Date: Fri, 17 Apr 2020 21:43:55 +0000 Subject: [PATCH] fixed bug with cd ../ fixed cd . and cd ./ behavior git-svn-id: svn://kolibrios.org@7805 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/shell/cmd/cmd_cd.c | 6 +++--- programs/system/shell/globals.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/programs/system/shell/cmd/cmd_cd.c b/programs/system/shell/cmd/cmd_cd.c index 9fed95e904..7a1fcde5bc 100644 --- a/programs/system/shell/cmd/cmd_cd.c +++ b/programs/system/shell/cmd/cmd_cd.c @@ -16,10 +16,10 @@ if (NULL == dir) return TRUE; } -if ( 0 == strcmp(dir, ".") ) - return FALSE; +if ( 0 == strcmp(dir, ".") || 0 == strcmp(dir, "./") ) + return TRUE; -if ( ( 0 == strcmp(dir, "..") ) && ( 0 != strcmp(cur_dir, "/")) ) +if ( ( 0 == strcmp(dir, "..") || 0 == strcmp(dir, "../") ) && ( 0 != strcmp(cur_dir, "/")) ) { cur_dir[strlen(cur_dir)-1]='\0'; dir_truncate(cur_dir); diff --git a/programs/system/shell/globals.h b/programs/system/shell/globals.h index b27c30316d..35c7f23dae 100644 --- a/programs/system/shell/globals.h +++ b/programs/system/shell/globals.h @@ -1,5 +1,5 @@ -#define SHELL_VERSION "0.8" +#define SHELL_VERSION "0.8a" extern char PATH[256]; extern char PARAM[256];