diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/worker.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/worker.c b/src/worker.c index c73eb7e..17c7f5e 100644 --- a/src/worker.c +++ b/src/worker.c @@ -362,11 +362,26 @@ static char *expand_system_variables( const char *s ) fprintf( stderr, "ERROR: out of memory while substituting variables in '%s'\n", s ); state = ERROR; } - - if( state == ERROR ) { - return NULL; + + switch( state ) { + case COPYING: + // fine + break; + + case DOLLAR: + case OPEN_BRACE: + case VARIABLE: + fprintf( stderr, "ERROR: unterminated variable reference in '%s'\n", s ); + break; + + case CLOSE_BRACE: + fprintf( stderr, "ERROR: illegal state while parsing command '%s'\n", s ); + break; + + case ERROR: + return NULL; } - + return r; } |