Skip to content

Commit ee814b4

Browse files
committed
Have initdb display relative paths to start postmaster if used to invoke
initdb, and display in a path-native way.
1 parent db086aa commit ee814b4

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/bin/initdb/initdb.c

Lines changed: 16 additions & 5 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.68 2004/11/27 18:51:05 tgl Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.69 2004/11/29 01:14:45 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -216,8 +216,10 @@ do { \
216216

217217
#ifndef WIN32
218218
#define QUOTE_PATH ""
219+
#define DIR_SEP "/"
219220
#else
220221
#define QUOTE_PATH "\""
222+
#define DIR_SEP "\\"
221223
#endif
222224

223225
/*
@@ -2079,6 +2081,8 @@ main(int argc, char *argv[])
20792081
char *short_version;
20802082
char *pgdenv; /* PGDATA value gotten from and sent to
20812083
* environment */
2084+
char bin_dir[MAXPGPATH];
2085+
char *pg_data_native;
20822086
static const char *subdirs[] = {
20832087
"global",
20842088
"pg_xlog",
@@ -2256,6 +2260,7 @@ main(int argc, char *argv[])
22562260
}
22572261
}
22582262

2263+
pg_data_native = pg_data;
22592264
canonicalize_path(pg_data);
22602265

22612266
/*
@@ -2567,12 +2572,18 @@ main(int argc, char *argv[])
25672572
if (authwarning != NULL)
25682573
fprintf(stderr, authwarning);
25692574

2575+
/* Get directory specification used to start this executable */
2576+
strcpy(bin_dir, argv[0]);
2577+
get_parent_directory(bin_dir);
2578+
25702579
printf(_("\nSuccess. You can now start the database server using:\n\n"
2571-
" %s%s%s/postmaster -D %s%s%s\n"
2580+
" %s%s%s%spostmaster -D %s%s%s\n"
25722581
"or\n"
2573-
" %s%s%s/pg_ctl -D %s%s%s -l logfile start\n\n"),
2574-
QUOTE_PATH, bin_path, QUOTE_PATH, QUOTE_PATH, pg_data, QUOTE_PATH,
2575-
QUOTE_PATH, bin_path, QUOTE_PATH, QUOTE_PATH, pg_data, QUOTE_PATH);
2582+
" %s%s%s%spg_ctl -D %s%s%s -l logfile start\n\n"),
2583+
QUOTE_PATH, bin_dir, QUOTE_PATH, (strlen(bin_dir) > 0) ? DIR_SEP : "",
2584+
QUOTE_PATH, pg_data_native, QUOTE_PATH,
2585+
QUOTE_PATH, bin_dir, QUOTE_PATH, (strlen(bin_dir) > 0) ? DIR_SEP : "",
2586+
QUOTE_PATH, pg_data_native, QUOTE_PATH);
25762587

25772588
return 0;
25782589
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy