On Fri, 23 Feb 2007 00:54:07 +0100 Joerg.Schilling at fokus.fraunhofer.de 
(Joerg Schilling) wrote:
> Glenn Fowler <gsf at research.att.com> wrote:

> > > A libfind based buildin could look this way:
> >
> > > b_find(int ac, char ** av, FILE *std[], int *interrupted)
> >
> > the ksh b_*() prototype will not change

> If there is no will to allow non ast based libraries to be able to
> be be used as ksh builtins, why did then Solaris make place for the name
> "libcmd"?

> I thought that the intention was to have reusable code.

the ksh93 builtin prototype is fixed
just like the main() prototype is fixed
just like any other system you may need intermediate functions
to impedance match between different apis

ksh builtins look like argc,argv commands and the api provides just that
it is not a place to hook arbitrary functions like perl+libc

> I did restructure my portability system during the last months and
> libschily (libfind is based on libschily) is now implemented in a way 
> that allows to link any other cleanly build binary against it, if this
> other binary does not establish claims that require standard interfaces
> to be replaced by ksh internal interfaces.

> If the ksh sources are structured in a way that is compatible with
> other software, it should be no problem to find a way to let ksh93 
> use a "standard" libfind. I am willing to create a ksh93 specific b_find() 
> entry only in case that ksh93 allows me to let the rest of libfind
> stay standard software.

> If ksh93 is not able to grant this, it looks like a foreign budy in
> Solaris....

my previous post mentioned that a builtin could use libc stdio
(and by implication other libc interfaces) as long as the builtin
completely encapsulates the libc usage, e.g., like flushing and
closing stdio FILE streams, free'ing malloc'd memory, checking
cmdquit() for early termination

since builtins are in the same process as ksh they can be coded
to maintain state between calls -- but resources unclaimed by the
builtin at builtin "exit" will remain unclaimed

so, there should not be a problem with a builtin compiled against libc

-- Glenn Fowler -- AT&T Research, Florham Park NJ --


Reply via email to