KSH portability

brian at bucc2.UUCP brian at bucc2.UUCP
Tue May 17 03:52:00 AEST 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 at seas.ucla.edu
  (309) 677-2230            ICBM: 40 40' N  89 34' W



More information about the Comp.unix.wizards mailing list