mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 07:21:14 -03:00
Implement non-clobbering file io. Use the >? operator for this for now.
darcs-hash:20071026184232-75c98-11edcbc7548c8ad3a2d4b648cb7ae18067569f02.gz
This commit is contained in:
12
highlight.c
12
highlight.c
@@ -757,6 +757,7 @@ void highlight_shell( wchar_t * buff,
|
||||
break;
|
||||
}
|
||||
|
||||
case TOK_REDIRECT_NOCLOB:
|
||||
case TOK_REDIRECT_OUT:
|
||||
case TOK_REDIRECT_IN:
|
||||
case TOK_REDIRECT_APPEND:
|
||||
@@ -825,7 +826,7 @@ void highlight_shell( wchar_t * buff,
|
||||
if it exists.
|
||||
*/
|
||||
if( last_type == TOK_REDIRECT_IN ||
|
||||
last_type == TOK_REDIRECT_APPEND )
|
||||
last_type == TOK_REDIRECT_APPEND )
|
||||
{
|
||||
if( wstat( target, &buff ) == -1 )
|
||||
{
|
||||
@@ -834,6 +835,15 @@ void highlight_shell( wchar_t * buff,
|
||||
al_push( error, wcsdupcat( L"File \'", target, L"\' does not exist" ) );
|
||||
}
|
||||
}
|
||||
if( last_type == TOK_REDIRECT_NOCLOB )
|
||||
{
|
||||
if( wstat( target, &buff ) != -1 )
|
||||
{
|
||||
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;
|
||||
if( error )
|
||||
al_push( error, wcsdupcat( L"File \'", target, L"\' exists" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user