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

PATCH: pws-25: alias +, alias +[grm]



Oliver Kiddle wrote:
> Peter Stephenson wrote:
> > If you do `typeset +x' or `typeset -x +' you get just the names of the
> > exported parameters.  Consequently, `typeset +f' and `functions +'
> > (functions is claimed to be equivalent to `typeset -f') should just print
> > the names of the functions.
> That's useful. A similar change should be made for the alias command (so
> alias + lists aliases, alias +g lists global aliases etc). This would
> also improve ksh compatibility as it already does this.

I had a look at doing this and it seemed simple enough so I've done it myself. The
patch is against plain pws-25 so the line numbers may be a bit out. I haven't tested
the doc patch with yodl because I don't have it here so it may have problems. As with
Peter's patch, this might be applicable to 3.0.6.

Hopefully I've sorted my e-mail word wrap problem with this e-mail.

Oliver Kiddle

*** Src/builtin.c.old	Wed Jul  7 09:48:53 1999
--- Src/builtin.c	Wed Jul  7 12:13:23 1999
***************
*** 42,48 ****
      BUILTIN("[", 0, bin_test, 0, -1, BIN_BRACKET, NULL, NULL),
      BUILTIN(".", BINF_PSPECIAL, bin_dot, 1, -1, 0, NULL, NULL),
      BUILTIN(":", BINF_PSPECIAL, bin_true, 0, -1, 0, NULL, NULL),
!     BUILTIN("alias", BINF_MAGICEQUALS, bin_alias, 0, -1, 0, "Lgmr", NULL),
      BUILTIN("autoload", BINF_TYPEOPTS, bin_functions, 0, -1, 0, "tU", "u"),
      BUILTIN("bg", 0, bin_fg, 0, -1, BIN_BG, NULL, NULL),
      BUILTIN("break", BINF_PSPECIAL, bin_break, 0, 1, BIN_BREAK, NULL, NULL),
--- 42,48 ----
      BUILTIN("[", 0, bin_test, 0, -1, BIN_BRACKET, NULL, NULL),
      BUILTIN(".", BINF_PSPECIAL, bin_dot, 1, -1, 0, NULL, NULL),
      BUILTIN(":", BINF_PSPECIAL, bin_true, 0, -1, 0, NULL, NULL),
!     BUILTIN("alias", BINF_MAGICEQUALS | BINF_PLUSOPTS, bin_alias, 0, -1, 0, "Lgmr", NULL),
      BUILTIN("autoload", BINF_TYPEOPTS, bin_functions, 0, -1, 0, "tU", "u"),
      BUILTIN("bg", 0, bin_fg, 0, -1, BIN_BG, NULL, NULL),
      BUILTIN("break", BINF_PSPECIAL, bin_break, 0, 1, BIN_BREAK, NULL, NULL),
***************
*** 2407,2412 ****
--- 2407,2414 ----
  
      if (ops['L'])
  	printflags |= PRINT_LIST;
+     else if (ops['r'] == 2 || ops['g'] == 2 || ops['m'] == 2 || ops['+'])
+ 	printflags |= PRINT_NAMEONLY;
  
      /* In the absence of arguments, list all aliases.  If a command *
       * line flag is specified, list only those of that type.        */
*** Doc/Zsh/builtins.yo.old	Wed Jul  7 11:34:34 1999
--- Doc/Zsh/builtins.yo	Wed Jul  7 11:49:47 1999
***************
*** 44,50 ****
  findex(alias)
  cindex(aliases, defining)
  cindex(aliases, listing)
! item(tt(alias) [ tt(-gmrL) ] [ var(name)[tt(=)var(value)] ... ])(
  For each var(name) with a corresponding var(value), define an alias
  with that value.  A trailing space in var(value) causes the next word
  to be checked for alias expansion.  If the tt(-g) flag is present,
--- 44,50 ----
  findex(alias)
  cindex(aliases, defining)
  cindex(aliases, listing)
! item(tt(alias) [ {tt(PLUS()|tt(-))}tt(gmrL) ] [ var(name)[tt(=)var(value)] ... ])(
  For each var(name) with a corresponding var(value), define an alias
  with that value.  A trailing space in var(value) causes the next word
  to be checked for alias expansion.  If the tt(-g) flag is present,
***************
*** 58,64 ****
  interpreted as glob patterns), and the aliases matching these patterns
  are printed.  When printing aliases and the tt(-g) or tt(-r) flags
  are present, then restrict the printing to global or regular
! aliases, respectively.
  
  If the tt(-L) flag is present, then print each
  alias in a manner suitable for putting in a startup script.  The exit
--- 58,65 ----
  interpreted as glob patterns), and the aliases matching these patterns
  are printed.  When printing aliases and the tt(-g) or tt(-r) flags
  are present, then restrict the printing to global or regular
! aliases, respectively.  Using `tt(PLUS())' instead of `tt(-)' prevents
! the values of the aliases from being printed.
  
  If the tt(-L) flag is present, then print each
  alias in a manner suitable for putting in a startup script.  The exit



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