Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: TMPSUFFIX [redux]
- X-seq: zsh-workers 39507
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: TMPSUFFIX [redux]
- Date: Thu, 29 Sep 2016 14:53:21 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version; bh=Z7fZiWZayhecwX7crbnmk2LPFuSbxV0WLl2Uud8cXn0=; b=mGq/+Q20Qvt42QrxOMphOkgiJjtbVZs92zWaNgj5V3Solpq/Z+H6G2k1iXVuMXJDiN 1Ldk7GfgEhoBXLFHJ0ZJyQrQTLYYpfUV5NqHaFV/CZqqpXfhhrQxPNyGE2R0ZM2iP/8Z iHe2ov1STdkk+irfRC3qmYZcnHtfOXsl5MESszCgYNDLYEpVn1/7Pr+NtwkVhFA7KGpp JpGkBAoV4AQlVBkIV0kucbXAGVGa0LwjGHIu0b7BQ+6ee7wbxzhcA7lNIzoUp+ch7YUk on57v/cxN4aOZGEj+dQoopSaX96KdjiQkOOp3cVettcev7aLQpD2XCynD+w6d8/GKbb0 amOg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This goes on top of 39470.
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 03625ce..c7d84b9 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1547,6 +1547,15 @@ A pathname prefix which the shell will use for all temporary files.
Note that this should include an initial part for the file name as
well as any directory names. The default is `tt(/tmp/zsh)'.
)
+vindex(TMPSUFFIX)
+item(tt(TMPSUFFIX))(
+A filename suffix which the shell will use for temporary files created
+by process substitutions (e.g., `tt(=LPAR()var(list)RPAR())').
+Note that the value should include a leading dot `tt(.)' if intended
+to be interpreted as a file extension. The default is not to append
+any suffix, thus this parameter should be assigned only when needed
+and then unset again.
+)
vindex(watch)
vindex(WATCH)
item(tt(watch) <S> <Z> (tt(WATCH) <S>))(
diff --git a/Src/exec.c b/Src/exec.c
index 04868bd..e253d7b 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4421,6 +4421,15 @@ getoutputfile(char *cmd, char **eptr)
if (!s)
child_unblock();
return NULL;
+ } else {
+ char *suffix = getsparam("TMPSUFFIX");
+ if (suffix && *suffix && !strstr(suffix, "/")) {
+ suffix = dyncat(nam, unmeta(suffix));
+ if (link(nam, suffix) == 0) {
+ addfilelist(nam, 0);
+ nam = ztrdup(suffix);
+ }
+ }
}
addfilelist(nam, 0);
Messages sorted by:
Reverse Date,
Date,
Thread,
Author