pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:2206:    pop_stack();    push_int (0);    }       else {    char *entry = getenv (var->str);    pop_stack();    if (!entry)    push_int (0);    else { -  char *eq = STRCHR (entry, '='); +  char *eq = strchr (entry, '=');    /* There should always be a '=' in the entry, but you never know.. */    push_string (make_shared_string (eq ? eq + 1 : entry));    }    }    }       else {   #ifdef DECLARE_ENVIRON    extern char **environ;   #endif
pike.git/src/builtin.cmod:2234:    * one in gnu libc). */    for (n = 0; environ[n]; n++) {}       m = allocate_mapping (n);   #ifndef USE_SETENV    if (env_allocs)    new_env_allocs = allocate_mapping (m_sizeof (env_allocs));   #endif /* !USE_SETENV */       while (--n >= 0) { -  char *entry = environ[n], *eq = STRCHR (entry, '='); +  char *entry = environ[n], *eq = strchr (entry, '=');    if (eq) { /* gnu libc getenv ignores variables without '='. */    struct pike_string *var = make_shared_binary_string (entry, eq - entry);    struct pike_string *val = make_shared_string (eq + 1);    mapping_string_insert_string (m, var, val);      #ifndef USE_SETENV    /* Populate new_env_allocs with the env_allocs entries that    * are still in use. */    if (env_allocs) {    struct svalue *ea_val = low_mapping_string_lookup (env_allocs, var);
pike.git/src/builtin.cmod:2277:    * updates the real environment. Everyone should use the version in    * the master instead so that the cache doesn't get stale. */   PIKEFUN void _putenv (string var, void|string val)   {   #ifndef USE_SETENV    struct pike_string *putenv_str, *env_alloc_var;   #endif       if (var->size_shift)    SIMPLE_ARG_TYPE_ERROR ("putenv", 1, "string(0..255)"); -  if (string_has_null (var) || STRCHR (var->str, '=')) +  if (string_has_null (var) || strchr (var->str, '='))    SIMPLE_ARG_ERROR ("putenv", 1, "Variable name cannot contain '=' or NUL.");       if (val) {   #ifndef USE_SETENV    struct string_builder sb;   #endif       if (val->size_shift)    SIMPLE_ARG_TYPE_ERROR ("putenv", 2, "void|string(0..255)");    if (string_has_null (val))