diff ueda/uschem-print/pstring.c @ 0:cd92449fdb51

initial import of ueda and ifctf-part-lib from ifctfvax CVS
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 20 Jul 2015 00:24:37 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ueda/uschem-print/pstring.c	Mon Jul 20 00:24:37 2015 +0000
@@ -0,0 +1,24 @@
+/*
+ * Emitting PostScript strings, handling all special characters
+ */
+
+#include <ctype.h>
+
+emit_ps_string(str)
+	char *str;
+{
+	register char *cp;
+	register int c;
+
+	putchar('(');
+	for (cp = str; c = *cp; cp++) {
+		if (!isprint(c)) {
+			printf("\\%03o", c);
+			continue;
+		}
+		if (c == '(' || c == ')' || c == '\\')
+			putchar('\\');
+		putchar(c);
+	}
+	putchar(')');
+}