mirror of
https://github.com/zsh-users/zsh
synced 2024-09-15 22:20:22 +00:00
35655: APPEND_CREATE option for POSIX copmatible NO_CLOBBER
This commit is contained in:
parent
7bc47c91e9
commit
7708849b21
|
@ -1,3 +1,9 @@
|
|||
2015-06-29 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 35655: Doc/Zsh/options.yo, Src/exec.c, Src/options.c,
|
||||
Src/zsh.h: APPEND_CREATE option gives POSIX compatible behaviour
|
||||
for NO_CLOBBER.
|
||||
|
||||
2015-06-28 Barton E. Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 35660: Functions/Prompts/prompt_adam1_setup: avoid perl, fix help
|
||||
|
|
|
@ -1094,10 +1094,12 @@ pindex(NOCLOBBER)
|
|||
cindex(clobbering, of files)
|
||||
cindex(file clobbering, allowing)
|
||||
item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)) <D>)(
|
||||
Allows `tt(>)' redirection to truncate existing files,
|
||||
and `tt(>>)' to create files.
|
||||
Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file,
|
||||
and `tt(>>!)' or `tt(>>|)' to create a file.
|
||||
Allows `tt(>)' redirection to truncate existing files.
|
||||
Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file.
|
||||
|
||||
If the option is not set, and the option tt(APPEND_CREATE) is also
|
||||
not set, `tt(>>!)' or `tt(>>|)' must be used to create a file.
|
||||
If either option is set, `tt(>>)' may be used.
|
||||
)
|
||||
pindex(CORRECT)
|
||||
pindex(NO_CORRECT)
|
||||
|
@ -1792,6 +1794,21 @@ enditem()
|
|||
|
||||
subsect(Shell Emulation)
|
||||
startitem()
|
||||
pindex(APPEND_CREATE
|
||||
pindex(NO_APPEND_CREATE)
|
||||
pindex(APPENDCREATE)
|
||||
pindex(NOAPPENDCREATE)
|
||||
cindex(clobbering, POSIX compatibility)
|
||||
cindex(file clobbering, POSIX compatibility)
|
||||
cindex(no clobber, POSIX compatible)
|
||||
item(tt(APPEND_CREATE) <K> <S>)(
|
||||
This option only applies when tt(NO_CLOBBER) (-tt(C)) is in effect.
|
||||
|
||||
If this option is not set, the shell will report an error when a
|
||||
append redirection (tt(>>)) is used on a file that does not already
|
||||
exists (the traditional zsh behaviour of tt(NO_CLOBBER)). If the option
|
||||
is set, no error is reported (POSIX behaviour).
|
||||
)
|
||||
pindex(BASH_REMATCH)
|
||||
pindex(NO_BASH_REMATCH)
|
||||
pindex(BASHREMATCH)
|
||||
|
|
|
@ -3315,7 +3315,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
|||
fil = -1;
|
||||
else if (IS_APPEND_REDIR(fn->type))
|
||||
fil = open(unmeta(fn->name),
|
||||
(unset(CLOBBER) && !IS_CLOBBER_REDIR(fn->type)) ?
|
||||
((unset(CLOBBER) && unset(APPENDCREATE)) &&
|
||||
!IS_CLOBBER_REDIR(fn->type)) ?
|
||||
O_WRONLY | O_APPEND | O_NOCTTY :
|
||||
O_WRONLY | O_APPEND | O_CREAT | O_NOCTTY, 0666);
|
||||
else
|
||||
|
|
|
@ -81,6 +81,7 @@ static struct optname optns[] = {
|
|||
{{NULL, "allexport", OPT_EMULATE}, ALLEXPORT},
|
||||
{{NULL, "alwayslastprompt", OPT_ALL}, ALWAYSLASTPROMPT},
|
||||
{{NULL, "alwaystoend", 0}, ALWAYSTOEND},
|
||||
{{NULL, "appendcreate", OPT_EMULATE|OPT_BOURNE}, APPENDCREATE},
|
||||
{{NULL, "appendhistory", OPT_ALL}, APPENDHISTORY},
|
||||
{{NULL, "autocd", OPT_EMULATE}, AUTOCD},
|
||||
{{NULL, "autocontinue", 0}, AUTOCONTINUE},
|
||||
|
|
Loading…
Reference in a new issue