mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-23 21:31:14 -03:00
Use N>| instead of N| for generic pipe redirection
darcs-hash:20051015101219-ac50b-7175a9f6e419dbe6e0b5796a61a13c4183ecbf3f.gz
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user