|
23 | 23 | * Portions Copyright (c) 1994, Regents of the University of California
|
24 | 24 | *
|
25 | 25 | * IDENTIFICATION
|
26 |
| - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.114 2005/06/12 00:00:21 neilc Exp $ |
| 26 | + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.115 2005/07/06 16:25:59 tgl Exp $ |
27 | 27 | *
|
28 | 28 | *-------------------------------------------------------------------------
|
29 | 29 | */
|
@@ -1128,13 +1128,21 @@ PQenv2encoding(void)
|
1128 | 1128 | char*
|
1129 | 1129 | libpq_gettext(constchar*msgid)
|
1130 | 1130 | {
|
1131 |
| -staticintalready_bound=0; |
| 1131 | +staticboolalready_bound=false; |
1132 | 1132 |
|
1133 | 1133 | if (!already_bound)
|
1134 | 1134 | {
|
1135 |
| -already_bound=1; |
| 1135 | +/* dgettext() preserves errno, but bindtextdomain() doesn't */ |
| 1136 | +intsave_errno=errno; |
| 1137 | +constchar*ldir; |
| 1138 | + |
| 1139 | +already_bound= true; |
1136 | 1140 | /* No relocatable lookup here because the binary could be anywhere */
|
1137 |
| -bindtextdomain("libpq",getenv("PGLOCALEDIR") ?getenv("PGLOCALEDIR") :LOCALEDIR); |
| 1141 | +ldir=getenv("PGLOCALEDIR"); |
| 1142 | +if (!ldir) |
| 1143 | +ldir=LOCALEDIR; |
| 1144 | +bindtextdomain("libpq",ldir); |
| 1145 | +errno=save_errno; |
1138 | 1146 | }
|
1139 | 1147 |
|
1140 | 1148 | returndgettext("libpq",msgid);
|
|