ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/MirOS/mksh/dist/var.c
(Generate patch)

Comparing vendor/MirOS/mksh/dist/var.c (file contents):
Revision 6837 by laffer1, Wed Oct 1 01:13:56 2014 UTC vs.
Revision 6838 by laffer1, Sat Oct 4 14:21:02 2014 UTC

# Line 28 | Line 28
28   #include <sys/sysctl.h>
29   #endif
30  
31 < __RCSID("$MirOS: src/bin/mksh/var.c,v 1.181 2014/09/03 19:22:51 tg Exp $");
31 > __RCSID("$MirOS: src/bin/mksh/var.c,v 1.182 2014/10/03 17:20:03 tg Exp $");
32  
33   /*-
34   * Variables
# Line 751 | Line 751 | typeset(const char *var, uint32_t set, uint32_t clr, i
751                  }
752                  val += len;
753          }
754 <        if (val[0] == '=' || (val[0] == '+' && val[1] == '=')) {
754 >        if (val[0] == '=') {
755                  strndupx(tvar, var, val - var, ATEMP);
756 <                if (*val++ == '+') {
757 <                        ++val;
758 <                        vappend = true;
759 <                }
760 <        } else if ((val[0] != '\0') || (set & IMPORT)) {
761 <                /*
762 <                 * must have a = when setting a variable by importing
763 <                 * the original environment, otherwise be empty; we
764 <                 * also end up here when a variable name was invalid
765 <                 */
756 >                ++val;
757 >        } else if (set & IMPORT) {
758 >                /* environment invalid variable name or no assignment */
759 >                return (NULL);
760 >        } else if (val[0] == '+' && val[1] == '=') {
761 >                strndupx(tvar, var, val - var, ATEMP);
762 >                val += 2;
763 >                vappend = true;
764 >        } else if (val[0] != '\0') {
765 >                /* other invalid variable names (not from environment) */
766                  return (NULL);
767          } else {
768                  /* just varname with no value part nor equals sign */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines