mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Tweak a few error messages for builtin commands
darcs-hash:20051216155116-ac50b-d31da6fc28ef9140f24fb0d95397daaffb3ff6ab.gz
This commit is contained in:
parent
9229041385
commit
78cd8fa089
1 changed files with 21 additions and 24 deletions
45
builtin.c
45
builtin.c
|
@ -1859,12 +1859,10 @@ static int builtin_cd( wchar_t **argv )
|
||||||
|
|
||||||
if( !dir )
|
if( !dir )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
L"%ls: is not a directory or you do not have permission to enter it\n",
|
||||||
L": ",
|
argv[0],
|
||||||
dir_in,
|
dir_in );
|
||||||
L" is not a directory or you do not have permission to enter it\n",
|
|
||||||
(void *)0 );
|
|
||||||
sb_append2( sb_err,
|
sb_append2( sb_err,
|
||||||
parser_current_line(),
|
parser_current_line(),
|
||||||
(void *)0 );
|
(void *)0 );
|
||||||
|
@ -1873,12 +1871,10 @@ static int builtin_cd( wchar_t **argv )
|
||||||
|
|
||||||
if( wchdir( dir ) != 0 )
|
if( wchdir( dir ) != 0 )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
L"%ls: '%ls' is not a directory\n",
|
||||||
L": ",
|
argv[0],
|
||||||
dir,
|
dir );
|
||||||
L" is not a directory\n",
|
|
||||||
(void *)0 );
|
|
||||||
sb_append2( sb_err,
|
sb_append2( sb_err,
|
||||||
parser_current_line(),
|
parser_current_line(),
|
||||||
(void *)0 );
|
(void *)0 );
|
||||||
|
@ -1891,7 +1887,7 @@ static int builtin_cd( wchar_t **argv )
|
||||||
if (!set_pwd(L"PWD"))
|
if (!set_pwd(L"PWD"))
|
||||||
{
|
{
|
||||||
res=1;
|
res=1;
|
||||||
sb_append( sb_err, L"Could not set PWD variable\n" );
|
sb_printf( sb_err, L"%ls: Could not set PWD variable\n", argv[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
free( dir );
|
free( dir );
|
||||||
|
@ -2102,10 +2098,9 @@ static int builtin_complete( wchar_t **argv )
|
||||||
|
|
||||||
if( woptind != argc )
|
if( woptind != argc )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err,
|
sb_printf( sb_err,
|
||||||
argv[0],
|
L"%ls: Too many arguments\n",
|
||||||
L": Too many arguments\n",
|
argv[0] );
|
||||||
(void *)0);
|
|
||||||
sb_append( sb_err,
|
sb_append( sb_err,
|
||||||
parser_current_line() );
|
parser_current_line() );
|
||||||
// builtin_print_help( argv[0], sb_err );
|
// builtin_print_help( argv[0], sb_err );
|
||||||
|
@ -2164,13 +2159,15 @@ static int builtin_source( wchar_t ** argv )
|
||||||
int fd;
|
int fd;
|
||||||
int res;
|
int res;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
int argc;
|
||||||
|
|
||||||
if( (argv[1] == 0) || (argv[2]!=0) )
|
argc = builtin_count_args( argv );
|
||||||
{
|
|
||||||
|
|
||||||
sb_append2( sb_err, argv[0], L": Expected exactly one argument\n", (void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
|
||||||
|
|
||||||
|
|
||||||
|
if( argc != 2 )
|
||||||
|
{
|
||||||
|
sb_printf( sb_err, L"%ls: Expected exactly one argument, gor %d\n", argv[0], argc );
|
||||||
|
builtin_print_help( argv[0], sb_err );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2182,9 +2179,9 @@ static int builtin_source( wchar_t ** argv )
|
||||||
|
|
||||||
if( !S_ISREG(buf.st_mode) )
|
if( !S_ISREG(buf.st_mode) )
|
||||||
{
|
{
|
||||||
sb_append2( sb_err, argv[0], L": Expected a regular file\n", (void *)0 );
|
sb_printf( sb_err, L"%ls: '%ls' is not a file\n", argv[0], argv[1] );
|
||||||
builtin_print_help( argv[0], sb_err );
|
builtin_print_help( argv[0], sb_err );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( ( fd = wopen( argv[1], O_RDONLY ) ) == -1 )
|
if( ( fd = wopen( argv[1], O_RDONLY ) ) == -1 )
|
||||||
|
|
Loading…
Reference in a new issue