aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index ea338f1dd..7264ff7bc 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13509,6 +13509,63 @@ redirtab_copy(struct redirtab *rdtp)
13509 *vpp = NULL; 13509 *vpp = NULL;
13510 return start; 13510 return start;
13511} 13511}
13512
13513#undef shellparam
13514#undef redirlist
13515#undef varinit
13516#undef vartab
13517static void
13518globals_var_size(struct globals_var *gvp)
13519{
13520 int i;
13521
13522 funcblocksize += sizeof(struct globals_var);
13523 argv_size(gvp->shellparam.p);
13524 redirtab_size(gvp->redirlist);
13525 for (i = 0; i < VTABSIZE; i++)
13526 var_size(gvp->vartab[i]);
13527 for (i = 0; i < ARRAY_SIZE(varinit_data); i++)
13528 var_size(gvp->varinit+i);
13529 nodeptrsize += 2 + VTABSIZE; /* gvp->redirlist, gvp->shellparam.p, vartab */
13530}
13531
13532#undef g_nullredirs
13533#undef preverrout_fd
13534static struct globals_var *
13535globals_var_copy(struct globals_var *gvp)
13536{
13537 int i;
13538 struct globals_var *new;
13539
13540 new = funcblock;
13541 funcblock = (char *) funcblock + sizeof(struct globals_var);
13542
13543 /* shparam */
13544 memcpy(&new->shellparam, &gvp->shellparam, sizeof(struct shparam));
13545 new->shellparam.malloced = 0;
13546 new->shellparam.p = argv_copy(gvp->shellparam.p);
13547 SAVE_PTR(new->shellparam.p);
13548
13549 new->redirlist = redirtab_copy(gvp->redirlist);
13550 SAVE_PTR(new->redirlist);
13551
13552 new->g_nullredirs = gvp->g_nullredirs;
13553 new->preverrout_fd = gvp->preverrout_fd;
13554 for (i = 0; i < VTABSIZE; i++) {
13555 new->vartab[i] = var_copy(gvp->vartab[i]);
13556 SAVE_PTR(new->vartab[i]);
13557 }
13558
13559 /* Can't use var_copy because varinit is already allocated */
13560 for (i = 0; i < ARRAY_SIZE(varinit_data); i++) {
13561 new->varinit[i].next = NULL;
13562 new->varinit[i].text = nodeckstrdup(gvp->varinit[i].text);
13563 SAVE_PTR(new->varinit[i].text);
13564 new->varinit[i].flags = gvp->varinit[i].flags;
13565 new->varinit[i].func = gvp->varinit[i].func;
13566 }
13567 return new;
13568}
13512/*- 13569/*-
13513 * Copyright (c) 1989, 1991, 1993, 1994 13570 * Copyright (c) 1989, 1991, 1993, 1994
13514 * The Regents of the University of California. All rights reserved. 13571 * The Regents of the University of California. All rights reserved.