|
11 | 11 |
|
12 | 12 | #include<ctype.h> |
13 | 13 |
|
14 | | -staticvoidputenv2(constchar*var,constchar*val); |
15 | | - |
16 | 14 | /* |
17 | 15 | * get_control_data() |
18 | 16 | * |
@@ -85,21 +83,21 @@ get_control_data(ClusterInfo *cluster, bool live_check) |
85 | 83 | if (getenv("LC_MESSAGES")) |
86 | 84 | lc_messages=pg_strdup(getenv("LC_MESSAGES")); |
87 | 85 |
|
88 | | -putenv2("LC_COLLATE",NULL); |
89 | | -putenv2("LC_CTYPE",NULL); |
90 | | -putenv2("LC_MONETARY",NULL); |
91 | | -putenv2("LC_NUMERIC",NULL); |
92 | | -putenv2("LC_TIME",NULL); |
93 | | -putenv2("LANG", |
| 86 | +pg_putenv("LC_COLLATE",NULL); |
| 87 | +pg_putenv("LC_CTYPE",NULL); |
| 88 | +pg_putenv("LC_MONETARY",NULL); |
| 89 | +pg_putenv("LC_NUMERIC",NULL); |
| 90 | +pg_putenv("LC_TIME",NULL); |
| 91 | +pg_putenv("LANG", |
94 | 92 | #ifndefWIN32 |
95 | 93 | NULL); |
96 | 94 | #else |
97 | 95 | /* On Windows the default locale cannot be English, so force it */ |
98 | 96 | "en"); |
99 | 97 | #endif |
100 | | -putenv2("LANGUAGE",NULL); |
101 | | -putenv2("LC_ALL",NULL); |
102 | | -putenv2("LC_MESSAGES","C"); |
| 98 | +pg_putenv("LANGUAGE",NULL); |
| 99 | +pg_putenv("LC_ALL",NULL); |
| 100 | +pg_putenv("LC_MESSAGES","C"); |
103 | 101 |
|
104 | 102 | snprintf(cmd,sizeof(cmd),SYSTEMQUOTE"\"%s/%s \"%s\""SYSTEMQUOTE, |
105 | 103 | cluster->bindir, |
@@ -374,15 +372,15 @@ get_control_data(ClusterInfo *cluster, bool live_check) |
374 | 372 | /* |
375 | 373 | * Restore environment variables |
376 | 374 | */ |
377 | | -putenv2("LC_COLLATE",lc_collate); |
378 | | -putenv2("LC_CTYPE",lc_ctype); |
379 | | -putenv2("LC_MONETARY",lc_monetary); |
380 | | -putenv2("LC_NUMERIC",lc_numeric); |
381 | | -putenv2("LC_TIME",lc_time); |
382 | | -putenv2("LANG",lang); |
383 | | -putenv2("LANGUAGE",language); |
384 | | -putenv2("LC_ALL",lc_all); |
385 | | -putenv2("LC_MESSAGES",lc_messages); |
| 375 | +pg_putenv("LC_COLLATE",lc_collate); |
| 376 | +pg_putenv("LC_CTYPE",lc_ctype); |
| 377 | +pg_putenv("LC_MONETARY",lc_monetary); |
| 378 | +pg_putenv("LC_NUMERIC",lc_numeric); |
| 379 | +pg_putenv("LC_TIME",lc_time); |
| 380 | +pg_putenv("LANG",lang); |
| 381 | +pg_putenv("LANGUAGE",language); |
| 382 | +pg_putenv("LC_ALL",lc_all); |
| 383 | +pg_putenv("LC_MESSAGES",lc_messages); |
386 | 384 |
|
387 | 385 | pg_free(lc_collate); |
388 | 386 | pg_free(lc_ctype); |
@@ -529,40 +527,3 @@ rename_old_pg_control(void) |
529 | 527 | pg_log(PG_FATAL,"Unable to rename %s to %s.\n",old_path,new_path); |
530 | 528 | check_ok(); |
531 | 529 | } |
532 | | - |
533 | | - |
534 | | -/* |
535 | | - *putenv2() |
536 | | - * |
537 | | - *This is like putenv(), but takes two arguments. |
538 | | - *It also does unsetenv() if val is NULL. |
539 | | - */ |
540 | | -staticvoid |
541 | | -putenv2(constchar*var,constchar*val) |
542 | | -{ |
543 | | -if (val) |
544 | | -{ |
545 | | -#ifndefWIN32 |
546 | | -char*envstr= (char*)pg_malloc(strlen(var)+ |
547 | | -strlen(val)+2); |
548 | | - |
549 | | -sprintf(envstr,"%s=%s",var,val); |
550 | | -putenv(envstr); |
551 | | - |
552 | | -/* |
553 | | - * Do not free envstr because it becomes part of the environment on |
554 | | - * some operating systems.See port/unsetenv.c::unsetenv. |
555 | | - */ |
556 | | -#else |
557 | | -SetEnvironmentVariableA(var,val); |
558 | | -#endif |
559 | | -} |
560 | | -else |
561 | | -{ |
562 | | -#ifndefWIN32 |
563 | | -unsetenv(var); |
564 | | -#else |
565 | | -SetEnvironmentVariableA(var,""); |
566 | | -#endif |
567 | | -} |
568 | | -} |