Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a7e24ed

Browse files
committed
Use explicit path to libpgtcl.so, instead of relying on LD_LIBRARY_PATH
or local equivalent. Also, honor --with-pgport configure option for default port number, and allow PGPORT environment variable to override this.
1 parent a8b9cbf commit a7e24ed

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

src/bin/pgaccess/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/bin/pgaccess/Attic/Makefile,v 1.14 2000/10/20 21:03:58 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/bin/pgaccess/Attic/Makefile,v 1.15 2001/02/07 20:30:20 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -19,6 +19,8 @@ all: pgaccess
1919
pgaccess: pgaccess.sh $(top_builddir)/src/Makefile.global
2020
sed -e 's,@WISH@,$(WISH),g' \
2121
-e 's,@PGACCESSHOME@,$(pgaccessdir),g' \
22+
-e 's,@PGLIB@,$(libdir),g' \
23+
-e 's,@DEF_PGPORT@,$(DEF_PGPORT),g' \
2224
$< >$@
2325
chmod a+x $@
2426

src/bin/pgaccess/lib/preferences.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ global PgAcVar
1010
set PgAcVar(pref,autoload) 1
1111
set PgAcVar(pref,systemtables) 0
1212
set PgAcVar(pref,lastdb) {}
13-
set PgAcVar(pref,lasthost) localhost
14-
set PgAcVar(pref,lastport) 5432
13+
set PgAcVar(pref,lasthost) {}
14+
set PgAcVar(pref,lastport) {}
1515
set PgAcVar(pref,username) {}
1616
set PgAcVar(pref,password) {}
1717
set PgAcVar(pref,language) english

src/bin/pgaccess/main.tcl

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ global PgAcVar CurrentDB
6161
foreach module {mainlib database tables queries visualqb forms views functions reports scripts users sequences schema help preferences} {
6262
source [file join $PgAcVar(PGACCESS_HOME) lib $module.tcl]
6363
}
64-
set PgAcVar(currentdb,host) localhost
65-
set PgAcVar(currentdb,pgport) 5432
64+
set PgAcVar(currentdb,host) [default_pg_host]
65+
set PgAcVar(currentdb,pgport) [default_pg_port]
6666
set CurrentDB {}
6767
set PgAcVar(tablist) [list Tables Queries Views Sequences Functions Reports Forms Scripts Users Schema]
6868
set PgAcVar(activetab) {}
@@ -73,6 +73,19 @@ global PgAcVar CurrentDB
7373
Preferences::load
7474
}
7575

76+
proc default_pg_host {} {
77+
return localhost
78+
}
79+
80+
proc default_pg_port {} {
81+
global env
82+
if {[info exists env(PGPORT)]} {
83+
return $env(PGPORT)
84+
} else {
85+
return 5432
86+
}
87+
}
88+
7689
proc {wpg_exec} {db cmd} {
7790
global PgAcVar
7891
set PgAcVar(pgsql,cmd) "never executed"
@@ -165,15 +178,20 @@ global PgAcVar CurrentDB
165178

166179

167180
proc {main} {argc argv} {
168-
global PgAcVar CurrentDB tcl_platform
169-
load libpgtcl[info sharedlibextension]
181+
global PgAcVar CurrentDB tcl_platform env
182+
if {[info exists env(PGLIB)]} {
183+
set libpgtclpath [file join $env(PGLIB) libpgtcl]
184+
} else {
185+
set libpgtclpath {libpgtcl}
186+
}
187+
load ${libpgtclpath}[info sharedlibextension]
170188
catch {Mainlib::draw_tabs}
171189
set PgAcVar(opendb,username) {}
172190
set PgAcVar(opendb,password) {}
173191
if {$argc>0} {
174192
set PgAcVar(opendb,dbname) [lindex $argv 0]
175-
set PgAcVar(opendb,host) localhost
176-
set PgAcVar(opendb,pgport) 5432
193+
set PgAcVar(opendb,host) [default_pg_host]
194+
set PgAcVar(opendb,pgport) [default_pg_port]
177195
Mainlib::open_database
178196
} elseif {$PgAcVar(pref,autoload) && ($PgAcVar(pref,lastdb)!="")} {
179197
set PgAcVar(opendb,dbname) $PgAcVar(pref,lastdb)

src/bin/pgaccess/pgaccess.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
PATH_TO_WISH='@WISH@'
44
PGACCESS_HOME='@PGACCESSHOME@'
5+
PGLIB='@PGLIB@'
6+
PGPORT="${PGPORT:-@DEF_PGPORT@}"
57

68
export PATH_TO_WISH
79
export PGACCESS_HOME
10+
export PGLIB
11+
export PGPORT
812

913
exec "${PATH_TO_WISH}" "${PGACCESS_HOME}/main.tcl" "$@"

0 commit comments

Comments
 (0)