diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:53:53 +0200 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:45 +0200 |
| commit | 157e975c7617c12d38bdfa6e095ffdf56b3f0d72 (patch) | |
| tree | 92bbd0306e8ad92631740d79fd7f670a70bd1ec5 | |
| parent | 14ec436a10e901ab42c850e5fedc14860d3d8864 (diff) | |
| download | busybox-w32-157e975c7617c12d38bdfa6e095ffdf56b3f0d72.tar.gz busybox-w32-157e975c7617c12d38bdfa6e095ffdf56b3f0d72.tar.bz2 busybox-w32-157e975c7617c12d38bdfa6e095ffdf56b3f0d72.zip | |
win32: ash: struct tblentry
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
| -rw-r--r-- | shell/ash.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 5431f3b17..ffbd473a0 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -13363,6 +13363,61 @@ SLIST_COPY_BEGIN(strlist_copy,struct strlist) | |||
| 13363 | (*vpp)->text = nodeckstrdup(vp->text); | 13363 | (*vpp)->text = nodeckstrdup(vp->text); |
| 13364 | SAVE_PTR((*vpp)->text); | 13364 | SAVE_PTR((*vpp)->text); |
| 13365 | SLIST_COPY_END() | 13365 | SLIST_COPY_END() |
| 13366 | |||
| 13367 | /* | ||
| 13368 | * struct tblentry | ||
| 13369 | */ | ||
| 13370 | static void | ||
| 13371 | tblentry_size(struct tblentry *tep) | ||
| 13372 | { | ||
| 13373 | while (tep) { | ||
| 13374 | funcblocksize += sizeof(struct tblentry) + strlen(tep->cmdname) + 1; | ||
| 13375 | /* CMDBUILTIN, e->param.cmd needs no pointer relocation */ | ||
| 13376 | if (tep->cmdtype == CMDFUNCTION) { | ||
| 13377 | funcblocksize += offsetof(struct funcnode, n); | ||
| 13378 | calcsize(&tep->param.func->n); | ||
| 13379 | nodeptrsize++; /* tep->param.func */ | ||
| 13380 | } | ||
| 13381 | nodeptrsize++; /* tep->next */ | ||
| 13382 | tep = tep->next; | ||
| 13383 | } | ||
| 13384 | } | ||
| 13385 | |||
| 13386 | static struct tblentry * | ||
| 13387 | tblentry_copy(struct tblentry *tep) | ||
| 13388 | { | ||
| 13389 | struct tblentry *start; | ||
| 13390 | struct tblentry **newp; | ||
| 13391 | int size; | ||
| 13392 | |||
| 13393 | newp = &start; | ||
| 13394 | while (tep) { | ||
| 13395 | *newp = funcblock; | ||
| 13396 | size = sizeof(struct tblentry) + strlen(tep->cmdname) + 1; | ||
| 13397 | |||
| 13398 | funcblock = (char *) funcblock + size; | ||
| 13399 | memcpy(*newp, tep, size); | ||
| 13400 | switch (tep->cmdtype) { | ||
| 13401 | case CMDBUILTIN: | ||
| 13402 | /* No pointer saving, this field must be fixed by forkshell_init() */ | ||
| 13403 | (*newp)->param.cmd = (const struct builtincmd *)(tep->param.cmd - builtintab); | ||
| 13404 | break; | ||
| 13405 | case CMDFUNCTION: | ||
| 13406 | (*newp)->param.func = funcblock; | ||
| 13407 | funcblock = (char *) funcblock + offsetof(struct funcnode, n); | ||
| 13408 | copynode(&tep->param.func->n); | ||
| 13409 | SAVE_PTR((*newp)->param.func); | ||
| 13410 | break; | ||
| 13411 | default: | ||
| 13412 | break; | ||
| 13413 | } | ||
| 13414 | SAVE_PTR((*newp)->next); | ||
| 13415 | tep = tep->next; | ||
| 13416 | newp = &(*newp)->next; | ||
| 13417 | } | ||
| 13418 | *newp = NULL; | ||
| 13419 | return start; | ||
| 13420 | } | ||
| 13366 | /*- | 13421 | /*- |
| 13367 | * Copyright (c) 1989, 1991, 1993, 1994 | 13422 | * Copyright (c) 1989, 1991, 1993, 1994 |
| 13368 | * The Regents of the University of California. All rights reserved. | 13423 | * The Regents of the University of California. All rights reserved. |
