|
39 | 39 | * Portions Copyright (c) 1994, Regents of the University of California |
40 | 40 | * Portions taken from FreeBSD. |
41 | 41 | * |
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 $ |
43 | 43 | * |
44 | 44 | *------------------------------------------------------------------------- |
45 | 45 | */ |
@@ -216,8 +216,10 @@ do { \ |
216 | 216 |
|
217 | 217 | #ifndefWIN32 |
218 | 218 | #defineQUOTE_PATH"" |
| 219 | +#defineDIR_SEP "/" |
219 | 220 | #else |
220 | 221 | #defineQUOTE_PATH"\"" |
| 222 | +#defineDIR_SEP "\\" |
221 | 223 | #endif |
222 | 224 |
|
223 | 225 | /* |
@@ -2079,6 +2081,8 @@ main(int argc, char *argv[]) |
2079 | 2081 | char*short_version; |
2080 | 2082 | char*pgdenv;/* PGDATA value gotten from and sent to |
2081 | 2083 | * environment */ |
| 2084 | +charbin_dir[MAXPGPATH]; |
| 2085 | +char*pg_data_native; |
2082 | 2086 | staticconstchar*subdirs[]= { |
2083 | 2087 | "global", |
2084 | 2088 | "pg_xlog", |
@@ -2256,6 +2260,7 @@ main(int argc, char *argv[]) |
2256 | 2260 | } |
2257 | 2261 | } |
2258 | 2262 |
|
| 2263 | +pg_data_native=pg_data; |
2259 | 2264 | canonicalize_path(pg_data); |
2260 | 2265 |
|
2261 | 2266 | /* |
@@ -2567,12 +2572,18 @@ main(int argc, char *argv[]) |
2567 | 2572 | if (authwarning!=NULL) |
2568 | 2573 | fprintf(stderr,authwarning); |
2569 | 2574 |
|
| 2575 | +/* Get directory specification used to start this executable */ |
| 2576 | +strcpy(bin_dir,argv[0]); |
| 2577 | +get_parent_directory(bin_dir); |
| 2578 | + |
2570 | 2579 | 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" |
2572 | 2581 | "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); |
2576 | 2587 |
|
2577 | 2588 | return0; |
2578 | 2589 | } |