/* Reads all the environment variables from envp and populates
 * a hashmap for use through out the execution of the command
 */
void set_env_opts(

  memmgr   **mm,            /* memory manager */
  job_data **env_attr,
  char     **envp)

  {
  int   var_num = 0;
  char *name = NULL;
  char *value = NULL;
  int   rc = PBSE_NONE;

  while (envp[var_num] != NULL)
    {
    rc = parse_env_line(mm, envp[var_num], &name, &value);
    if (rc == PBSE_NONE) 
      {
      hash_add_item(mm, env_attr, name, value, ENV_DATA, SET);
      memmgr_free(mm, name); name = NULL;
      memmgr_free(mm, value); value = NULL;
      }

    var_num++;
    }
  } /* END set_env_opts() */
Exemple #2
0
/* Reads all the environment variables from envp and populates
 * a hashmap for use through out the execution of the command
 */
void set_env_opts(
  memmgr **mm,            /* memory manager */
  job_data **env_attr,
  char **envp)
  {
  int   var_num = 0;
  char *name = NULL;
  char *value = NULL;
  int   rc = PBSE_NONE;

  while (envp[var_num] != NULL)
    {
    rc = parse_env_line(mm, envp[var_num], &name, &value);
    if (rc != PBSE_NONE) 
      {
      fprintf(stderr, "Malformed environment variable %s. Will not add to job environment\n", envp[var_num]);
      ;
      exit(1);
      }

/*      strtolower(name); */
    hash_add_item(mm, env_attr, name, value, ENV_DATA, SET);
    memmgr_free(mm, name); name = NULL;
    memmgr_free(mm, value); value = NULL;

    var_num++;
    }
  } /* END set_env_opts() */
Exemple #3
0
/* Reads all the environment variables from envp and populates
 * a hashmap for use through out the execution of the command
 */
void set_env_opts(
  job_data_container *env_attr,
  char              **envp)

  {
  int   var_num = 0;
  char *name = NULL;
  char *value = NULL;
  int   rc = PBSE_NONE;

  while (envp[var_num] != NULL)
    {
    rc = parse_env_line(envp[var_num], &name, &value);
    if (rc == PBSE_NONE) 
      {
      hash_add_item(env_attr, name, value, ENV_DATA, SET);
      free(name); name = NULL;
      free(value); value = NULL;
      }

    var_num++;
    }
  } /* END set_env_opts() */