Lines Matching refs:vp

155 	struct var *vp;
159 for (ip = varinit ; (vp = ip->var) != NULL ; ip++) {
160 if (find_var(ip->text, &vpp, &vp->name_len) != NULL)
162 vp->next = *vpp;
163 *vpp = vp;
164 vp->text = __DECONST(char *, ip->text);
165 vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED;
166 vp->func = ip->func;
318 struct var *vp, **vpp;
325 vp = find_var(s, &vpp, &nlen);
326 if (vp != NULL) {
327 if (vp->flags & VREADONLY) {
330 error("%.*s: is read only", vp->name_len, vp->text);
339 if (vp->func && (flags & VNOFUNC) == 0)
340 (*vp->func)(s + vp->name_len + 1);
342 if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0)
343 ckfree(vp->text);
345 vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET);
346 vp->flags |= flags;
347 vp->text = s;
357 if ((vp == &vmpath || (vp == &vmail && ! mpathset())) &&
360 if ((vp->flags & VEXPORT) && localevar(s)) {
375 vp = ckmalloc(sizeof (*vp));
376 vp->flags = flags;
377 vp->text = s;
378 vp->name_len = nlen;
379 vp->next = *vpp;
380 vp->func = NULL;
381 *vpp = vp;
382 if ((vp->flags & VEXPORT) && localevar(s)) {
547 struct var *vp;
552 for (vp = *vpp ; vp ; vp = vp->next)
553 if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT)
558 for (vp = *vpp ; vp ; vp = vp->next)
559 if ((vp->flags & (VEXPORT|VUNSET)) == VEXPORT)
560 *ep++ = vp->text;
592 struct var *vp;
602 for (vp = *vpp; vp; vp = vp->next) {
603 if (!(vp->flags & VUNSET))
612 for (vp = *vpp; vp; vp = vp->next) {
613 if (!(vp->flags & VUNSET))
614 vars[i++] = vp->text;
648 struct var *vp;
673 vp = find_var(name, NULL, NULL);
674 if (vp != NULL) {
675 vp->flags |= flag;
676 if ((vp->flags & VEXPORT) && localevar(vp->text)) {
677 change_env(vp->text, 1);
688 for (vp = *vpp ; vp ; vp = vp->next) {
689 if (vp->flags & flag) {
696 if (!isassignment(vp->text))
701 if (values && !(vp->flags & VUNSET)) {
702 outbin(vp->text,
703 vp->name_len + 1, out1);
704 out1qstr(vp->text +
705 vp->name_len + 1);
707 outbin(vp->text, vp->name_len,
749 struct var *vp;
756 vp = NULL;
758 vp = find_var(name, &vpp, NULL);
759 if (vp == NULL) {
764 vp = *vpp; /* the new variable */
768 lvp->text = vp->text;
769 lvp->flags = vp->flags;
770 vp->flags |= VSTRFIXED|VTEXTFIXED;
771 if (name[vp->name_len] == '=')
775 lvp->vp = vp;
790 struct var *vp;
796 vp = lvp->vp;
797 if (vp == NULL) { /* $- saved */
802 vp->flags &= ~VREADONLY;
803 (void)unsetvar(vp->text);
805 islocalevar = (vp->flags | lvp->flags) & VEXPORT &&
807 if ((vp->flags & VTEXTFIXED) == 0)
808 ckfree(vp->text);
809 vp->flags = lvp->flags;
810 vp->text = lvp->text;
811 if (vp->func)
812 (*vp->func)(vp->text + vp->name_len + 1);
814 change_env(vp->text, vp->flags & VEXPORT &&
815 (vp->flags & VUNSET) == 0);
882 struct var *vp;
884 vp = find_var(s, &vpp, NULL);
885 if (vp == NULL)
887 if (vp->flags & VREADONLY)
889 if (vp->text[vp->name_len + 1] != '\0')
891 if ((vp->flags & VEXPORT) && localevar(vp->text)) {
896 vp->flags &= ~VEXPORT;
897 vp->flags |= VUNSET;
898 if ((vp->flags & VSTRFIXED) == 0) {
899 if ((vp->flags & VTEXTFIXED) == 0)
900 ckfree(vp->text);
901 *vpp = vp->next;
902 ckfree(vp);
930 * vppp is set to the pointer to vp, or the list head if vp isn't found
939 struct var *vp, **vpp;
953 for (vp = *vpp ; vp ; vpp = &vp->next, vp = *vpp) {
954 if (vp->name_len != len)
956 if (memcmp(vp->text, name, len) != 0)
960 return vp;