summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/chartostring.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/lib/chartostring.c')
-rw-r--r--Build/source/texk/web2c/lib/chartostring.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/chartostring.c b/Build/source/texk/web2c/lib/chartostring.c
new file mode 100644
index 00000000000..8f98feb7dac
--- /dev/null
+++ b/Build/source/texk/web2c/lib/chartostring.c
@@ -0,0 +1,22 @@
+/* chartostring.c: change a character (i.e., an integer) to a
+ one-character string.
+
+Written in 1994 by Karl Berry. Public domain. */
+
+#include "config.h"
+
+/* This is needed because web2c turns the Pascal construct 'x' into the
+ C character constant 'x', not the string "x". And we need to keep it
+ that way because that's how xord is initialized, etc. But sometimes
+ we want one-character strings -- e.g., in tangle.ch and weave.ch.
+ There's no real alternative to wasting the two bytes of memory (plus
+ malloc overhead) here, but it doesn't matter. */
+
+string
+chartostring P1C(char, ch)
+{
+ string str = (string)xmalloc (2);
+ str[0] = ch;
+ str[1] = 0;
+ return str;
+}