diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-06-09 15:27:27 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-06-09 15:27:27 +0000 |
commit | 4a5cda7bba7c5aee9298f5bc3f287b299cdee634 (patch) | |
tree | e6133c692122c96b78a4c360ce257225893c25bb /src/bin/psql/command.c | |
parent | a31ad27fc5dc32a1453233575b3cf7b5c34cf515 (diff) |
I've created a patch which adds support for troff "-ms" output to
psql. i.e. "\pset format troff-ms". The patch also corrects some
problems with the "latex" format, notably defining an extra column in
the output table, and correcting some alignment issues; it also
changes the output to match the border setting as documented in the
manual page and as shown with the "aligned" format.
The troff-ms output is mostly identical to the latex output allowing
for the differences between the two typesetters.
The output should be saved in a file and piped as follows:
cat file | tbl | troff -T ps -ms > file.ps
or
tbl file | troff -T ps -ms > file.ps
Because it contains tabs, you'll need to redirect psql output or use
"script", rather than pasting from a terminal window, due to the tabs
which can be replaced with spaces.
Roger Leigh
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 7523f67eb63..5b646ee130f 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.143 2005/04/29 13:42:20 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.144 2005/06/09 15:27:26 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1357,6 +1357,9 @@ _align2string(enum printFormat in) case PRINT_LATEX: return "latex"; break; + case PRINT_TROFF_MS: + return "troff-ms"; + break; } return "unknown"; } @@ -1385,9 +1388,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) popt->topt.format = PRINT_HTML; else if (pg_strncasecmp("latex", value, vallen) == 0) popt->topt.format = PRINT_LATEX; + else if (pg_strncasecmp("troff-ms", value, vallen) == 0) + popt->topt.format = PRINT_TROFF_MS; else { - psql_error("\\pset: allowed formats are unaligned, aligned, html, latex\n"); + psql_error("\\pset: allowed formats are unaligned, aligned, html, latex, troff-ms\n"); return false; } |