Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Allow '=' aliases to be used with -L




22.03.2018, 04:19, "Joey Pabalinas" <joeypabalinas@xxxxxxxxx>:
> Special case '=' aliases so that they can be output correctly
> by -L and be used in startup scripts.
>
> Signed-off-by: Joey Pabalinas <joeypabalinas@xxxxxxxxx>
>
>  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[=]");

This looks like all aliases having `=` in them will be printed with exactly the same key `=`, including those which are not equal to `=`.

> + putchar('=');
> + quotedzputs(a->text, stdout);
> +
> + putchar('\n');
>              return;
>          }
>
> --
> 2.16.2



Messages sorted by: Reverse Date, Date, Thread, Author