If PATH is unset, use a default value

darcs-hash:20060420183502-ac50b-8e746ae4ed00c354712cf61e57e0a187aa40a4fa.gz
This commit is contained in:
axel 2006-04-21 04:35:02 +10:00
parent c755bd0358
commit f59e4a88c6

View file

@ -194,7 +194,7 @@ The fish parser. Contains functions for parsing code.
/** /**
function definition block description Function definition block description
*/ */
#define FUNCTION_DEF_BLOCK _( L"function definition block" ) #define FUNCTION_DEF_BLOCK _( L"function definition block" )
@ -724,8 +724,18 @@ wchar_t *get_filename( const wchar_t *cmd )
else else
{ {
path = env_get(L"PATH"); path = env_get(L"PATH");
if( path != 0 ) if( path == 0 )
{ {
if( contains_str( PREFIX L"/bin", L"/bin", L"/usr/bin", (void *)0 ) )
{
path = L"/bin" ARRAY_SEP_STR L"/usr/bin";
}
else
{
path = L"/bin" ARRAY_SEP_STR L"/usr/bin" ARRAY_SEP_STR PREFIX L"/bin";
}
}
/* /*
Allocate string long enough to hold the whole command Allocate string long enough to hold the whole command
*/ */
@ -792,7 +802,7 @@ wchar_t *get_filename( const wchar_t *cmd )
} }
free( path_cpy ); free( path_cpy );
free( new_cmd ); free( new_cmd );
}
} }
return 0; return 0;
} }