Changeset 1198 for trunk/src/kash/exec.c


Ignore:
Timestamp:
Oct 6, 2007, 11:19:19 PM (18 years ago)
Author:
bird
Message:

moving globals into shinstance...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/exec.c

    r809 r1198  
    146146        TRACE(("shellexec: argv[0]=%s idx=%d\n", argv[0], idx));
    147147        if (strchr(argv[0], '/') != NULL) {
    148                 cmdname = stalloc(strlen(argv[0]) + 5);
     148                cmdname = stalloc(psh, strlen(argv[0]) + 5);
    149149                strcpy(cmdname, argv[0]);
    150150                tryexec(cmdname, argv, envp, vforked, has_ext);
    151151                TRACE(("shellexec: cmdname=%s\n", cmdname));
    152                 stunalloc(cmdname);
     152                stunalloc(psh, cmdname);
    153153                e = errno;
    154154        } else {
     
    160160                                        e = errno;
    161161                        }
    162                         stunalloc(cmdname);
     162                        stunalloc(psh, cmdname);
    163163                }
    164164        }
     
    275275                if (ap == &newargs[NEWARGS])
    276276bad:              error("Bad #! line");
    277                 STARTSTACKSTR(outp);
     277                STARTSTACKSTR(psh, outp);
    278278                do {
    279                         STPUTC(c, outp);
     279                        STPUTC(psh, c, outp);
    280280                } while (--n >= 0 && (c = *inp++) != ' ' && c != '\t' && c != '\n');
    281                 STPUTC('\0', outp);
     281                STPUTC(psh, '\0', outp);
    282282                n++, inp--;
    283                 *ap++ = grabstackstr(outp);
     283                *ap++ = grabstackstr(psh, outp);
    284284        }
    285285        if (ap == newargs + 1) {        /* if no args, maybe no exec is needed */
     
    349349        len += 4; /* "4" is for .exe/.com/.cmd/.bat/.btm */
    350350#endif
    351         while (stackblocksize() < len)
    352                 growstackblock();
    353         q = stackblock();
     351        while (stackblocksize(psh) < len)
     352                growstackblock(psh);
     353        q = stackblock(psh);
    354354        if (p != start) {
    355355                memcpy(q, start, p - start);
     
    375375        else
    376376                *path = NULL;
    377         return stalloc(len);
     377        return stalloc(psh, len);
    378378}
    379379
     
    485485                do {
    486486                        name = padvance(&path, cmdp->cmdname);
    487                         stunalloc(name);
     487                        stunalloc(psh, name);
    488488                } while (--idx >= 0);
    489489                out1str(name);
     
    623623loop:
    624624        while ((fullname = padvance(&path, name)) != NULL) {
    625                 stunalloc(fullname);
     625                stunalloc(psh, fullname);
    626626                idx++;
    627627                if (pathopt) {
     
    664664                        if (act & DO_NOFUNC)
    665665                                goto loop;
    666                         stalloc(strlen(fullname) + 1);
     666                        stalloc(psh, strlen(fullname) + 1);
    667667                        readcmdfile(fullname);
    668668                        if ((cmdp = cmdlookup(name, 0)) == NULL ||
    669669                            cmdp->cmdtype != CMDFUNCTION)
    670670                                error("%s not defined in %s", name, fullname);
    671                         stunalloc(fullname);
     671                        stunalloc(psh, fullname);
    672672                        goto success;
    673673                }
     
    689689                INTOFF;
    690690                if (act & DO_ALTPATH) {
    691                         stalloc(strlen(fullname) + 1);
     691                        stalloc(psh, strlen(fullname) + 1);
    692692                        cmdp = &loc_cmd;
    693693                } else
     
    11371137                                do {
    11381138                                        name = padvance(&path, arg);
    1139                                         stunalloc(name);
     1139                                        stunalloc(psh, name);
    11401140                                } while (--j >= 0);
    11411141                                if (!v_flag)
Note: See TracChangeset for help on using the changeset viewer.