summaryrefslogtreecommitdiff
path: root/addon.c
diff options
context:
space:
mode:
Diffstat (limited to 'addon.c')
-rw-r--r--addon.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/addon.c b/addon.c
index df3fcd7..6e6c232 100644
--- a/addon.c
+++ b/addon.c
@@ -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);
+}