mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Make the read builtin accept 0 parameters and drop the input instead of showing an error message
darcs-hash:20060419100830-ac50b-50f96925481bb29ad840fb12240ef9b9b86d18c4.gz
This commit is contained in:
parent
1947ec88f1
commit
76bafbef2a
1 changed files with 19 additions and 28 deletions
45
builtin.c
45
builtin.c
|
@ -1468,20 +1468,6 @@ static int builtin_read( wchar_t **argv )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( woptind == argc )
|
|
||||||
{
|
|
||||||
sb_printf( sb_err,
|
|
||||||
BUILTIN_ERR_MISSING,
|
|
||||||
argv[0] );
|
|
||||||
|
|
||||||
sb_append2( sb_err,
|
|
||||||
parser_current_line(),
|
|
||||||
L"\n",
|
|
||||||
(void *)0 );
|
|
||||||
builtin_print_help( argv[0], sb_err );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Verify all variable names
|
Verify all variable names
|
||||||
*/
|
*/
|
||||||
|
@ -1512,10 +1498,6 @@ static int builtin_read( wchar_t **argv )
|
||||||
*/
|
*/
|
||||||
i=woptind;
|
i=woptind;
|
||||||
|
|
||||||
ifs = env_get( L"IFS" );
|
|
||||||
if( ifs == 0 )
|
|
||||||
ifs = L"";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check if we should read interactively using \c reader_readline()
|
Check if we should read interactively using \c reader_readline()
|
||||||
*/
|
*/
|
||||||
|
@ -1593,20 +1575,29 @@ static int builtin_read( wchar_t **argv )
|
||||||
sb_destroy( &sb );
|
sb_destroy( &sb );
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t *state;
|
if( i != argc )
|
||||||
|
|
||||||
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
|
|
||||||
|
|
||||||
while( i<argc )
|
|
||||||
{
|
{
|
||||||
env_set( argv[i], nxt != 0 ? nxt: L"", place );
|
|
||||||
|
|
||||||
i++;
|
wchar_t *state;
|
||||||
if( nxt != 0 )
|
|
||||||
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
|
ifs = env_get( L"IFS" );
|
||||||
|
if( ifs == 0 )
|
||||||
|
ifs = L"";
|
||||||
|
|
||||||
|
nxt = wcstok( buff, (i<argc-1)?ifs:L"", &state );
|
||||||
|
|
||||||
|
while( i<argc )
|
||||||
|
{
|
||||||
|
env_set( argv[i], nxt != 0 ? nxt: L"", place );
|
||||||
|
|
||||||
|
i++;
|
||||||
|
if( nxt != 0 )
|
||||||
|
nxt = wcstok( 0, (i<argc-1)?ifs:L"", &state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free( buff );
|
free( buff );
|
||||||
|
|
||||||
return exit_res;
|
return exit_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue