zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu
Subject: zmodload -a change
Date: Mon, 17 Mar 1997 18:18:47 GMT	[thread overview]
Message-ID: <5265.199703171818@stone.dcs.warwick.ac.uk> (raw)

-----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-----


                 reply	other threads:[~1997-03-17 18:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5265.199703171818@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).