Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: allocating a new file descriptor

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

sysopen -w file

(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

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

sysdup2 may come handy as well if exec 12>&13, or exec $a>&$b
don't work.


Messages sorted by: Reverse Date, Date, Thread, Author