src/hg/lib/hPrint.c 1.11

1.11 2010/05/07 03:38:32 galt
new function hPrintEncodeNonBreak to protect against problems with <>;" in output, problem was recently uncovered by hgNearTest
Index: src/hg/lib/hPrint.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hPrint.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -b -B -U 4 -r1.10 -r1.11
--- src/hg/lib/hPrint.c	18 Dec 2008 05:54:58 -0000	1.10
+++ src/hg/lib/hPrint.c	7 May 2010 03:38:32 -0000	1.11
@@ -1,8 +1,9 @@
 /* hPrint - turning html printing on and off, which is useful
  * when postscript and PDF images are being drawn  */
 
 #include "hPrint.h"
+#include "htmshell.h"
 
 static char const rcsid[] = "$Id$";
 
 static boolean suppressHtml = FALSE;
@@ -60,8 +61,16 @@
     else
         putchar(c);
 }
 
+void hPrintEncodedNonBreak(char *s)
+/* Print with htmlEncode and non-break */
+{
+char *encoded = htmlEncode(s);
+hPrintNonBreak(encoded);
+freeMem(encoded);
+}
+
 void hPuts(char *string)
 /* Puts that can be suppressed if not making html. */
 {
 if (!suppressHtml)