From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10340 invoked from network); 7 Jul 1999 11:22:02 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 7 Jul 1999 11:22:02 -0000 Received: (qmail 12349 invoked by alias); 7 Jul 1999 11:21:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7005 Received: (qmail 12339 invoked from network); 7 Jul 1999 11:21:48 -0000 Message-ID: <37833828.385E94DD@thoth.u-net.com> Date: Wed, 07 Jul 1999 12:21:12 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: Zsh hackers list Subject: PATCH: pws-25: alias +, alias +[grm] References: <9907061253.AA33621@ibmth.df.unipi.it> <378217D2.61B0C773@thoth.u-net.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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