zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Allow setting $0 when POSIX_ARGZERO is not set
@ 2015-06-15 23:44 Mikael Magnusson
  2015-06-16  3:50 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2015-06-15 23:44 UTC (permalink / raw)
  To: zsh-workers

I don't think this should hurt anything.

---
 Src/params.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Src/params.c b/Src/params.c
index 98541a6..3b75735 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -196,7 +196,7 @@ static const struct gsu_integer ttyidle_gsu =
 { ttyidlegetfn, nullintsetfn, stdunsetfn };
 
 static const struct gsu_scalar argzero_gsu =
-{ argzerogetfn, nullstrsetfn, nullunsetfn };
+{ argzerogetfn, argzerosetfn, nullunsetfn };
 static const struct gsu_scalar username_gsu =
 { usernamegetfn, usernamesetfn, stdunsetfn };
 static const struct gsu_scalar dash_gsu =
@@ -4044,6 +4044,21 @@ lcsetfn(Param pm, char *x)
 }
 #endif /* USE_LOCALE */
 
+/* Function to set value for special parameter `0' */
+
+/**/
+static void
+argzerosetfn(UNUSED(Param pm), char *x)
+{
+    if (x) {
+	if (!isset(POSIXARGZERO)) {
+	    zsfree(argzero);
+	    argzero = ztrdup(x);
+	}
+	zsfree(x);
+    }
+}
+
 /* Function to get value for special parameter `0' */
 
 /**/
-- 
2.4.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-17  0:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15 23:44 PATCH: Allow setting $0 when POSIX_ARGZERO is not set Mikael Magnusson
2015-06-16  3:50 ` Bart Schaefer
2015-06-16  6:25   ` Mikael Magnusson
2015-06-16 15:58     ` Bart Schaefer
2015-06-16 23:46       ` Mikael Magnusson
2015-06-17  0:12         ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).