summaryrefslogtreecommitdiff
path: root/do/unshift
diff options
context:
space:
mode:
Diffstat (limited to 'do/unshift')
-rw-r--r--do/unshift20
1 files changed, 20 insertions, 0 deletions
diff --git a/do/unshift b/do/unshift
new file mode 100644
index 0000000000..26a3c7897e
--- /dev/null
+++ b/do/unshift
@@ -0,0 +1,20 @@
+void
+do_unshift(ary,arglast)
+register ARRAY *ary;
+int *arglast;
+{
+ register STR **st = stack->ary_array;
+ register int sp = arglast[1];
+ register int items = arglast[2] - sp;
+ register STR *TARG;
+ register int i;
+
+ aunshift(ary,items);
+ i = 0;
+ for (st += ++sp; i < items; i++,st++) {
+ TARG = Str_new(27,0);
+ str_sset(TARG,*st);
+ (void)astore(ary,i,TARG);
+ }
+}
+