zsh-workers
 help / color / mirror / code / Atom feed
* Globbing in redirections
@ 1996-06-06 14:54 Zefram
  1996-06-06 16:25 ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1996-06-06 14:54 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch makes redirection behave a little more like ksh.
It disables globbing on filenames in redirections, but only when
multios are disabled.  (Globbed redirections are a very useful way
to generate multios.)  Note that behaviour is still not exactly
like ksh, as brace expansion is still done.  But ksh seems to treat
brace expansion as part of globbing: compare "echo ~{root,nobody}"
in the two shells.  (KSH_BRACES, anyone?)

This patch as written relies on my recent large options patch,
that changed the NO_MULTIOS option into MULTIOS.  If you haven't
applied that, change "isset(MULTIOS)" to "unset(NOMULTIOS)".

 -zefram

      Index: Doc/zshmisc.man
      *** zshmisc.man	1996/06/06 01:45:20	1.5
      --- zshmisc.man	1996/06/06 02:05:26
      ***************
      *** 512,517 ****
      --- 512,532 ----
        .PP
        writes the date to the file "foo", and also pipes it to cat.
        .PP
      + If the
      + .B MULTIOS
      + option is set, the word after a redirection operator is also subjected
      + to filename generation (globbing).  Thus
      + .RS
      + .PP
      + .B : > *
      + .RE
      + .PP
      + will truncate all files in the current directory,
      + assuming there's at least one.
      + (Without the
      + .B MULTIOS
      + option, it would create an empty file called "*".)
      + .PP
        If the user tries to open a file descriptor for reading more than once,
        the shell opens the file descriptor as a pipe to a process that copies
        all the specified inputs to its output in the order
      Index: Src/glob.c
      *** glob.c	1996/06/06 01:45:30	1.8
      --- glob.c	1996/06/06 02:06:51
      ***************
      *** 862,868 ****
            addlinknode(fake, fn->name);
            /* ...which undergoes all the usual shell expansions. */
            prefork(fake, 0);
      !     if (!errflag)
        	globlist(fake);
            if (errflag)
        	return 0;
      --- 862,869 ----
            addlinknode(fake, fn->name);
            /* ...which undergoes all the usual shell expansions. */
            prefork(fake, 0);
      !     /* Globbing is only done for multios. */
      !     if (!errflag && isset(MULTIOS))
        	globlist(fake);
            if (errflag)
        	return 0;

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMbY/BHD/+HJTpU/hAQFX1AP8DZcutSWVln2VufviHDskuXPr5MbP5wTi
S2YhTOYPCQ/JCfh2BeQTZXw/k/TNM5vSQC7EawulBEOB42ClMQJdo5IRrReh0HUP
tQNptWP7YVm879YKHp26ka8vl2tmrcqC0J0M3mEqAEFQ124AMRvsJ4cG1bOV1vDz
BiZusin6gj4=
=kDm+
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-06-06 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-06 14:54 Globbing in redirections Zefram
1996-06-06 16:25 ` Zoltan Hidvegi
1996-06-06 16:36   ` Zefram
1996-06-06 16:48     ` Zoltan Hidvegi

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