33 *
44 * Copyright (c) 2000-2007, PostgreSQL Global Development Group
55 *
6- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.178 2007/02/23 18:20:58 momjian Exp $
6+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.179 2007/03/03 17:19:11 momjian Exp $
77 */
88#include "postgres_fe.h"
99#include "command.h"
@@ -863,7 +863,13 @@ exec_command(const char *cmd,
863863
864864/* \t -- turn off headers and row count */
865865else if (strcmp (cmd ,"t" )== 0 )
866- success = do_pset ("tuples_only" ,NULL ,& pset .popt ,pset .quiet );
866+ {
867+ char * opt = psql_scan_slash_option (scan_state ,
868+ OT_NORMAL ,NULL , true);
869+
870+ success = do_pset ("tuples_only" ,opt ,& pset .popt ,pset .quiet );
871+ free (opt );
872+ }
867873
868874
869875/* \T -- define html <table ...> attributes */
@@ -975,7 +981,13 @@ exec_command(const char *cmd,
975981
976982/* \x -- toggle expanded table representation */
977983else if (strcmp (cmd ,"x" )== 0 )
978- success = do_pset ("expanded" ,NULL ,& pset .popt ,pset .quiet );
984+ {
985+ char * opt = psql_scan_slash_option (scan_state ,
986+ OT_NORMAL ,NULL , true);
987+
988+ success = do_pset ("expanded" ,opt ,& pset .popt ,pset .quiet );
989+ free (opt );
990+ }
979991
980992/* \z -- list table rights (equivalent to \dp) */
981993else if (strcmp (cmd ,"z" )== 0 )
@@ -1552,7 +1564,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
15521564/* set expanded/vertical mode */
15531565else if (strcmp (param ,"x" )== 0 || strcmp (param ,"expanded" )== 0 || strcmp (param ,"vertical" )== 0 )
15541566{
1555- popt -> topt .expanded = !popt -> topt .expanded ;
1567+ if (value )
1568+ popt -> topt .expanded = ParseVariableBool (value );
1569+ else
1570+ popt -> topt .expanded = !popt -> topt .expanded ;
15561571if (!quiet )
15571572printf (popt -> topt .expanded
15581573 ?_ ("Expanded display is on.\n" )
@@ -1562,7 +1577,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
15621577/* locale-aware numeric output */
15631578else if (strcmp (param ,"numericlocale" )== 0 )
15641579{
1565- popt -> topt .numericLocale = !popt -> topt .numericLocale ;
1580+ if (value )
1581+ popt -> topt .numericLocale = ParseVariableBool (value );
1582+ else
1583+ popt -> topt .numericLocale = !popt -> topt .numericLocale ;
15661584if (!quiet )
15671585{
15681586if (popt -> topt .numericLocale )
@@ -1616,7 +1634,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
16161634/* toggle between full and tuples-only format */
16171635else if (strcmp (param ,"t" )== 0 || strcmp (param ,"tuples_only" )== 0 )
16181636{
1619- popt -> topt .tuples_only = !popt -> topt .tuples_only ;
1637+ if (value )
1638+ popt -> topt .tuples_only = ParseVariableBool (value );
1639+ else
1640+ popt -> topt .tuples_only = !popt -> topt .tuples_only ;
16201641if (!quiet )
16211642{
16221643if (popt -> topt .tuples_only )
@@ -1667,6 +1688,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
16671688{
16681689if (value && pg_strcasecmp (value ,"always" )== 0 )
16691690popt -> topt .pager = 2 ;
1691+ else if (value )
1692+ if (ParseVariableBool (value ))
1693+ popt -> topt .pager = 1 ;
1694+ else
1695+ popt -> topt .pager = 0 ;
16701696else if (popt -> topt .pager == 1 )
16711697popt -> topt .pager = 0 ;
16721698else
@@ -1685,7 +1711,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
16851711/* disable "(x rows)" footer */
16861712else if (strcmp (param ,"footer" )== 0 )
16871713{
1688- popt -> default_footer = !popt -> default_footer ;
1714+ if (value )
1715+ popt -> default_footer = ParseVariableBool (value );
1716+ else
1717+ popt -> default_footer = !popt -> default_footer ;
16891718if (!quiet )
16901719{
16911720if (popt -> default_footer )