psql: why not pset PROMPT[0-2] ?

From: "Michal Maruka" <mmc(at)maruska(dot)dyndns(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql: why not pset PROMPT[0-2] ?
Date: 2001-02-06 21:32:41
Message-ID: 14976.28025.353752.394761@linux3.maruska.tin.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


(In psql:)
I need to modify the 2nd prompt. So i looked at the sources:
I leave the validity test (of the name of the option/param) to SetVariable !!

Here is the patch:

diff -c /internet/cvs/pgsql/src/bin/psql/command.c.~1~ /internet/cvs/pgsql/src/bin/psql/command.c
*** /internet/cvs/pgsql/src/bin/psql/command.c.~1~ Tue Feb 6 22:26:00 2001
--- /internet/cvs/pgsql/src/bin/psql/command.c Tue Feb 6 22:26:00 2001
***************
*** 1745,1750 ****
--- 1745,1760 ----
}


+
+ /* toggle use of pager */
+ else if (strncmp(param, "PROMPT",6) == 0)
+ {
+ SetVariable(pset.vars, param, value); /* SetVariable takes care of whether param is actually valid !! */
+ }
+
+
+
+
else
{
psql_error("\\pset: unknown option: %s\n", param);

diff -c /internet/cvs/pgsql/src/bin/psql/tab-complete.c.~2~ /internet/cvs/pgsql/src/bin/psql/tab-complete.c
*** /internet/cvs/pgsql/src/bin/psql/tab-complete.c.~2~ Tue Feb 6 22:24:06 2001
--- /internet/cvs/pgsql/src/bin/psql/tab-complete.c Tue Feb 6 22:24:06 2001
***************
*** 706,713 ****
else if (strcmp(prev_wd, "\\pset") == 0)
{
char *my_list[] = {"format", "border", "expanded", "null", "fieldsep",
! "tuples_only", "title", "tableattr", "pager",
! "recordsep", NULL};

COMPLETE_WITH_LIST(my_list);
}
--- 706,713 ----
else if (strcmp(prev_wd, "\\pset") == 0)
{
char *my_list[] = {"format", "border", "expanded", "null", "fieldsep",
! "tuples_only", "title", "tableattr", "pager",
! "PROMPT1","PROMPT2","PROMPT3","recordsep", NULL};

COMPLETE_WITH_LIST(my_list);
}

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-02-06 21:39:04 Re: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....
Previous Message Mitch Vincent 2001-02-06 21:27:11 Re: full text searching