Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
22889777
Commit
22889777
authored
May 25, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the locale location relocatable.
Adjust get_*_path functions to be limited to MAXPGPATH.
parent
244ee0c0
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
158 additions
and
122 deletions
+158
-122
src/backend/main/main.c
src/backend/main/main.c
+3
-6
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+5
-9
src/bin/pg_controldata/Makefile
src/bin/pg_controldata/Makefile
+6
-3
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_controldata/pg_controldata.c
+2
-6
src/bin/pg_dump/Makefile
src/bin/pg_dump/Makefile
+5
-6
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+2
-6
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+2
-6
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/pg_restore.c
+2
-6
src/bin/pg_resetxlog/Makefile
src/bin/pg_resetxlog/Makefile
+6
-3
src/bin/pg_resetxlog/pg_resetxlog.c
src/bin/pg_resetxlog/pg_resetxlog.c
+2
-6
src/bin/psql/startup.c
src/bin/psql/startup.c
+2
-6
src/bin/scripts/Makefile
src/bin/scripts/Makefile
+14
-11
src/bin/scripts/clusterdb.c
src/bin/scripts/clusterdb.c
+2
-2
src/bin/scripts/common.c
src/bin/scripts/common.c
+3
-7
src/bin/scripts/common.h
src/bin/scripts/common.h
+1
-1
src/bin/scripts/createdb.c
src/bin/scripts/createdb.c
+2
-2
src/bin/scripts/createlang.c
src/bin/scripts/createlang.c
+2
-2
src/bin/scripts/createuser.c
src/bin/scripts/createuser.c
+2
-2
src/bin/scripts/dropdb.c
src/bin/scripts/dropdb.c
+2
-2
src/bin/scripts/droplang.c
src/bin/scripts/droplang.c
+2
-2
src/bin/scripts/dropuser.c
src/bin/scripts/dropuser.c
+2
-2
src/bin/scripts/vacuumdb.c
src/bin/scripts/vacuumdb.c
+2
-2
src/include/port.h
src/include/port.h
+3
-1
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-misc.c
+2
-1
src/port/Makefile
src/port/Makefile
+2
-1
src/port/path.c
src/port/path.c
+80
-21
No files found.
src/backend/main/main.c
View file @
22889777
...
...
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.8
1 2004/05/24 02:47:44
momjian Exp $
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.8
2 2004/05/25 01:00:20
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -150,6 +150,8 @@ main(int argc, char *argv[])
* startup error messages to be localized.
*/
set_pglocale
(
argv
[
0
],
"postgres"
);
#ifdef WIN32
/*
* Windows uses codepages rather than the environment, so we work around
...
...
@@ -185,11 +187,6 @@ main(int argc, char *argv[])
setlocale
(
LC_NUMERIC
,
"C"
);
setlocale
(
LC_TIME
,
"C"
);
#ifdef ENABLE_NLS
bindtextdomain
(
"postgres"
,
LOCALEDIR
);
textdomain
(
"postgres"
);
#endif
/*
* Skip permission checks if we're just trying to do --help or
* --version; otherwise root will get unhelpful failure messages from
...
...
src/bin/initdb/initdb.c
View file @
22889777
...
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.3
2 2004/05/18 03:36:36
momjian Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.3
3 2004/05/25 01:00:22
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -167,7 +167,7 @@ static void check_ok(void);
static
bool
chklocale
(
const
char
*
locale
);
static
void
setlocales
(
void
);
static
void
usage
(
const
char
*
progname
);
static
void
init_nls
(
void
);
static
void
init_nls
(
const
char
*
argv0
);
/*
...
...
@@ -1754,13 +1754,9 @@ usage(const char *progname)
* Initialized NLS if enabled.
*/
static
void
init_nls
(
void
)
init_nls
(
const
char
*
argv0
)
{
#ifdef ENABLE_NLS
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"initdb"
,
LOCALEDIR
);
textdomain
(
"initdb"
);
#endif
set_pglocale
(
argv0
,
"initdb"
);
}
...
...
@@ -1801,7 +1797,7 @@ main(int argc, char *argv[])
* environment */
char
*
subdirs
[]
=
{
"global"
,
"pg_xlog"
,
"pg_clog"
,
"base"
,
"base/1"
};
init_nls
();
init_nls
(
argv
[
0
]
);
progname
=
get_progname
(
argv
[
0
]);
...
...
src/bin/pg_controldata/Makefile
View file @
22889777
...
...
@@ -4,7 +4,7 @@
#
# Copyright (c) 1998-2002, PostgreSQL Global Development Group
#
# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.
7 2004/04/30 20:01:39
momjian Exp $
# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.
8 2004/05/25 01:00:23
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
override
CPPFLAGS
+=
-DFRONTEND
OBJS
=
pg_controldata.o pg_crc.o
OBJS
=
pg_controldata.o pg_crc.o
exec.o
all
:
submake-libpgport pg_controldata
...
...
@@ -24,6 +24,9 @@ pg_controldata: $(OBJS)
pg_crc.c
:
$(top_srcdir)/src/backend/utils/hash/pg_crc.c
rm
-f
$@
&&
$(LN_S)
$<
.
exec.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
install
:
all installdirs
$(INSTALL_PROGRAM)
pg_controldata
$(X)
$(DESTDIR)$(bindir)
/pg_controldata
$(X)
...
...
@@ -34,4 +37,4 @@ uninstall:
rm
-f
$(DESTDIR)$(bindir)
/pg_controldata
$(X)
clean distclean maintainer-clean
:
rm
-f
pg_controldata
$(X)
pg_controldata.o pg_crc.o pg_crc.c
rm
-f
pg_controldata
$(X)
pg_controldata.o pg_crc.o pg_crc.c
exec.c
src/bin/pg_controldata/pg_controldata.c
View file @
22889777
...
...
@@ -6,7 +6,7 @@
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
* licence: BSD
*
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.1
5 2004/05/12 13:38:4
3 momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.1
6 2004/05/25 01:00:2
3 momjian Exp $
*/
#include "postgres.h"
...
...
@@ -77,11 +77,7 @@ main(int argc, char *argv[])
char
*
strftime_fmt
=
"%c"
;
const
char
*
progname
;
setlocale
(
LC_ALL
,
""
);
#ifdef ENABLE_NLS
bindtextdomain
(
"pg_controldata"
,
LOCALEDIR
);
textdomain
(
"pg_controldata"
);
#endif
set_pglocale
(
argv
[
0
],
"pg_controldata"
);
progname
=
get_progname
(
argv
[
0
]);
...
...
src/bin/pg_dump/Makefile
View file @
22889777
...
...
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.5
1 2004/05/24 01:01:37
momjian Exp $
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.5
2 2004/05/25 01:00:24
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -17,8 +17,7 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
OBJS
=
pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o
\
pg_backup_files.o pg_backup_null.o pg_backup_tar.o
\
dumputils.o
PG_DUMPALL_OBJS
=
exec.o
dumputils.o exec.o
EXTRA_OBJS
=
$(top_builddir)
/src/backend/parser/keywords.o
...
...
@@ -31,8 +30,8 @@ pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
pg_restore
:
pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC)
$(CFLAGS)
pg_restore.o
$(OBJS)
$(EXTRA_OBJS)
$(libpq)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
pg_dumpall
:
pg_dumpall.o dumputils.o
$(PG_DUMPALL_OBJS)
$(libpq_builddir)/libpq.a
$(CC)
$(CFLAGS)
pg_dumpall.o dumputils.o
$(PG_DUMPALL_OBJS)
$(EXTRA_OBJS)
$(libpq)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
pg_dumpall
:
pg_dumpall.o dumputils.o
exec.o
$(libpq_builddir)/libpq.a
$(CC)
$(CFLAGS)
pg_dumpall.o dumputils.o
exec.o
$(EXTRA_OBJS)
$(libpq)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
# We need our own build of exec.c so it gets made with -DFRONTEND
exec.c
:
% : $(top_srcdir)/src/port/%
...
...
@@ -55,4 +54,4 @@ uninstall:
rm
-f
$(
addprefix
$(DESTDIR)$(bindir)
/, pg_dump
$(X)
pg_restore
$(X)
pg_dumpall
$(X)
)
clean distclean maintainer-clean
:
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
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
View file @
22889777
...
...
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.37
0 2004/03/24 03:06:08
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.37
1 2004/05/25 01:00:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -242,11 +242,7 @@ main(int argc, char **argv)
};
int
optindex
;
#ifdef ENABLE_NLS
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"pg_dump"
,
LOCALEDIR
);
textdomain
(
"pg_dump"
);
#endif
set_pglocale
(
argv
[
0
],
"pg_dump"
);
g_verbose
=
false
;
...
...
src/bin/pg_dump/pg_dumpall.c
View file @
22889777
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.3
4 2004/05/19 21:21:26
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.3
5 2004/05/25 01:00:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -101,11 +101,7 @@ main(int argc, char *argv[])
int
optindex
;
#ifdef ENABLE_NLS
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"pg_dump"
,
LOCALEDIR
);
textdomain
(
"pg_dump"
);
#endif
set_pglocale
(
argv
[
0
],
"pg_dump"
);
progname
=
get_progname
(
argv
[
0
]);
...
...
src/bin/pg_dump/pg_restore.c
View file @
22889777
...
...
@@ -34,7 +34,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.5
6 2004/04/22 02:39:10
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.5
7 2004/05/25 01:00:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -121,11 +121,7 @@ main(int argc, char **argv)
{
NULL
,
0
,
NULL
,
0
}
};
#ifdef ENABLE_NLS
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"pg_dump"
,
LOCALEDIR
);
textdomain
(
"pg_dump"
);
#endif
set_pglocale
(
argv
[
0
],
"pg_dump"
);
opts
=
NewRestoreOptions
();
...
...
src/bin/pg_resetxlog/Makefile
View file @
22889777
...
...
@@ -4,7 +4,7 @@
#
# Copyright (c) 1998-2002, PostgreSQL Global Development Group
#
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.
9 2004/05/24 01:01:37
momjian Exp $
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.
10 2004/05/25 01:00:25
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
override
CPPFLAGS
+=
-DFRONTEND
OBJS
=
pg_resetxlog.o pg_crc.o dirmod.o
OBJS
=
pg_resetxlog.o pg_crc.o dirmod.o
exec.o
all
:
submake-libpgport pg_resetxlog
...
...
@@ -27,6 +27,9 @@ dirmod.c: % : $(top_srcdir)/src/port/%
pg_crc.c
:
$(top_srcdir)/src/backend/utils/hash/pg_crc.c
rm
-f
$@
&&
$(LN_S)
$<
.
exec.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
install
:
all installdirs
$(INSTALL_PROGRAM)
pg_resetxlog
$(X)
$(DESTDIR)$(bindir)
/pg_resetxlog
$(X)
...
...
@@ -37,4 +40,4 @@ uninstall:
rm
-f
$(DESTDIR)$(bindir)
/pg_resetxlog
$(X)
clean distclean maintainer-clean
:
rm
-f
pg_resetxlog
$(X)
pg_crc.c dirmod.c
$(OBJS)
rm
-f
pg_resetxlog
$(X)
pg_crc.c dirmod.c
exec.c
$(OBJS)
src/bin/pg_resetxlog/pg_resetxlog.c
View file @
22889777
...
...
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.1
8 2004/05/12 13:38:44
momjian Exp $
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.1
9 2004/05/25 01:00:25
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -102,11 +102,7 @@ main(int argc, char *argv[])
int
fd
;
char
path
[
MAXPGPATH
];
setlocale
(
LC_ALL
,
""
);
#ifdef ENABLE_NLS
bindtextdomain
(
"pg_resetxlog"
,
LOCALEDIR
);
textdomain
(
"pg_resetxlog"
);
#endif
set_pglocale
(
argv
[
0
],
"pg_resetxlog"
);
progname
=
get_progname
(
argv
[
0
]);
...
...
src/bin/psql/startup.c
View file @
22889777
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.9
3 2004/05/17 14:35:33
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.9
4 2004/05/25 01:00:26
momjian Exp $
*/
#include "postgres_fe.h"
...
...
@@ -102,11 +102,7 @@ main(int argc, char *argv[])
char
*
password
=
NULL
;
bool
need_pass
;
setlocale
(
LC_ALL
,
""
);
#ifdef ENABLE_NLS
bindtextdomain
(
"psql"
,
LOCALEDIR
);
textdomain
(
"psql"
);
#endif
set_pglocale
(
argv
[
0
],
"psql"
);
pset
.
progname
=
get_progname
(
argv
[
0
]);
...
...
src/bin/scripts/Makefile
View file @
22889777
...
...
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.2
6 2004/04/26 17:40:48
momjian Exp $
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.2
7 2004/05/25 01:00:27
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -15,21 +15,24 @@ include $(top_builddir)/src/Makefile.global
PROGRAMS
=
createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb
override CPPFLAGS
:
= -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS)
override CPPFLAGS
:
= -
DFRONTEND -
I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS)
all
:
submake-libpq submake-backend $(PROGRAMS)
%
:
%.o
$(CC)
$(CFLAGS)
$^
$(libpq)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
createdb
:
createdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
createlang
:
createlang.o common.o print.o mbprint.o
createuser
:
createuser.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
dropdb
:
dropdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
droplang
:
droplang.o common.o print.o mbprint.o
dropuser
:
dropuser.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
clusterdb
:
clusterdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
vacuumdb
:
vacuumdb.o common.o
createdb
:
createdb.o common.o exec.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
createlang
:
createlang.o common.o exec.o print.o mbprint.o
createuser
:
createuser.o common.o exec.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
dropdb
:
dropdb.o common.o exec.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
droplang
:
droplang.o common.o exec.o print.o mbprint.o
dropuser
:
dropuser.o common.o exec.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
clusterdb
:
clusterdb.o common.o exec.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
vacuumdb
:
vacuumdb.o common.o exec.o
exec.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
dumputils.c
:
% : $(top_srcdir)/src/bin/pg_dump/%
rm
-f
$@
&&
$(LN_S)
$<
.
...
...
@@ -60,4 +63,4 @@ uninstall:
clean distclean maintainer-clean
:
rm
-f
$(
addsuffix
$(X)
,
$(PROGRAMS)
)
$(
addsuffix
.o,
$(PROGRAMS)
)
common.o dumputils.o print.o mbprint.o dumputils.c print.c mbprint.c
rm
-f
$(
addsuffix
$(X)
,
$(PROGRAMS)
)
$(
addsuffix
.o,
$(PROGRAMS)
)
common.o dumputils.o print.o mbprint.o dumputils.c
exec.c
print.c mbprint.c
src/bin/scripts/clusterdb.c
View file @
22889777
...
...
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 2002-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.
6 2004/05/12 13:38:46
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.
7 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
char
*
table
=
NULL
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"clusterdb"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:Weqd:at:"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/common.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.
7 2004/04/19 17:42:59
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.
8 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -51,13 +51,9 @@ get_user_name(const char *progname)
* Initialized NLS if enabled.
*/
void
init_nls
(
void
)
init_nls
(
const
char
*
argv0
)
{
#ifdef ENABLE_NLS
setlocale
(
LC_ALL
,
""
);
bindtextdomain
(
"pgscripts"
,
LOCALEDIR
);
textdomain
(
"pgscripts"
);
#endif
set_pglocale
(
argv0
,
"pgscripts"
);
}
...
...
src/bin/scripts/common.h
View file @
22889777
...
...
@@ -11,7 +11,7 @@ int optreset;
const
char
*
get_user_name
(
const
char
*
progname
);
#define _(x) gettext((x))
void
init_nls
(
void
);
void
init_nls
(
const
char
*
argv0
);
typedef
void
(
*
help_handler
)
(
const
char
*
);
...
...
src/bin/scripts/createdb.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.
8 2004/05/12 13:38:4
7 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.
9 2004/05/25 01:00:2
7 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -60,7 +60,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"createdb"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:WeqO:D:T:E:"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/createlang.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.
9 2004/05/12 13:38:4
7 momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.
10 2004/05/25 01:00:2
7 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"createlang"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"lh:p:U:Wd:L:e"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/createuser.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.1
0 2004/05/12 13:38:48
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.1
1 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"createuser"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:WeqaAdDi:PEN"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/dropdb.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.
9 2004/05/12 13:38:48
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.
10 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -51,7 +51,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"dropdb"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:Weqi"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/droplang.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.
8 2004/05/12 13:38:48
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.
9 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"droplang"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"lh:p:U:Wd:e"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/dropuser.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.
8 2004/05/12 13:38:48
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.
9 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -51,7 +51,7 @@ main(int argc, char *argv[])
PGresult
*
result
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"dropuser"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:Weqi"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/bin/scripts/vacuumdb.c
View file @
22889777
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.
6 2004/05/12 13:38:48
momjian Exp $
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.
7 2004/05/25 01:00:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -66,7 +66,7 @@ main(int argc, char *argv[])
bool
verbose
=
false
;
progname
=
get_progname
(
argv
[
0
]);
init_nls
();
init_nls
(
argv
[
0
]
);
handle_help_version_opts
(
argc
,
argv
,
"vacuumdb"
,
help
);
while
((
c
=
getopt_long
(
argc
,
argv
,
"h:p:U:Weqd:zat:fv"
,
long_options
,
&
optindex
))
!=
-
1
)
...
...
src/include/port.h
View file @
22889777
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.3
7 2004/05/21 16:06:22 tgl
Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.3
8 2004/05/25 01:00:28 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,6 +31,8 @@ extern void get_etc_path(const char *my_exec_path, char *ret_path);
extern
void
get_include_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
get_pkginclude_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
get_pkglib_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
get_locale_path
(
const
char
*
my_exec_path
,
char
*
ret_path
);
extern
void
set_pglocale
(
const
char
*
argv0
,
const
char
*
app
);
/*
* is_absolute_path
...
...
src/interfaces/libpq/fe-misc.c
View file @
22889777
...
...
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.10
5 2004/03/15 10:41:26 ishii
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.10
6 2004/05/25 01:00:29 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1131,6 +1131,7 @@ libpq_gettext(const char *msgid)
if
(
!
already_bound
)
{
already_bound
=
1
;
/* No relocatable lookup here because the binary could be anywhere */
bindtextdomain
(
"libpq"
,
LOCALEDIR
);
}
...
...
src/port/Makefile
View file @
22889777
...
...
@@ -7,7 +7,7 @@
# with broken/missing library files.
# IDENTIFICATION
# $PostgreSQL: pgsql/src/port/Makefile,v 1.1
3 2004/05/22 02:15:08 tgl
Exp $
# $PostgreSQL: pgsql/src/port/Makefile,v 1.1
4 2004/05/25 01:00:30 momjian
Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -37,6 +37,7 @@ pg_config_paths.h: $(top_builddir)/src/Makefile.global
echo
"#define INCLUDEDIR
\"
$(includedir)
\"
"
>>
$@
echo
"#define PKGINCLUDEDIR
\"
$(pkgincludedir)
\"
"
>>
$@
echo
"#define PKGLIBDIR
\"
$(pkglibdir)
\"
"
>>
$@
echo
"#define LOCALEDIR
\"
$(localedir)
\"
"
>>
$@
clean distclean maintainer-clean
:
rm
-f
libpgport.a
$(LIBOBJS)
pg_config_paths.h
src/port/path.c
View file @
22889777
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.1
1 2004/05/21 20:56:50 tgl
Exp $
* $PostgreSQL: pgsql/src/port/path.c,v 1.1
2 2004/05/25 01:00:30 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -113,12 +113,14 @@ get_progname(const char *argv0)
void
get_share_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
PGSHAREDIR
))
{
StrNCpy
(
ret_
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
ret_
path
);
/* trim off binary */
trim_directory
(
ret_
path
);
/* trim off /bin */
s
trcat
(
ret_path
,
"/share"
);
/* add /share */
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
/* trim off binary */
trim_directory
(
path
);
/* trim off /bin */
s
nprintf
(
ret_path
,
MAXPGPATH
,
"%s/share"
,
path
);
}
else
StrNCpy
(
ret_path
,
PGSHAREDIR
,
MAXPGPATH
);
...
...
@@ -132,12 +134,14 @@ get_share_path(const char *my_exec_path, char *ret_path)
void
get_etc_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
SYSCONFDIR
))
{
StrNCpy
(
ret_
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
ret_
path
);
trim_directory
(
ret_
path
);
s
trcat
(
ret_path
,
"/etc"
);
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
trim_directory
(
path
);
s
nprintf
(
ret_path
,
MAXPGPATH
,
"%s/etc"
,
path
);
}
else
StrNCpy
(
ret_path
,
SYSCONFDIR
,
MAXPGPATH
);
...
...
@@ -151,12 +155,14 @@ get_etc_path(const char *my_exec_path, char *ret_path)
void
get_include_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
INCLUDEDIR
))
{
StrNCpy
(
ret_
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
ret_
path
);
trim_directory
(
ret_
path
);
s
trcat
(
ret_path
,
"/include"
);
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
trim_directory
(
path
);
s
nprintf
(
ret_path
,
MAXPGPATH
,
"%s/include"
,
path
);
}
else
StrNCpy
(
ret_path
,
INCLUDEDIR
,
MAXPGPATH
);
...
...
@@ -170,12 +176,14 @@ get_include_path(const char *my_exec_path, char *ret_path)
void
get_pkginclude_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
PKGINCLUDEDIR
))
{
StrNCpy
(
ret_
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
ret_
path
);
trim_directory
(
ret_
path
);
s
trcat
(
ret_path
,
"/include"
);
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
trim_directory
(
path
);
s
nprintf
(
ret_path
,
MAXPGPATH
,
"%s/include"
,
path
);
}
else
StrNCpy
(
ret_path
,
PKGINCLUDEDIR
,
MAXPGPATH
);
...
...
@@ -191,12 +199,14 @@ get_pkginclude_path(const char *my_exec_path, char *ret_path)
void
get_pkglib_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
PKGLIBDIR
))
{
StrNCpy
(
ret_
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
ret_
path
);
trim_directory
(
ret_
path
);
s
trcat
(
ret_path
,
"/lib"
);
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
trim_directory
(
path
);
s
nprintf
(
ret_path
,
MAXPGPATH
,
"%s/lib"
,
path
);
}
else
StrNCpy
(
ret_path
,
PKGLIBDIR
,
MAXPGPATH
);
...
...
@@ -204,6 +214,55 @@ get_pkglib_path(const char *my_exec_path, char *ret_path)
/*
* get_locale_path
*
* Return locale path, either relative to /bin or hardcoded
*/
void
get_locale_path
(
const
char
*
my_exec_path
,
char
*
ret_path
)
{
char
path
[
MAXPGPATH
];
if
(
relative_path
(
PGBINDIR
,
LOCALEDIR
))
{
StrNCpy
(
path
,
my_exec_path
,
MAXPGPATH
);
trim_directory
(
path
);
trim_directory
(
path
);
snprintf
(
ret_path
,
MAXPGPATH
,
"%s/share/locale"
,
path
);
}
else
StrNCpy
(
ret_path
,
LOCALEDIR
,
MAXPGPATH
);
}
/*
* set_pglocale
*
* Set application-specific locale
*
* This function takes an argv[0] rather than a full path.
*/
void
set_pglocale
(
const
char
*
argv0
,
const
char
*
app
)
{
#ifdef ENABLE_NLS
char
path
[
MAXPGPATH
];
char
my_exec_path
[
MAXPGPATH
];
setlocale
(
LC_ALL
,
""
);
if
(
find_my_exec
(
argv0
,
my_exec_path
)
<
0
)
return
;
get_locale_path
(
argv0
,
path
);
bindtextdomain
(
app
,
path
);
textdomain
(
app
);
#endif
}
/*
* relative_path
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment