diff options
author | 2007-10-27 04:42:32 +1000 | |
---|---|---|
committer | 2007-10-27 04:42:32 +1000 | |
commit | 2160777d2f26a7e00c3dc003bf52bf9d40d885c7 (patch) | |
tree | 635d559912cba3dec7f00dd7e0e364e54300df79 /parser.c | |
parent | a97faaf664264a356e592118ec99cc26ce4c0e47 (diff) |
Implement non-clobbering file io. Use the >? operator for this for now.
darcs-hash:20071026184232-75c98-11edcbc7548c8ad3a2d4b648cb7ae18067569f02.gz
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1462,6 +1462,7 @@ static void parse_job_argument_list( process_t *p, case TOK_REDIRECT_IN: case TOK_REDIRECT_APPEND: case TOK_REDIRECT_FD: + case TOK_REDIRECT_NOCLOB: { int type = tok_last_type( tok ); io_data_t *new_io; @@ -1557,6 +1558,12 @@ static void parse_job_argument_list( process_t *p, new_io->param1.filename = target; break; + case TOK_REDIRECT_NOCLOB: + new_io->io_mode = IO_FILE; + new_io->param2.flags = O_CREAT | O_EXCL | O_WRONLY; + new_io->param1.filename = target; + break; + case TOK_REDIRECT_IN: new_io->io_mode = IO_FILE; new_io->param2.flags = O_RDONLY; @@ -2121,6 +2128,7 @@ static int parse_job( process_t *p, break; case TOK_REDIRECT_OUT: + case TOK_REDIRECT_NOCLOB: case TOK_REDIRECT_APPEND: case TOK_REDIRECT_IN: case TOK_REDIRECT_FD: @@ -3324,6 +3332,7 @@ int parser_test( const wchar_t * buff, case TOK_REDIRECT_IN: case TOK_REDIRECT_APPEND: case TOK_REDIRECT_FD: + case TOK_REDIRECT_NOCLOB: { if( !had_cmd ) { |