diff options
author | 2008-01-09 13:06:47 +1000 | |
---|---|---|
committer | 2008-01-09 13:06:47 +1000 | |
commit | 605fffa9d2e1c746dd0729cc7193d38f7a7ff681 (patch) | |
tree | 3df556cfb7ce8d7a14ea7e6db9db4ad27be83321 | |
parent | 2229fad41025c32d6c79c9ce141c0ef4456fdae4 (diff) |
Make sure the help switch to the cd command is not flagged as an error
darcs-hash:20080109030647-75c98-f82822cde746d1c8a89512481347061cfeb41e43.gz
-rw-r--r-- | highlight.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/highlight.c b/highlight.c index 8a5f7512..21644daf 100644 --- a/highlight.c +++ b/highlight.c @@ -607,11 +607,14 @@ void highlight_shell( wchar_t * buff, if( cmd && (wcscmp( cmd, L"cd" ) == 0) ) { wchar_t *dir = expand_one( context, - wcsdup(tok_last( &tok )), - EXPAND_SKIP_CMDSUBST ); + wcsdup(tok_last( &tok )), + EXPAND_SKIP_CMDSUBST ); if( dir ) { - if( !path_get_cdpath( context, dir ) ) + int is_long_help = wcsncmp(dir,L"--help", wcslen(dir) ); + int is_short_help = wcsncmp(dir,L"-h", wcslen(dir) ); + + if( !is_long_help && !is_short_help && !path_get_cdpath( context, dir ) ) { color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR; } |