Changeset 1199 for trunk/src/kash/var.c


Ignore:
Timestamp:
Oct 7, 2007, 12:04:05 AM (18 years ago)
Author:
bird
Message:

moving globals into shinstance...

File:
1 edited

Legend:

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

    r1198 r1199  
    332332        namelen = p - name;
    333333        if (isbad)
    334                 error("%.*s: bad variable name", namelen, name);
     334                error(psh, "%.*s: bad variable name", namelen, name);
    335335        len = namelen + 2;              /* 2 is space for '=' and '\0' */
    336336        if (val == NULL) {
     
    370370        if (vp != NULL) {
    371371                if (vp->flags & VREADONLY)
    372                         error("%.*s: is read only", vp->name_len, s);
     372                        error(psh, "%.*s: is read only", vp->name_len, s);
    373373                if (flags & VNOSET)
    374374                        return;
     
    575575
    576576        if (strcspn(p, "|&;<>()$`\\\"' \t\n*?[]#~=%") == strlen(p)) {
    577                 out1fmt("%s", p);
     577                out1fmt(psh, "%s", p);
    578578                return;
    579579        }
    580580        while (*p) {
    581581                if (*p == '\'') {
    582                         out1fmt("\\'");
     582                        out1fmt(psh, "\\'");
    583583                        p++;
    584584                        continue;
     
    586586                q = index(p, '\'');
    587587                if (!q) {
    588                         out1fmt("'%s'", p );
     588                        out1fmt(psh, "'%s'", p );
    589589                        return;
    590590                }
    591                 out1fmt("'%.*s'", (int)(q - p), p );
     591                out1fmt(psh, "'%.*s'", (int)(q - p), p );
    592592                p = q;
    593593        }
     
    648648                vp = *vpp;
    649649                if (name)
    650                         out1fmt("%s ", name);
     650                        out1fmt(psh, "%s ", name);
    651651                for (p = vp->text ; *p != '=' ; p++)
    652                         out1c(*p);
     652                        out1c(psh, *p);
    653653                if (!(vp->flags & VUNSET) && show_value) {
    654                         out1fmt("=");
    655                         print_quoted(++p);
    656                 }
    657                 out1c('\n');
     654                        out1fmt(psh, "=");
     655                        print_quoted(psh, ++p);
     656                }
     657                out1c(psh, '\n');
    658658        }
    659659        return 0;
     
    707707
    708708        if (! in_function(psh))
    709                 error("Not in a function");
     709                error(psh, "Not in a function");
    710710        while ((name = *argptr++) != NULL) {
    711711                mklocal(name, 0);
     
    774774                localvars = lvp->next;
    775775                vp = lvp->vp;
    776                 TRACE(("poplocalvar %s", vp ? vp->text : "-"));
     776                TRACE((psh, "poplocalvar %s", vp ? vp->text : "-"));
    777777                if (vp == NULL) {       /* $- saved */
    778778                        memcpy(optlist, lvp->text, sizeof_optlist);
     
    801801                setvar(argv[1], argv[2], 0);
    802802        else
    803                 error("List assignment not implemented");
     803                error(psh, "List assignment not implemented");
    804804        return 0;
    805805}
Note: See TracChangeset for help on using the changeset viewer.