aboutsummaryrefslogtreecommitdiffhomepage
path: root/tokenizer.c
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2007-10-27 04:42:32 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2007-10-27 04:42:32 +1000
commit2160777d2f26a7e00c3dc003bf52bf9d40d885c7 (patch)
tree635d559912cba3dec7f00dd7e0e364e54300df79 /tokenizer.c
parenta97faaf664264a356e592118ec99cc26ce4c0e47 (diff)
Implement non-clobbering file io. Use the >? operator for this for now.
darcs-hash:20071026184232-75c98-11edcbc7548c8ad3a2d4b648cb7ae18067569f02.gz
Diffstat (limited to 'tokenizer.c')
-rw-r--r--tokenizer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tokenizer.c b/tokenizer.c
index 0551bb17..edefc070 100644
--- a/tokenizer.c
+++ b/tokenizer.c
@@ -69,6 +69,7 @@ static const wchar_t *tok_desc[] =
N_( L"Append output to file" ),
N_( L"Redirect input to file" ),
N_( L"Redirect to file descriptor" ),
+ N_( L"Redirect output to file if file does not exist" ),
N_( L"Run job in background" ),
N_( L"Comment" )
}
@@ -473,6 +474,11 @@ static void read_redirect( tokenizer *tok, int fd )
tok->buff++;
tok->last_type = TOK_REDIRECT_FD;
}
+ else if( *tok->buff == L'?' )
+ {
+ tok->buff++;
+ tok->last_type = TOK_REDIRECT_NOCLOB;
+ }
else
{
tok->last_type = TOK_REDIRECT_OUT + mode;