rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit f4f97b1bd0ba9d780e6565b05675a4a8debe2515
parent 75b4f0440f1e83b020e17b0d09dafe37dbf7e4ee
Author: tgoodwin <tgoodwin>
Date:   Mon, 13 Jul 1998 10:22:15 +0000

add `x'

Diffstat:
Maddon.c | 11++++++++++-
Maddon.h | 9++++++---
2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/addon.c b/addon.c @@ -6,7 +6,7 @@ #include "rc.h" #include "addon.h" -void b_add(char **av) { +void b_sum(char **av) { long sum = 0; while (*++av) @@ -14,3 +14,12 @@ void b_add(char **av) { fprint(1, "%ld\n", sum); set(TRUE); } + +void b_prod(char **av) { + long sum = 1; + + while (*++av) + sum *= atol(*av); + fprint(1, "%ld\n", sum); + set(TRUE); +} diff --git a/addon.h b/addon.h @@ -16,13 +16,16 @@ argument is followed by a NULL pointer. Builtins report their exit status using set(TRUE) or set(FALSE). - + */ #if RC_ADDON -#define ADDONS { b_add, "+" }, +#define ADDONS \ + { b_sum, "+" }, \ + { b_prod, "x" }, -extern void b_add(char **av); +extern void b_sum(char **av); +extern void b_prod(char **av); #endif