Lines Matching +defs:name +defs:text

18  * 3. Neither the name of the University nor the names of its contributors
90 const char *text;
319 if (find_var(ip->text, &vpp, &vp->name_len) != NULL)
323 vp->text = strdup(ip->text);
334 vps1.text = NULL;
345 free(vps1.text);
346 vps1.text = strdup(u != 0 ? "PS1=$ " : "PS1=# ");
356 * Validate a string as a valid variable name
360 * If not NULL, the length of the (intended) name is returned via len
364 validname(const char *name, int term, int *len)
366 const char *p = name;
386 *len = p - name;
396 setvarsafe(const char *name, const char *val, int flags)
406 setvar(name, val, flags);
432 * This always copies name and val when setting a variable, so
439 setvar(const char *name, const char *val, int flags)
448 p = name;
451 error("%.*s: bad variable name", namelen, name);
459 q = name;
473 * the first argument as name=value. Since the first argument will
491 VTRACE(DBG_VARS, ("was [%s] fl:%#x\n", vp->text,
498 error("%.*s: is read only", vp->name_len, vp->text);
512 ckfree(vp->text);
529 vp->text = s;
550 vp->text = s;
592 * this cannot fail, the var name is OK,
610 setvareq(savestr(lp->text), flags);
621 mklocal(lp->text, flags);
630 lookupvar(const char *name)
635 v = find_var(name, NULL, NULL);
643 p = v->text;
657 bltinlookup(const char *name, int doall)
664 if (strequal(sp->text, name))
665 return strchr(sp->text, '=') + 1;
668 v = find_var(name, NULL, NULL);
678 p = v->text;
715 *ep++ = vp->text;
749 ckfree(vp->text);
754 vp->text = savestr(vp->text);
806 char *t1 = (*v1)->text, *t2 = (*v2)->text;
849 p = vp->text;
855 p = vp->text;
940 char *name;
1007 while ((name = *argptr++) != NULL) {
1010 vp = find_var(name, NULL, &len);
1011 if (name[len] == '=')
1013 if (!goodname(name))
1014 error("%s: bad variable name", name);
1033 while ((name = *argptr++) != NULL) {
1036 vp = find_var(name, NULL, &len);
1037 if (name[len] == '=')
1039 if (!goodname(name))
1040 error("%s: bad variable name", name);
1049 while ((name = *argptr++) != NULL) {
1054 vp = find_var(name, NULL, &len);
1055 p = name + len;
1065 len, name);
1077 } else if (nflg && p == NULL && !goodname(name))
1078 error("%s: bad variable name", name);
1081 setvar(name, p, f);
1094 char *name;
1109 while ((name = *argptr++) != NULL) {
1110 mklocal(name, flags);
1119 * will be restored when the shell function returns. We handle the name
1124 mklocal(const char *name, int flags)
1132 if (name[0] == '-' && name[1] == '\0') {
1135 lvp->text = memcpy(p, optlist, sizeof_optlist);
1140 vp = find_var(name, &vpp, NULL);
1143 if (strchr(name, '='))
1144 setvareq(savestr(name),
1147 setvar(name, NULL, VSTRFIXED|flags);
1149 lvp->text = NULL;
1153 lvp->text = vp->text;
1165 if (name[vp->name_len] == '=')
1166 setvareq(savestr(name), flags & ~VUNSET);
1168 unsetvar(name, 0);
1173 if (name[vp->name_len] == '=')
1200 VTRACE(DBG_VARS, ("poplocalvar %s\n", vp ? vp->text : "-"));
1202 memcpy(optlist, lvp->text, sizeof_optlist);
1203 ckfree(lvp->text);
1207 (void)unsetvar(vp->text, 0);
1210 (*lvp->func)(lvp->text + vp->name_len + 1,
1213 ckfree(vp->text);
1215 vp->text = lvp->text;
1239 * with the same name.
1301 if (vp->text[vp->name_len + 1] != '\0' || !(vp->flags & VUNSET))
1308 ckfree(vp->text);
1320 * variable name is terminated by '='; the second may be terminated by
1338 * 'name' may be terminated by '=' or a NUL.
1340 * lenp is set to the number of characters in 'name'
1344 find_var(const char *name, struct var ***vppp, int *lenp)
1349 const char *p = name;
1355 len = p - name;
1369 if (memcmp(vp->text, name, len) != 0)
1384 * the value returned is vp->text
1470 return vp->text;
1473 snprintf(result, length, "%.*s=%d", vp->name_len, vp->text, ln);
1490 return vp->text;
1492 memcpy(buf.b, vp->text, vp->name_len + 1); /* include '=' */
1541 memcpy(buf.b, vp->text, vp->name_len+1);
1575 return vp->text;
1589 return vp->text;
1591 snprintf(buf.b, buf.len, "%.*s=%jd", vp->name_len, vp->text, secs);
1612 return vp->text;
1617 snprintf(buf.b, buf.len, "%.*s=%s", vp->name_len, vp->text,
1623 return vp->text;
1640 if (vp->text != buf.b) {
1644 if (vp->text[vp->name_len + 1] == '\0') {
1667 random_val = strtoimax(vp->text+vp->name_len+1,NULL,0);
1679 return vp->text;
1681 snprintf(buf.b, buf.len, "%.*s=%jd", vp->name_len, vp->text,
1685 if (buf.b != vp->text && (vp->flags & (VTEXTFIXED|VSTACK)) == 0)
1686 free(vp->text);
1688 vp->text = buf.b;
1691 return vp->text;
1697 makespecial(const char *name)
1702 CTRACE(DBG_VARS, ("makespecial('%s') -> ", name));
1704 if (strequal(ip->text, name)) {