60 static char *dsenv_create_full_path(
72 root_dir, site, site, name, facility, level);
77 root_dir, site, site, name, facility);
85 "Could not get datastream path for: %s, %s%s%s.%s\n"
86 " -> memory allocation error\n",
87 root_dir, site, name, facility, level);
92 "Could not get datastream path for: %s, %s%s%s\n"
93 " -> memory allocation error\n",
94 root_dir, site, name, facility);
123 static char hostname[256];
126 if (gethostname(hostname, 255) == -1) {
129 "Could not get hostname: %s\n", strerror(errno));
131 return((
char *)NULL);
157 const char *env_value = getenv(name);
160 *value = (
char *)NULL;
164 *value = strdup(env_value);
168 "Could not get environment variable: %s\n"
169 " -> memory allocation error\n", name);
197 va_start(args, format);
204 "Could not set environment variable: %s\n"
205 " -> memory allocation error\n", name);
212 status = setenv(name, value, 1);
218 "Could not set environment variable: %s\n"
219 " -> %s\n", name, strerror(errno));
251 const char *proc_name,
252 const char *proc_type,
255 char *env_var = (
char *)NULL;
256 char *lc_type = (
char *)NULL;
261 typelen = strlen(proc_type);
263 if (!(env_var = malloc((typelen + 6) *
sizeof(
char))) ||
264 !(lc_type = malloc((typelen + 1) *
sizeof(
char)))) {
267 "Could not get apps conf path for: %s, %s\n"
268 " -> memory allocation error\n",
269 proc_name, proc_type);
271 if (env_var) free(env_var);
276 for (i = 0; i < typelen; ++i) {
277 env_var[i] = toupper(proc_type[i]);
278 lc_type[i] = tolower(proc_type[i]);
282 strcpy(&(env_var[i]),
"_HOME");
284 root_dir = getenv(env_var);
288 *path = (
char *)NULL;
294 root_dir, lc_type, proc_name);
301 "Could not get apps conf path for: %s, %s\n"
302 " -> memory allocation error\n",
303 proc_name, proc_type);
340 const char *proc_name,
341 const char *proc_type,
343 const char *facility,
354 *path = (
char *)NULL;
358 *path = dsenv_create_full_path(
359 root_dir, site, facility, name, level);
419 const char *facility,
424 const char *root_dir = getenv(
"COLLECTION_DATA");
427 *path = (
char *)NULL;
431 *path = dsenv_create_full_path(
432 root_dir, site, facility, name, level);
491 const char *facility,
496 const char *root_dir = getenv(
"CONF_DATA");
499 *path = (
char *)NULL;
503 *path = dsenv_create_full_path(
504 root_dir, site, facility, name, level);
562 const char *facility,
567 const char *root_dir = getenv(
"DATASTREAM_DATA");
570 *path = (
char *)NULL;
574 *path = dsenv_create_full_path(
575 root_dir, site, facility, name, level);
650 const char *facility,
655 const char *root_dir = getenv(
"DATASTREAM_DATA_IN");
658 root_dir = getenv(
"DATASTREAM_DATA");
660 *path = (
char *)NULL;
665 *path = dsenv_create_full_path(
666 root_dir, site, facility, name, level);
741 const char *facility,
746 const char *root_dir = getenv(
"DATASTREAM_DATA_OUT");
749 root_dir = getenv(
"DATASTREAM_DATA");
751 *path = (
char *)NULL;
756 *path = dsenv_create_full_path(
757 root_dir, site, facility, name, level);