Path: utzoo!attcan!uunet!husc6!bloom-beacon!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!bradley!bucc2!brian From: brian@bucc2.UUCP Newsgroups: comp.unix.wizards Subject: Re: KSH portability Message-ID: <15200005@bucc2> Date: 16 May 88 17:52:00 GMT References: <14339@brl-adm.ARPA> Lines: 39 Nf-ID: #R:brl-adm.ARPA:14339:bucc2:15200005:000:1118 Nf-From: bucc2.UUCP!brian May 16 12:52:00 1988 > /* Written 11:47 am May 12, 1988 by icst-cmr.arpa!rbj */ > /* ---------- "KSH portability" ---------- */ > I wrote: > > What is really needed is an fd to fp table, maintained by stdio, so that: > > for (fd = 0; fd < MAXFD; fd ++) > fp = fdtofp[fd] && fflush(fp); > > Anything weird about this idea? Won't FILE *fdtofp(int fd) { return &_iob[fd] }; work? Look at stdio.h... > What is *really* needed is an array of FILE**, maintained by stdio so > that one could do: > > for (i = 0; i < FILEMAX; i++) > if (FILES[i]) do_something_with(FILES[i]); > for (i = 0; i < _NFILE; i++) if (???) do_something_with(&_iobuf[i]); I don't know what flag in _iobuf tells you whether the entry is used or not. I also don't know how reliable and/or portable this is. ............................................................................... When the going gets weird, the weird turn pro. Brian Michael Wendt UUCP: {cepu,ihnp4,uiucdcs,noao}!bradley!brian Bradley University ARPA: cepu!bradley!brian@seas.ucla.edu (309) 677-2230 ICBM: 40 40' N 89 34' W