From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5235 invoked from network); 17 Mar 1997 18:27:57 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 17 Mar 1997 18:27:57 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id NAA00475; Mon, 17 Mar 1997 13:16:07 -0500 (EST) Resent-Date: Mon, 17 Mar 1997 13:16:07 -0500 (EST) Date: Mon, 17 Mar 1997 18:18:47 GMT From: Zefram Message-Id: <5265.199703171818@stone.dcs.warwick.ac.uk> Subject: zmodload -a change X-Patch: 204 Resent-Message-ID: <"UWxK9.0.L7.cfOBp"@euclid> To: zsh-workers@math.gatech.edu Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2997 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- This patch reverses the order of arguments to zmodload -a, so that multiple builtins contained in a single module can be defined in a single command. Behaviour in the usual case of only one argument is unchanged. Temporarily, when dealing with a system where either syntax may be required, the following construction may be useful for your dotfiles: zmodload -a files ln mkdir mv rm rmdir sync 2>/dev/null || { zmodload -a ln files zmodload -a mkdir files zmodload -a mv files zmodload -a rm files zmodload -a rmdir files zmodload -a sync files } -zefram *** Doc/Zsh/builtins.yo 1997/03/04 00:25:40 1.6 --- Doc/Zsh/builtins.yo 1997/03/17 12:53:16 *************** *** 1231,1237 **** xitem(tt(zmodload) [ tt(-iL) ] [ var(name) ... ]) xitem(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...) xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) [ var(dep) ... ] ]) ! item(tt(zmodload) tt(-a) [ tt(-uL) ] [ var(builtin) [ var(name) ] ])( Load (or, with tt(-u), unload) a binary module. When loading a module, the module must be in a file named either `var(name)tt(.dlext())' or `var(name)'. --- 1231,1238 ---- xitem(tt(zmodload) [ tt(-iL) ] [ var(name) ... ]) xitem(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...) xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) [ var(dep) ... ] ]) ! xitem(tt(zmodload) tt(-a) [ tt(-L) ] [ var(name) [ var(builtin) ... ] ]) ! item(tt(zmodload) tt(-au) var(builtin) ...)( Load (or, with tt(-u), unload) a binary module. When loading a module, the module must be in a file named either `var(name)tt(.dlext())' or `var(name)'. *************** *** 1268,1277 **** The tt(-L) option changes this format to a list of tt(zmodload -d) commands. ! The tt(-a) option defines autoloaded builtins. It defines a new builtin ! given by the first argument. When that builtin is called the module ! specified in the second argument is loaded. With one argument the ! module name defaults to the name of the builtin. With no arguments, all autoloaded builtins are listed, with the module name (if different) shown in parentheses after the builtin name. The tt(-L) option changes this format to a list of tt(zmodload -a) commands. If tt(-a) is used --- 1269,1279 ---- The tt(-L) option changes this format to a list of tt(zmodload -d) commands. ! The tt(-a) option defines autoloaded builtins. It defines the ! specified var(builtin)s. When any of those builtins is called, the module ! specified in the first argument is loaded. If only one argument is given, ! one builtin is defined, with the same name as the module. ! With no arguments, all autoloaded builtins are listed, with the module name (if different) shown in parentheses after the builtin name. The tt(-L) option changes this format to a list of tt(zmodload -a) commands. If tt(-a) is used *** Src/module.c 1997/01/29 03:25:21 1.22 --- Src/module.c 1997/03/17 12:45:22 *************** *** 390,401 **** return; if(printflags & PRINT_LIST) { fputs("zmodload -a ", stdout); ! if(bn->nam[0] == '-') fputs("-- ", stdout); ! quotedzputs(bn->nam, stdout); if(strcmp(bn->nam, bn->optstr)) { putchar(' '); ! quotedzputs(bn->optstr, stdout); } } else { nicezputs(bn->nam, stdout); --- 390,401 ---- return; if(printflags & PRINT_LIST) { fputs("zmodload -a ", stdout); ! if(bn->optstr[0] == '-') fputs("-- ", stdout); ! quotedzputs(bn->optstr, stdout); if(strcmp(bn->nam, bn->optstr)) { putchar(' '); ! quotedzputs(bn->nam, stdout); } } else { nicezputs(bn->nam, stdout); *************** *** 490,495 **** --- 490,496 ---- add_dep(tnam, *args++); } if (ops['a']) { + char *modnam; if (isset(RESTRICTED)) { zwarnnam(nam, "-a is not allowed in restricted mode", *args, 0); return 1; *************** *** 509,527 **** } return ret; } ! if (args[1] && args[2]) { ! zwarnnam(nam, "too many arguments for `zmodload -a'", NULL, 0); ! return 1; ! } ! if (strchr(args[0], '/')) { ! zwarnnam(nam, "%s: slash is illegal in a builtin", args[0], 0); ! return 1; ! } ! if (add_autobin(args[0], args[1] ? args[1] : args[0])) { ! zwarnnam(nam, "failed to add builtin %s", args[0], 0); ! return 1; ! } ! return 0; } for (; *args; args++) { node = find_module(*args); --- 510,527 ---- } return ret; } ! modnam = *args++; ! do { ! char *bnam = *args ? *args++ : modnam; ! if (strchr(bnam, '/')) { ! zwarnnam(nam, "%s: `/' is illegal in a builtin", bnam, 0); ! ret = 1; ! } else if (add_autobin(bnam, modnam)) { ! zwarnnam(nam, "failed to add builtin %s", bnam, 0); ! ret = 1; ! } ! } while(*args); ! return ret; } for (; *args; args++) { node = find_module(*args); -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: ascii iQCVAwUBMy1BinD/+HJTpU/hAQG64AP/frV3m5RUB6qbXnQGoBYWVaxFhM62zxIO khVWx+2XvlQ06J0z1By6S+yyIK2dhywQX3PoHmR72STN0Dwya88uUre5PSYmIwSn PsOIz30EJSswc6b79vfvWBsSCqN6Th0dwuIdZ4dZNEI4vKgwzB/tex0Mlu3du5nh 1UqgvJDamFA= =WBmO -----END PGP SIGNATURE-----