Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: allocating a new file descriptor
- X-seq: zsh-workers 21142
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: PATCH: allocating a new file descriptor
- Date: Thu, 14 Apr 2005 19:10:20 +0100
- In-reply-to: <200504141616.j3EGGR7O023489@xxxxxxxxxxxxxx>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <200504121257.j3CCvkXr003286@xxxxxxxxxxxxxx> <1050414045748.ZM13551@xxxxxxxxxxxxxxxxxxxxxxx> <200504140949.j3E9n5Kp006216@xxxxxxxxxxxxxx> <1050414142337.ZM14042@xxxxxxxxxxxxxxxxxxxxxxx> <200504141616.j3EGGR7O023489@xxxxxxxxxxxxxx>
- Sender: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
I understand that
exec {fd}> file
is the shell equivalent of
fd = open(file, O_WRONLY|O_CREAT);
given that we already have ztcp, zsocket... that allocate fds,
and sysread, syswrite..., I would find it more consistent to
have:
sysopen -w file
fd=$REPLY
(with -x (O_EXCL), -r (read), -w (write), -a (append), -n (don't
create), -d <fd> and possibly extensions for O_SYNC, O_NOATIME...)
I find the:
print ... {fd}> file
that keeps the file open a bit confusing and unconsistent (and
useless).
It would be good to have a sysclose as well. At least until
recently, exec 12>&- didn't work. I had the problem with my
mouse support, where I couldn't close the fd opened by zsocket
for gpm interaction.
I also noticed several problems when fidling with fds used
internally by zsh (zsocket -d10 or -d11 ended up in a core
dump).
sysdup2 may come handy as well if exec 12>&13, or exec $a>&$b
don't work.
regards,
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author