Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cat as a builtin command
- X-seq: zsh-workers 33083
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: cat as a builtin command
- Date: Mon, 01 Sep 2014 09:41:26 +0100
- In-reply-to: <20140829201557.GD28052@chaz.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <BLU436-SMTP2045383EF41756D3376DB3CF4DB0@phx.gbl> <20140829140343.7ed2a891__13925.6726870828$1409317564$gmane$org@pwslap01u.europe.root.pri> <20140829201557.GD28052@chaz.gmail.com>
On Fri, 29 Aug 2014 21:15:57 +0100
Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> 2014-08-29 14:03:43 +0100, Peter Stephenson:
> [...]
> > mycat() {
> > emulate -L zsh
> > unsetopt multibyte
> > zmodload zsh/mapfile
> > print -r $mapfile[$1]
> > }
> [...]
>
> That should be:
>
> print -rn -- $mapfile[$1]
>
> What would be the possible effects of *not* turning off
> "multibyte" here?
Logically if you have an 8-bit character set defined then the shell
expects command lines to use it and you're relying on the shell
shrugging its shoulders and passing on raw octets anyway, which is
implemented but a bit hit and miss. However, with just a raw print, and
print expansions turned off, I would hope it works for any input, since
there's not a lot left to go wrong in that case. It would need scanning
the command argument handling and print code in some detail and with
interestinf failure cases in mind (e.g. partial characters) to be sure.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author