aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.cpp
diff options
context:
space:
mode:
authorGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-01-10 00:05:51 +0530
committerGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-01-10 00:05:51 +0530
commitfeed900f3dfe0345aa01649bf03a067b2fd13d75 (patch)
tree7eef0c5909bf372c06b384c505079e8ff8110f39 /builtin.cpp
parent7530057c6ee71a6a6611db1120b50d44130c12a2 (diff)
Further changes in builtin.cpp to use env_get_string()
Diffstat (limited to 'builtin.cpp')
-rw-r--r--builtin.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin.cpp b/builtin.cpp
index bbd9464c..339c1af8 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -2613,7 +2613,7 @@ static int builtin_exit( wchar_t **argv )
*/
static int builtin_cd( wchar_t **argv )
{
- wchar_t *dir_in;
+ wcstring dir_in;
wchar_t *dir;
int res=STATUS_BUILTIN_OK;
void *context = halloc( 0, 0 );
@@ -2621,8 +2621,8 @@ static int builtin_cd( wchar_t **argv )
if( argv[1] == 0 )
{
- dir_in = env_get( L"HOME" );
- if( !dir_in )
+ dir_in = env_get_string( L"HOME" );
+ if( dir_in.empty() )
{
sb_printf( sb_err,
_( L"%ls: Could not find home directory\n" ),
@@ -2632,7 +2632,7 @@ static int builtin_cd( wchar_t **argv )
else
dir_in = argv[1];
- dir = path_get_cdpath( context, dir_in );
+ dir = path_get_cdpath( context, dir_in.empty()?0:dir_in.c_str() );
if( !dir )
{
@@ -2641,21 +2641,21 @@ static int builtin_cd( wchar_t **argv )
sb_printf( sb_err,
_( L"%ls: '%ls' is not a directory\n" ),
argv[0],
- dir_in );
+ dir_in.c_str() );
}
else if( errno == ENOENT )
{
sb_printf( sb_err,
_( L"%ls: The directory '%ls' does not exist\n" ),
argv[0],
- dir_in );
+ dir_in.c_str() );
}
else if( errno == EROTTEN )
{
sb_printf( sb_err,
_( L"%ls: '%ls' is a rotten symlink\n" ),
argv[0],
- dir_in );
+ dir_in.c_str() );
}
else
@@ -2663,7 +2663,7 @@ static int builtin_cd( wchar_t **argv )
sb_printf( sb_err,
_( L"%ls: Unknown error trying to locate directory '%ls'\n" ),
argv[0],
- dir_in );
+ dir_in.c_str() );
}