aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 00:56:15 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 11:04:28 +1000
commit5af6e2834e42261fa75af5942b6b3eef78b6028d (patch)
tree1d8faee7954af3363e0759db13f5e05d2d6dd031
parentc31f604099fe9b4c4da665eebab9536b86f99abd (diff)
downloadbusybox-w32-5af6e2834e42261fa75af5942b6b3eef78b6028d.tar.gz
busybox-w32-5af6e2834e42261fa75af5942b6b3eef78b6028d.tar.bz2
busybox-w32-5af6e2834e42261fa75af5942b6b3eef78b6028d.zip
win32: ash: struct globals_var
-rw-r--r--shell/ash.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index a04aecfd1..72f9630d8 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13510,6 +13510,63 @@ redirtab_copy(struct redirtab *rdtp)
13510 *vpp = NULL; 13510 *vpp = NULL;
13511 return start; 13511 return start;
13512} 13512}
13513
13514#undef shellparam
13515#undef redirlist
13516#undef varinit
13517#undef vartab
13518static void
13519globals_var_size(struct globals_var *gvp)
13520{
13521 int i;
13522
13523 funcblocksize += sizeof(struct globals_var);
13524 argv_size(gvp->shellparam.p);
13525 redirtab_size(gvp->redirlist);
13526 for (i = 0; i < VTABSIZE; i++)
13527 var_size(gvp->vartab[i]);
13528 for (i = 0; i < ARRAY_SIZE(varinit_data); i++)
13529 var_size(gvp->varinit+i);
13530 nodeptrsize += 2 + VTABSIZE; /* gvp->redirlist, gvp->shellparam.p, vartab */
13531}
13532
13533#undef g_nullredirs
13534#undef preverrout_fd
13535static struct globals_var *
13536globals_var_copy(struct globals_var *gvp)
13537{
13538 int i;
13539 struct globals_var *new;
13540
13541 new = funcblock;
13542 funcblock = (char *) funcblock + sizeof(struct globals_var);
13543
13544 /* shparam */
13545 memcpy(&new->shellparam, &gvp->shellparam, sizeof(struct shparam));
13546 new->shellparam.malloced = 0;
13547 new->shellparam.p = argv_copy(gvp->shellparam.p);
13548 SAVE_PTR(new->shellparam.p);
13549
13550 new->redirlist = redirtab_copy(gvp->redirlist);
13551 SAVE_PTR(new->redirlist);
13552
13553 new->g_nullredirs = gvp->g_nullredirs;
13554 new->preverrout_fd = gvp->preverrout_fd;
13555 for (i = 0; i < VTABSIZE; i++) {
13556 new->vartab[i] = var_copy(gvp->vartab[i]);
13557 SAVE_PTR(new->vartab[i]);
13558 }
13559
13560 /* Can't use var_copy because varinit is already allocated */
13561 for (i = 0; i < ARRAY_SIZE(varinit_data); i++) {
13562 new->varinit[i].next = NULL;
13563 new->varinit[i].text = nodeckstrdup(gvp->varinit[i].text);
13564 SAVE_PTR(new->varinit[i].text);
13565 new->varinit[i].flags = gvp->varinit[i].flags;
13566 new->varinit[i].func = gvp->varinit[i].func;
13567 }
13568 return new;
13569}
13513/*- 13570/*-
13514 * Copyright (c) 1989, 1991, 1993, 1994 13571 * Copyright (c) 1989, 1991, 1993, 1994
13515 * The Regents of the University of California. All rights reserved. 13572 * The Regents of the University of California. All rights reserved.