diff options
| author | Toby Goodwin <tjg@star.le.ac.uk> | 1999-01-11 10:55:18 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:22:09 +0100 |
| commit | e11c7df86144bed383ac6bbeaecc3017d18b37db (patch) | |
| tree | 6fad44921723eab2f2eb1c76b7214b4e79b818f3 /addon.c | |
| parent | 671e1e2d1599aa8c5f1010b3fe75c151c56a7403 (diff) | |
beta: rc-1.5b4
Diffstat (limited to 'addon.c')
| -rw-r--r-- | addon.c | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -1,22 +1,25 @@ /* - This file contains the implementations of any locally defined - builtins. + This file is NOT BUILT by default. Together with addon.h, it + provides an example of how to add new builtins to rc. */ -#ifdef DWS - -/* - This is what DaviD Sanderson (dws@cs.wisc.edu) uses. -*/ +#include "rc.h" +#include "addon.h" -#include <sys/types.h> -#include <sys/file.h> -#include <sys/stat.h> +void b_sum(char **av) { + long sum = 0; -#include "rc.h" /* for bool TRUE, FALSE */ -#include "addon.h" + while (*++av) + sum += atol(*av); + fprint(1, "%ld\n", sum); + set(TRUE); +} -#include "addon/access.c" -#include "addon/test.c" +void b_prod(char **av) { + long sum = 1; -#endif + while (*++av) + sum *= atol(*av); + fprint(1, "%ld\n", sum); + set(TRUE); +} |