Skip to content

Commit 43d07d6

Browse files
committed
Revert patch for --psqlrc=FILENAME in psql.
1 parent 153012c commit 43d07d6

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.240 2010/03/06 15:28:09 mha Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.241 2010/03/07 17:02:33 mha Exp $
33
PostgreSQL documentation
44
-->
55

@@ -481,16 +481,6 @@ PostgreSQL documentation
481481
</listitem>
482482
</varlistentry>
483483

484-
<varlistentry>
485-
<term><option>--psqlrc=<replaceable class="parameter">FILENAME</></></term>
486-
<listitem>
487-
<para>
488-
Read the start-up file from <replaceable class="parameter">FILENAME</>
489-
instead of <filename>~/.psqlrc</>.
490-
</para>
491-
</listitem>
492-
</varlistentry>
493-
494484
<varlistentry>
495485
<term><option>-1</option></term>
496486
<term><option>--single-transaction</option></term>

src/bin/psql/help.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.156 2010/03/06 15:28:09 mha Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.157 2010/03/07 17:02:34 mha Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -99,7 +99,6 @@ usage(void)
9999
printf(_(" -v, --set=, --variable=NAME=VALUE\n"
100100
" set psql variable NAME to VALUE\n"));
101101
printf(_(" -X, --no-psqlrc do not read startup file (~/.psqlrc)\n"));
102-
printf(_(" --psqlrc=FILENAME read startup commands from file (instead of ~/.psqlrc)\n"));
103102
printf(_(" -1 (\"one\"), --single-transaction\n"
104103
" execute command file as a single transaction\n"));
105104
printf(_(" --help show this help, then exit\n"));

src/bin/psql/startup.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.163 2010/03/06 15:28:09 mha Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.164 2010/03/07 17:02:34 mha Exp $
77
*/
88
#include "postgres_fe.h"
99

@@ -68,12 +68,11 @@ struct adhoc_opts
6868
bool no_readline;
6969
bool no_psqlrc;
7070
bool single_txn;
71-
char *psqlrc;
7271
};
7372

7473
static void parse_psql_options(int argc, char *argv[],
7574
struct adhoc_opts * options);
76-
static void process_psqlrc(char *argv0, struct adhoc_opts *options);
75+
static void process_psqlrc(char *argv0);
7776
static void process_psqlrc_file(char *filename);
7877
static void showVersion(void);
7978
static void EstablishVariableSpace(void);
@@ -248,7 +247,8 @@ main(int argc, char *argv[])
248247
*/
249248
if (options.action == ACT_FILE)
250249
{
251-
process_psqlrc(argv[0], &options);
250+
if (!options.no_psqlrc)
251+
process_psqlrc(argv[0]);
252252

253253
successResult = process_file(options.action_string, options.single_txn);
254254
}
@@ -291,7 +291,8 @@ main(int argc, char *argv[])
291291
*/
292292
else
293293
{
294-
process_psqlrc(argv[0], &options);
294+
if (!options.no_psqlrc)
295+
process_psqlrc(argv[0]);
295296

296297
connection_warnings(true);
297298
if (!pset.quiet && !pset.notty)
@@ -354,7 +355,6 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
354355
{"password", no_argument, NULL, 'W'},
355356
{"expanded", no_argument, NULL, 'x'},
356357
{"no-psqlrc", no_argument, NULL, 'X'},
357-
{"psqlrc", required_argument, NULL, 1},
358358
{"help", no_argument, NULL, '?'},
359359
{NULL, 0, NULL, 0}
360360
};
@@ -515,9 +515,6 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
515515
case 'X':
516516
options->no_psqlrc = true;
517517
break;
518-
case 1:
519-
options->psqlrc = pg_strdup(optarg);
520-
break;
521518
case '1':
522519
options->single_txn = true;
523520
break;
@@ -566,27 +563,20 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
566563
* Load .psqlrc file, if found.
567564
*/
568565
static void
569-
process_psqlrc(char *argv0, struct adhoc_opts *options)
566+
process_psqlrc(char *argv0)
570567
{
571568
char home[MAXPGPATH];
572569
char rc_file[MAXPGPATH];
573570
char my_exec_path[MAXPGPATH];
574571
char etc_path[MAXPGPATH];
575572

576-
if (options->no_psqlrc)
577-
return;
578-
579573
find_my_exec(argv0, my_exec_path);
580574
get_etc_path(my_exec_path, etc_path);
581575

582576
snprintf(rc_file, MAXPGPATH, "%s/%s", etc_path, SYSPSQLRC);
583577
process_psqlrc_file(rc_file);
584578

585-
if (options->psqlrc)
586-
{
587-
process_psqlrc_file(options->psqlrc);
588-
}
589-
else if (get_home_path(home))
579+
if (get_home_path(home))
590580
{
591581
snprintf(rc_file, MAXPGPATH, "%s/%s", home, PSQLRC);
592582
process_psqlrc_file(rc_file);

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