From 6901ad361d5e8e96036e266a315b1dc45ba08bb0 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 20 Feb 2006 22:55:24 +1000 Subject: [PATCH] Make fish continue parsing/executing a file if a command is not found darcs-hash:20060220125524-ac50b-1f85e530cbbcb45988254c75cd45c11395c5cd27.gz --- parser.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/parser.c b/parser.c index b77b79f13..496ae1952 100644 --- a/parser.c +++ b/parser.c @@ -1940,29 +1940,51 @@ static int parse_job( process_t *p, } else { + int tmp; + + /* + We couln't find the specified command. + + What we want to happen now is that the + specified job won't get executed, and an + error message is printed on-screen, but + otherwise, the parsing/execution of the + file continues. Because of this, we don't + want to call error(), since that would stop + execution of the file. Instead we let + p->actual_command be 0 (null), which will + cause the job to silently not execute. We + also print an error message. + */ if( wcschr( (wchar_t *)al_get( args, 0 ), L'=' ) ) { - error( EVAL_ERROR, - tok_get_pos( tok ), + debug( 0, COMMAND_ASSIGN_ERR_MSG, (wchar_t *)al_get( args, 0 ) ); - + } else { - error( EVAL_ERROR, - tok_get_pos( tok ), + debug( 0, _(L"Unknown command '%ls'"), (wchar_t *)al_get( args, 0 ) ); - } + + tmp = current_tokenizer_pos; + current_tokenizer_pos = tok_get_pos(tok); + + fwprintf( stderr, L"%ls", parser_current_line() ); + + current_tokenizer_pos=tmp; + j->skip=1; + } } } } } - + if( is_new_block ) {