Information is limited to say the least. I don't know of any book that covers it. And that doesn't surprise me. The details could change with the next release of ksh. There is a
Faq on the
Kornshell which says:
Quote:
Q4. How do I add built-in commands?
A4. There are two ways to do this. One is write a shared library
with functions whose names are b_xxxx where xxxx is the name of
the builtin. The function b_xxxx takes three argument. The first
two are the same as a mail program. The third parameter is
a pointer argument which will point to the current shell context.
The second way is to write a shared library with a function named
lib_init(). This function will be called with an argument of 0
after the library is loaded. This function can add built-ins
with the sh_addbuiltin() API function. In both cases, the
library is loaded into the shell with the "builtin" utility.
|
(I'm sure there's a typo in that quote, "mail program" should be "main program".) This is about all that I feel I quote here. In this
article, there is an example. But the documentation with the source code had some differences. You really need to download the source code and read the docs that come with it. The file to look at is "builtins.mm" and you can read it with:
nroff -mm < builtins.mm | col -b | more