addon.h (816B)
1 /* 2 This file is NOT BUILT by default. Together with addon.c, it 3 provides an example of how to add new builtins to rc. 4 5 To define a new builtin, it must appear in the macro ADDONS, which 6 is a comma-separated list of pairs of function pointers (the 7 implementation of the new builtin) and string literals (the name of 8 the new builtin). 9 10 Any new builtin functions must also have proper prototypes in this 11 file. This is always of the same form. 12 13 void b_NAME(char **av); 14 15 The first argument, av[0], is the name of the builtin. The last 16 argument is followed by a NULL pointer. 17 18 Builtins report their exit status using set(TRUE) or set(FALSE). 19 20 */ 21 22 #if RC_ADDON 23 24 #define ADDONS \ 25 { b_sum, "+" }, \ 26 { b_prod, "x" }, 27 28 extern void b_sum(char **av); 29 extern void b_prod(char **av); 30 31 #endif