From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27235 invoked by alias); 30 Jul 2015 11:05:56 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35954 Received: (qmail 28293 invoked from network); 30 Jul 2015 11:05:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Pxb5k+wC+IzQ8zsG3N3C2o3sy82UyBmCE4FifBtRU2s=; b=N94IyNd7Thozi1EgKim5HYgqlP4He2NshemFj7zkJk0BGN9bQo39VfVZRTbph6GRrU nmXgvOZsvmNphF1/iOQlGdaM6vjZ7lT5i7BWSEoSJfstVVjs5KThxZPicXKcF4WjrhaA aUuUY2GzwK6jje51Rss3KwhmPsYuWigRwkIH8GEQxkUs2J/sYDYRp2sgNdFkunh3YBAq 7eXOv3Jh8GcIZqWRQS3Efsh5GbUsxgoUn82+5iC3GRPdDvHWkfxmkCvz1YQn0KKSO+Ju DJRY3Rf6Rq/OOAP2SaJATlN0SPMuHYwKbo8x1pdMmc0Rtt0QtFZpMEs9Y/Fv12BhCt8m f00Q== MIME-Version: 1.0 X-Received: by 10.107.169.138 with SMTP id f10mr9129580ioj.75.1438254353364; Thu, 30 Jul 2015 04:05:53 -0700 (PDT) In-Reply-To: <20150724125516.64006bb5@pwslap01u.europe.root.pri> References: <558B5342.2090706@inlv.org> <150624184916.ZM19079@torch.brasslantern.com> <558B65EB.3060204@inlv.org> <150625003047.ZM19218@torch.brasslantern.com> <558D5E34.3020505@inlv.org> <20150627180230.5fda7e09@ntlworld.com> <558F397D.9030708@inlv.org> <20150628074837.GB4818@chaz.gmail.com> <16434.1435482953@thecus.kiddle.eu> <20150628140050.GA10570@chaz.gmail.com> <150628113814.ZM1638@torch.brasslantern.com> <23516.1437620218@thecus.kiddle.eu> <20150724115733.44531b77@pwslap01u.europe.root.pri> <20150724125516.64006bb5@pwslap01u.europe.root.pri> Date: Thu, 30 Jul 2015 13:05:53 +0200 Message-ID: Subject: Re: PATCH: sysopen (was Re: '>>' does not create file if set -C (noclobber) is active) From: Mikael Magnusson To: Peter Stephenson , Oliver Kiddle Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On Fri, Jul 24, 2015 at 1:55 PM, Peter Stephenson wrote: > Also, I suppose we should say something like... > > (although adding sysclose isn't necessarily a bad thing) > > pws > > diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo > index e4d4c31..b9b07bb 100644 > --- a/Doc/Zsh/mod_system.yo > +++ b/Doc/Zsh/mod_system.yo > @@ -68,6 +68,11 @@ item(tt(trunc))( > truncate file to size 0 > ) > enditem() > + > +To close the file, use one of the following: > + > +example(tt(exec {)var(fd)tt(}<&-) > +tt(exec {)var(fd)tt(}>&-)) > ) > findex(sysread) > redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) I remembered this being mentioned and was looking through the docs because I always forget where the & goes, but it looks like you never committed it. It is mentioned in the paragraph about zsystem flock though. Was there a reason the new commands were not made subcommands to zsystem? I don't see any rationale in the commit message. An advantage would be that "zsystem supports foo" already will tell you that foo is not a recognized subcommand. We could add the sysopen/tell/close/seek commands to zsystem supports anyway, even though they're not subcommands. > One very minor comment now I've tried this: > > % sysread -i fd > sysread: integer expected: fd > > I think it would probably be appropriate and consistent with other > similar contexts for this to do matn eval, even though the workaround is > obvious and trivial. I feel like this might be slightly dangerous, as if you get used to fd being treated as an integer here, you may try sysopen -u fd and it will silently use another fd and assign to your parameter instead. It also looks like the -u option for sysopen is not optional, so it shouldn't be listed in [ ]. --- i/Doc/Zsh/mod_system.yo +++ w/Doc/Zsh/mod_system.yo @@ -31,7 +31,7 @@ not recognised (no message is printed for this). findex(sysopen) redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ @ @ ))ifnztexi( ))) xitem(tt(sysopen) [ tt(-arw) ] [ tt(-m) var(permissions) ] [ tt(-o) var(options) ]) -item(SPACES()[ tt(-u) var(fd) ] var(file))( +item(SPACES()tt(-u) var(fd) var(file))( This command opens a file. The tt(-r), tt(-w) and tt(-a) flags indicate whether the file should be opened for reading, writing and appending, respectively. The tt(-m) option allows the initial permissions to use when -- Mikael Magnusson