Re: [PATCHES] Troff -ms output for psql

2005-06-09 Thread Bruce Momjian

Patch applied, thanks.

> Following the commit of my psql latex format fixes, I've re-done the
> patch for the troff-ms format which previously included this patch.
> It's identical to the original but with the latex hunks removed.

---

Roger Leigh wrote:
> Hello,
> 
> 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.
> 
> I've attached the patch (against the current mainline), and example
> output of each for each of border=[123] and expanded mode on and off
> (both source and printable copy).
> 
> 
> Regards,
> Roger
> 
> 
> PS.  I'm not subscribed, so I would appreciate a CC on any replies.
> Thanks!
> 
> 
> -- 
> Roger Leigh
> 
> Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
> GPG Public Key: 0x25BFB848.  Please sign and encrypt your 
> mail.

Content-Description: patch to add troff output to psql


Content-Description: Troff -ms generated source

[ Attachment, skipping... ]

Content-Description: Troff -ms postscript output

[ Attachment, skipping... ]

Content-Description: LaTeX generated source

[ Attachment, skipping... ]

Content-Description: LaTeX PDF output

[ Attachment, skipping... ]

> 
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  pgman@candle.pha.pa.us   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [PATCHES] Troff -ms output for psql

2004-08-02 Thread Bruce Momjian

Perhaps.  :-)

---

Christopher Kings-Lynne wrote:
> You mean 8.1 release :P
> 
> Bruce Momjian wrote:
> 
> > This has been saved for the 7.6 release:
> > 
> > http:/momjian.postgresql.org/cgi-bin/pgpatches2
> 
> 
> ---(end of broadcast)---
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
> 

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] Troff -ms output for psql

2004-08-02 Thread Christopher Kings-Lynne
You mean 8.1 release :P
Bruce Momjian wrote:
This has been saved for the 7.6 release:
	http:/momjian.postgresql.org/cgi-bin/pgpatches2

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [PATCHES] Troff -ms output for psql

2004-08-02 Thread Bruce Momjian

This has been saved for the 7.6 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---

Roger Leigh wrote:
> Hello,
> 
> 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.
> 
> I've attached the patch (against the current mainline), and example
> output of each for each of border=[123] and expanded mode on and off
> (both source and printable copy).
> 
> 
> Regards,
> Roger
> 
> 
> PS.  I'm not subscribed, so I would appreciate a CC on any replies.
> Thanks!
> 
> 
> -- 
> Roger Leigh
> 
> Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
> GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.

Content-Description: patch to add troff output to psql

[ text/x-patch is unsupported, treating like TEXT/PLAIN ]

> Index: doc/src/sgml/ref/psql-ref.sgml
> ===
> RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/psql-ref.sgml,v
> retrieving revision 1.119
> diff -u -r1.119 psql-ref.sgml
> --- doc/src/sgml/ref/psql-ref.sgml15 Jul 2004 03:56:04 -  1.119
> +++ doc/src/sgml/ref/psql-ref.sgml1 Aug 2004 17:36:46 -
> @@ -1372,9 +1372,10 @@
>
>
>Sets the output format to one of unaligned,
> -  aligned, html, or
> -  latex. Unique abbreviations are allowed.
> -  (That would mean one letter is enough.)
> +  aligned, html,
> +  latex, or troff-ms.
> +   Unique abbreviations are allowed.  (That would mean one letter
> +   is enough.)
>
>  
>
> Index: src/bin/psql/command.c
> ===
> RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/command.c,v
> retrieving revision 1.122
> diff -u -r1.122 command.c
> --- src/bin/psql/command.c15 Jul 2004 03:56:06 -  1.122
> +++ src/bin/psql/command.c1 Aug 2004 17:36:53 -
> @@ -1307,6 +1307,9 @@
>   case PRINT_LATEX:
>   return "latex";
>   break;
> + case PRINT_TROFF_MS:
> + return "troff-ms";
> + break;
>   }
>   return "unknown";
>  }
> @@ -1335,9 +1338,11 @@
>   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;
>   }
>  
> Index: src/bin/psql/print.c
> ===
> RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/print.c,v
> retrieving revision 1.48
> diff -u -r1.48 print.c
> --- src/bin/psql/print.c  23 May 2004 22:20:10 -  1.48
> +++ src/bin/psql/print.c  1 Aug 2004 17:36:56 -
> @@ -769,7 +769,7 @@
>  
>  
>  /*/
> -/* LaTeX  */
> +/* LaTeX  */
>  /*/
>  
>  
> @@ -790,6 +790,9 @@
>   case '$':
>   fputs("\\$", fout);
>   break;
> + case '_':
> + fputs("\\_", fout);
> + break;
>   case '{':
>   fputs("\\{", fout);
>   break;
> @@ -817,7 +820,6 @@
>  {
>   unsigned int col_count = 0;
>   unsigned int i;
> - const char *cp;
>   const char *const * ptr;
>  
>  
> @@ -829,42 +831,39 @@
>   fputs("\n\\end{center}\n\n", fout);
>   }
>  
> + /* count columns */
> + for (ptr = headers