diff options
Diffstat (limited to 'addon.h')
| -rw-r--r-- | addon.h | 49 |
1 files changed, 21 insertions, 28 deletions
@@ -1,38 +1,31 @@ /* - This file is the interface to the rest of rc for any locally - defined addon builtins. By default there are none. - The interface consists of the following macro. - - ADDONS A comma-separated list of pairs of function pointers - and string literals. - - The addon functions must also have proper prototypes in this file. - The builtins all have the form: - + This file is NOT BUILT by default. Together with addon.c, it + provides an example of how to add new builtins to rc. + + To define a new builtin, it must appear in the macro ADDONS, which + is a comma-separated list of pairs of function pointers (the + implementation of the new builtin) and string literals (the name of + the new builtin). + + Any new builtin functions must also have proper prototypes in this + file. This is always of the same form. + void b_NAME(char **av); - - Builtins report their exit status using set(TRUE) or set(FALSE). - - Example: - - #define ADDONS { b_test, "test" }, - extern void b_test(char **av); -*/ -#define ADDONS /* no addons by default */ + The first argument, av[0], is the name of the builtin. The last + argument is followed by a NULL pointer. -#ifdef DWS + Builtins report their exit status using set(TRUE) or set(FALSE). -/* - This is what DaviD Sanderson (dws@cs.wisc.edu) uses. */ -#undef ADDONS -#define ADDONS { b_access, "access" },\ - { b_test, "test" },\ - { b_test, "[" }, +#if RC_ADDON + +#define ADDONS \ + { b_sum, "+" }, \ + { b_prod, "x" }, -extern void b_access(char **av); -extern void b_test(char **av); +extern void b_sum(char **av); +extern void b_prod(char **av); #endif |