mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Use N>| instead of N| for generic pipe redirection
darcs-hash:20051015101219-ac50b-7175a9f6e419dbe6e0b5796a61a13c4183ecbf3f.gz
This commit is contained in:
parent
9298f610f6
commit
43eb597b77
1 changed files with 16 additions and 17 deletions
33
tokenizer.c
33
tokenizer.c
|
@ -404,6 +404,20 @@ static void read_redirect( tokenizer *tok, int fd )
|
|||
{
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
if( *tok->buff == L'|' )
|
||||
{
|
||||
if( fd == 0 )
|
||||
{
|
||||
tok_error( tok, PIPE_ERROR );
|
||||
return;
|
||||
}
|
||||
check_size( tok, FD_STR_MAX_LEN );
|
||||
tok->buff++;
|
||||
swprintf( tok->last, FD_STR_MAX_LEN, L"%d", fd );
|
||||
tok->last_type = TOK_PIPE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if( *tok->buff == L'<' )
|
||||
{
|
||||
|
@ -536,8 +550,7 @@ void tok_next( tokenizer *tok )
|
|||
{
|
||||
|
||||
if( iswdigit( *tok->buff ) )
|
||||
{
|
||||
|
||||
{
|
||||
wchar_t *orig = tok->buff;
|
||||
int fd = 0;
|
||||
while( iswdigit( *tok->buff ) )
|
||||
|
@ -545,25 +558,11 @@ void tok_next( tokenizer *tok )
|
|||
|
||||
switch( *(tok->buff))
|
||||
{
|
||||
case L'|':
|
||||
{
|
||||
if( fd == 0 )
|
||||
{
|
||||
tok_error( tok, PIPE_ERROR );
|
||||
return;
|
||||
}
|
||||
check_size( tok, FD_STR_MAX_LEN );
|
||||
tok->buff++;
|
||||
swprintf( tok->last, FD_STR_MAX_LEN, L"%d", fd );
|
||||
tok->last_type = TOK_PIPE;
|
||||
return;
|
||||
}
|
||||
|
||||
case L'^':
|
||||
case L'>':
|
||||
case L'<':
|
||||
read_redirect( tok, fd );
|
||||
return;
|
||||
|
||||
}
|
||||
tok->buff = orig;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue