Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2288977

Browse files
committed
Make the locale location relocatable.
Adjust get_*_path functions to be limited to MAXPGPATH.
1 parent244ee0c commit2288977

File tree

26 files changed

+158
-122
lines changed

26 files changed

+158
-122
lines changed

‎src/backend/main/main.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.81 2004/05/24 02:47:44 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.82 2004/05/25 01:00:20 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -150,6 +150,8 @@ main(int argc, char *argv[])
150150
* startup error messages to be localized.
151151
*/
152152

153+
set_pglocale(argv[0],"postgres");
154+
153155
#ifdefWIN32
154156
/*
155157
* Windows uses codepages rather than the environment, so we work around
@@ -185,11 +187,6 @@ main(int argc, char *argv[])
185187
setlocale(LC_NUMERIC,"C");
186188
setlocale(LC_TIME,"C");
187189

188-
#ifdefENABLE_NLS
189-
bindtextdomain("postgres",LOCALEDIR);
190-
textdomain("postgres");
191-
#endif
192-
193190
/*
194191
* Skip permission checks if we're just trying to do --help or
195192
* --version; otherwise root will get unhelpful failure messages from

‎src/bin/initdb/initdb.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.32 2004/05/18 03:36:36 momjian Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.33 2004/05/25 01:00:22 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -167,7 +167,7 @@ static void check_ok(void);
167167
staticboolchklocale(constchar*locale);
168168
staticvoidsetlocales(void);
169169
staticvoidusage(constchar*progname);
170-
staticvoidinit_nls(void);
170+
staticvoidinit_nls(constchar*argv0);
171171

172172

173173
/*
@@ -1754,13 +1754,9 @@ usage(const char *progname)
17541754
* Initialized NLS if enabled.
17551755
*/
17561756
staticvoid
1757-
init_nls(void)
1757+
init_nls(constchar*argv0)
17581758
{
1759-
#ifdefENABLE_NLS
1760-
setlocale(LC_ALL,"");
1761-
bindtextdomain("initdb",LOCALEDIR);
1762-
textdomain("initdb");
1763-
#endif
1759+
set_pglocale(argv0,"initdb");
17641760
}
17651761

17661762

@@ -1801,7 +1797,7 @@ main(int argc, char *argv[])
18011797
* environment */
18021798
char*subdirs[]=
18031799
{"global","pg_xlog","pg_clog","base","base/1"};
1804-
init_nls();
1800+
init_nls(argv[0]);
18051801

18061802
progname=get_progname(argv[0]);
18071803

‎src/bin/pg_controldata/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1998-2002, PostgreSQL Global Development Group
66
#
7-
# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.7 2004/04/30 20:01:39 momjian Exp $
7+
# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.8 2004/05/2501:00:23 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
1414

1515
overrideCPPFLAGS += -DFRONTEND
1616

17-
OBJS= pg_controldata.o pg_crc.o
17+
OBJS= pg_controldata.o pg_crc.o exec.o
1818

1919
all: submake-libpgport pg_controldata
2020

@@ -24,6 +24,9 @@ pg_controldata: $(OBJS)
2424
pg_crc.c:$(top_srcdir)/src/backend/utils/hash/pg_crc.c
2525
rm -f$@&&$(LN_S)$<.
2626

27+
exec.c:% :$(top_srcdir)/src/port/%
28+
rm -f$@&&$(LN_S)$<.
29+
2730
install: all installdirs
2831
$(INSTALL_PROGRAM) pg_controldata$(X)$(DESTDIR)$(bindir)/pg_controldata$(X)
2932

@@ -34,4 +37,4 @@ uninstall:
3437
rm -f$(DESTDIR)$(bindir)/pg_controldata$(X)
3538

3639
cleandistcleanmaintainer-clean:
37-
rm -f pg_controldata$(X) pg_controldata.o pg_crc.o pg_crc.c
40+
rm -f pg_controldata$(X) pg_controldata.o pg_crc.o pg_crc.c exec.c

‎src/bin/pg_controldata/pg_controldata.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
77
* licence: BSD
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.15 2004/05/12 13:38:43 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.16 2004/05/25 01:00:23 momjian Exp $
1010
*/
1111
#include"postgres.h"
1212

@@ -77,11 +77,7 @@ main(int argc, char *argv[])
7777
char*strftime_fmt="%c";
7878
constchar*progname;
7979

80-
setlocale(LC_ALL,"");
81-
#ifdefENABLE_NLS
82-
bindtextdomain("pg_controldata",LOCALEDIR);
83-
textdomain("pg_controldata");
84-
#endif
80+
set_pglocale(argv[0],"pg_controldata");
8581

8682
progname=get_progname(argv[0]);
8783

‎src/bin/pg_dump/Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.51 2004/05/24 01:01:37 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.52 2004/05/25 01:00:24 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -17,8 +17,7 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
1717

1818
OBJS=pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o\
1919
pg_backup_files.o pg_backup_null.o pg_backup_tar.o\
20-
dumputils.o
21-
PG_DUMPALL_OBJS = exec.o
20+
dumputils.o exec.o
2221

2322
EXTRA_OBJS =$(top_builddir)/src/backend/parser/keywords.o
2423

@@ -31,8 +30,8 @@ pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
3130
pg_restore: pg_restore.o$(OBJS)$(libpq_builddir)/libpq.a
3231
$(CC)$(CFLAGS) pg_restore.o$(OBJS)$(EXTRA_OBJS)$(libpq)$(LDFLAGS)$(LIBS) -o$@$(X)
3332

34-
pg_dumpall: pg_dumpall.o dumputils.o$(PG_DUMPALL_OBJS)$(libpq_builddir)/libpq.a
35-
$(CC)$(CFLAGS) pg_dumpall.o dumputils.o$(PG_DUMPALL_OBJS)$(EXTRA_OBJS)$(libpq)$(LDFLAGS)$(LIBS) -o$@$(X)
33+
pg_dumpall: pg_dumpall.o dumputils.oexec.o$(libpq_builddir)/libpq.a
34+
$(CC)$(CFLAGS) pg_dumpall.o dumputils.oexec.o$(EXTRA_OBJS)$(libpq)$(LDFLAGS)$(LIBS) -o$@$(X)
3635

3736
# We need our own build of exec.c so it gets made with -DFRONTEND
3837
exec.c:% :$(top_srcdir)/src/port/%
@@ -55,4 +54,4 @@ uninstall:
5554
rm -f$(addprefix$(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) pg_dumpall$(X))
5655

5756
cleandistcleanmaintainer-clean:
58-
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X)$(OBJS)$(PG_DUMPALL_OBJS)pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o exec.c
57+
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X)$(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o exec.c

‎src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.370 2004/03/24 03:06:08 momjian Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.371 2004/05/25 01:00:24 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -242,11 +242,7 @@ main(int argc, char **argv)
242242
};
243243
intoptindex;
244244

245-
#ifdefENABLE_NLS
246-
setlocale(LC_ALL,"");
247-
bindtextdomain("pg_dump",LOCALEDIR);
248-
textdomain("pg_dump");
249-
#endif
245+
set_pglocale(argv[0],"pg_dump");
250246

251247
g_verbose= false;
252248

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.34 2004/05/19 21:21:26 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.35 2004/05/25 01:00:24 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -101,11 +101,7 @@ main(int argc, char *argv[])
101101

102102
intoptindex;
103103

104-
#ifdefENABLE_NLS
105-
setlocale(LC_ALL,"");
106-
bindtextdomain("pg_dump",LOCALEDIR);
107-
textdomain("pg_dump");
108-
#endif
104+
set_pglocale(argv[0],"pg_dump");
109105

110106
progname=get_progname(argv[0]);
111107

‎src/bin/pg_dump/pg_restore.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
*
3636
* IDENTIFICATION
37-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.56 2004/04/22 02:39:10 momjian Exp $
37+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.57 2004/05/25 01:00:24 momjian Exp $
3838
*
3939
*-------------------------------------------------------------------------
4040
*/
@@ -121,11 +121,7 @@ main(int argc, char **argv)
121121
{NULL,0,NULL,0}
122122
};
123123

124-
#ifdefENABLE_NLS
125-
setlocale(LC_ALL,"");
126-
bindtextdomain("pg_dump",LOCALEDIR);
127-
textdomain("pg_dump");
128-
#endif
124+
set_pglocale(argv[0],"pg_dump");
129125

130126
opts=NewRestoreOptions();
131127

‎src/bin/pg_resetxlog/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1998-2002, PostgreSQL Global Development Group
66
#
7-
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.9 2004/05/24 01:01:37 momjian Exp $
7+
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.10 2004/05/25 01:00:25 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
1414

1515
overrideCPPFLAGS += -DFRONTEND
1616

17-
OBJS= pg_resetxlog.o pg_crc.o dirmod.o
17+
OBJS= pg_resetxlog.o pg_crc.o dirmod.o exec.o
1818

1919
all: submake-libpgport pg_resetxlog
2020

@@ -27,6 +27,9 @@ dirmod.c: % : $(top_srcdir)/src/port/%
2727
pg_crc.c:$(top_srcdir)/src/backend/utils/hash/pg_crc.c
2828
rm -f$@&&$(LN_S)$<.
2929

30+
exec.c:% :$(top_srcdir)/src/port/%
31+
rm -f$@&&$(LN_S)$<.
32+
3033
install: all installdirs
3134
$(INSTALL_PROGRAM) pg_resetxlog$(X)$(DESTDIR)$(bindir)/pg_resetxlog$(X)
3235

@@ -37,4 +40,4 @@ uninstall:
3740
rm -f$(DESTDIR)$(bindir)/pg_resetxlog$(X)
3841

3942
cleandistcleanmaintainer-clean:
40-
rm -f pg_resetxlog$(X) pg_crc.c dirmod.c$(OBJS)
43+
rm -f pg_resetxlog$(X) pg_crc.c dirmod.cexec.c$(OBJS)

‎src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.18 2004/05/12 13:38:44 momjian Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.19 2004/05/25 01:00:25 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -102,11 +102,7 @@ main(int argc, char *argv[])
102102
intfd;
103103
charpath[MAXPGPATH];
104104

105-
setlocale(LC_ALL,"");
106-
#ifdefENABLE_NLS
107-
bindtextdomain("pg_resetxlog",LOCALEDIR);
108-
textdomain("pg_resetxlog");
109-
#endif
105+
set_pglocale(argv[0],"pg_resetxlog");
110106

111107
progname=get_progname(argv[0]);
112108

‎src/bin/psql/startup.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.93 2004/05/17 14:35:33 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.94 2004/05/25 01:00:26 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99

@@ -102,11 +102,7 @@ main(int argc, char *argv[])
102102
char*password=NULL;
103103
boolneed_pass;
104104

105-
setlocale(LC_ALL,"");
106-
#ifdefENABLE_NLS
107-
bindtextdomain("psql",LOCALEDIR);
108-
textdomain("psql");
109-
#endif
105+
set_pglocale(argv[0],"psql");
110106

111107
pset.progname=get_progname(argv[0]);
112108

‎src/bin/scripts/Makefile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.26 2004/04/26 17:40:48 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.27 2004/05/25 01:00:27 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -15,21 +15,24 @@ include $(top_builddir)/src/Makefile.global
1515

1616
PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb
1717

18-
overrideCPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir)$(CPPFLAGS)
18+
overrideCPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir)$(CPPFLAGS)
1919

2020
all: submake-libpq submake-backend$(PROGRAMS)
2121

2222
%:%.o
2323
$(CC)$(CFLAGS)$^$(libpq)$(LDFLAGS)$(LIBS) -o$@$(X)
2424

25-
createdb: createdb.o common.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
26-
createlang: createlang.o common.o print.o mbprint.o
27-
createuser: createuser.o common.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
28-
dropdb: dropdb.o common.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
29-
droplang: droplang.o common.o print.o mbprint.o
30-
dropuser: dropuser.o common.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
31-
clusterdb: clusterdb.o common.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
32-
vacuumdb: vacuumdb.o common.o
25+
createdb: createdb.o common.o exec.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
26+
createlang: createlang.o common.o exec.o print.o mbprint.o
27+
createuser: createuser.o common.o exec.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
28+
dropdb: dropdb.o common.o exec.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
29+
droplang: droplang.o common.o exec.o print.o mbprint.o
30+
dropuser: dropuser.o common.o exec.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
31+
clusterdb: clusterdb.o common.o exec.o dumputils.o$(top_builddir)/src/backend/parser/keywords.o
32+
vacuumdb: vacuumdb.o common.o exec.o
33+
34+
exec.c:% :$(top_srcdir)/src/port/%
35+
rm -f$@&&$(LN_S)$<.
3336

3437
dumputils.c:% :$(top_srcdir)/src/bin/pg_dump/%
3538
rm -f$@&&$(LN_S)$<.
@@ -60,4 +63,4 @@ uninstall:
6063

6164

6265
cleandistcleanmaintainer-clean:
63-
rm -f$(addsuffix$(X),$(PROGRAMS))$(addsuffix .o,$(PROGRAMS)) common.o dumputils.o print.o mbprint.o dumputils.c print.c mbprint.c
66+
rm -f$(addsuffix$(X),$(PROGRAMS))$(addsuffix .o,$(PROGRAMS)) common.o dumputils.o print.o mbprint.o dumputils.cexec.cprint.c mbprint.c

‎src/bin/scripts/clusterdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.6 2004/05/12 13:38:46 momjian Exp $
7+
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.7 2004/05/25 01:00:27 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
5858
char*table=NULL;
5959

6060
progname=get_progname(argv[0]);
61-
init_nls();
61+
init_nls(argv[0]);
6262
handle_help_version_opts(argc,argv,"clusterdb",help);
6363

6464
while ((c=getopt_long(argc,argv,"h:p:U:Weqd:at:",long_options,&optindex))!=-1)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp