From 43eb597b77c05c06f9847ed01de032f5c18789fc Mon Sep 17 00:00:00 2001 From: axel Date: Sat, 15 Oct 2005 20:12:19 +1000 Subject: [PATCH] Use N>| instead of N| for generic pipe redirection darcs-hash:20051015101219-ac50b-7175a9f6e419dbe6e0b5796a61a13c4183ecbf3f.gz --- tokenizer.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/tokenizer.c b/tokenizer.c index 6e4c6c928..42b2781a4 100644 --- a/tokenizer.c +++ b/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; }