diff options
| author | tgoodwin <tgoodwin> | 1998-07-08 17:00:32 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:06 +0100 |
| commit | 4163c691dfb2e1b681a2036c49c0663cae1d7f59 (patch) | |
| tree | e6ae6da4b8d15cc256bb8b380ea442f35db29959 /addon.h | |
| parent | 279e7fc70338626ed540163afa7e1450ae4ce866 (diff) | |
completely revamp to use my `+' example
Diffstat (limited to 'addon.h')
| -rw-r--r-- | addon.h | 46 |
1 files changed, 18 insertions, 28 deletions
@@ -1,38 +1,28 @@ /* - 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); - + + The first argument, av[0], is the name of the builtin. The last + argument is followed by a NULL pointer. + 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 */ - -#ifdef DWS - -/* - This is what DaviD Sanderson (dws@cs.wisc.edu) uses. -*/ +#if RC_ADDON -#undef ADDONS -#define ADDONS { b_access, "access" },\ - { b_test, "test" },\ - { b_test, "[" }, +#define ADDONS { b_add, "+" }, -extern void b_access(char **av); -extern void b_test(char **av); +extern void b_add(char **av); #endif |