zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Allow '=' aliases to be used with -L
@ 2018-03-22  1:19 Joey Pabalinas
  2018-03-22  1:37 ` Bart Schaefer
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Joey Pabalinas @ 2018-03-22  1:19 UTC (permalink / raw)
  To: zsh-workers; +Cc: Joey Pabalinas

[-- Attachment #1: Type: text/plain, Size: 985 bytes --]

Special case '=' aliases so that they can be output correctly
by -L and be used in startup scripts.

Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>

 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Src/hashtable.c b/Src/hashtable.c
index b7baa314220509240d..62f8e9df3b99b6d5e2 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1303,11 +1303,17 @@ printaliasnode(HashNode hn, int printflags)
     }
 
     if (printflags & PRINT_LIST) {
-	/* Fast fail on unrepresentable values. */
+	/*
+	 * '=' aliases need to be special
+	 * cased with direct alias table
+	 * assignment (`aliases[=]=...`).
+	 */
 	if (strchr(a->node.nam, '=')) {
-	    zwarn("invalid alias '%s' encountered while printing aliases", 
-		  a->node.nam);
-	    /* ### TODO: Return an error status to the C caller */
+	    printf("aliases[=]");
+	    putchar('=');
+	    quotedzputs(a->text, stdout);
+
+	    putchar('\n');
 	    return;
 	}
 
-- 
2.16.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2018-03-24  0:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22  1:19 [PATCH] Allow '=' aliases to be used with -L Joey Pabalinas
2018-03-22  1:37 ` Bart Schaefer
2018-03-22  2:58   ` Joey Pabalinas
2018-03-22  3:08     ` Bart Schaefer
2018-03-22  3:12       ` Joey Pabalinas
2018-03-23  6:32     ` Daniel Shahaf
2018-03-23  7:39       ` Joey Pabalinas
2018-03-23 10:09 ` Nikolay Aleksandrovich Pavlov (ZyX)
2018-03-23 10:36   ` Joey Pabalinas
2018-03-23 17:29 ` Stephane Chazelas
2018-03-24  0:02   ` 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).