Improve error message for attempts to use Posix variable assignments

darcs-hash:20060719232020-ac50b-1564ffffc2e119e90d711605247637e7aac9da96.gz
This commit is contained in:
axel 2006-07-20 09:20:20 +10:00
parent 40ed01f6f2
commit f36811b7be

View file

@ -140,7 +140,7 @@ The fish parser. Contains functions for parsing code.
/** /**
Error message for Posix-style assignment Error message for Posix-style assignment
*/ */
#define COMMAND_ASSIGN_ERR_MSG _( L"Unknown command '%ls'. Did you mean 'set VARIABLE VALUE'? For information on setting variable values, see the help section on the set command by typing 'help set'.") #define COMMAND_ASSIGN_ERR_MSG _( L"Unknown command '%ls'. Did you mean 'set %ls %ls'? For information on assigning values to variables, see the help section on the set command by typing 'help set'.")
/** /**
Error for invalid redirection token Error for invalid redirection token
@ -2161,7 +2161,7 @@ static int parse_job( process_t *p,
wchar_t *cmd = (wchar_t *)al_get( args, 0 ); wchar_t *cmd = (wchar_t *)al_get( args, 0 );
/* /*
We couln't find the specified command. We couldn't find the specified command.
What we want to happen now is that the What we want to happen now is that the
specified job won't get executed, and an specified job won't get executed, and an
@ -2176,9 +2176,16 @@ static int parse_job( process_t *p,
*/ */
if( wcschr( cmd, L'=' ) ) if( wcschr( cmd, L'=' ) )
{ {
wchar_t *cpy = halloc_wcsdup( j, cmd );
wchar_t *valpart = wcschr( cpy, L'=' );
*valpart++=0;
debug( 0, debug( 0,
COMMAND_ASSIGN_ERR_MSG, COMMAND_ASSIGN_ERR_MSG,
(wchar_t *)al_get( args, 0 ) ); cmd,
cpy,
valpart);
} }
else if(cmd[0]==L'$') else if(cmd[0]==L'$')
{ {