Back to index

tetex-bin  3.0
chartostring.c
Go to the documentation of this file.
00001 /* chartostring.c: change a character (i.e., an integer) to a
00002    one-character string.
00003 
00004 Written in 1994 by Karl Berry.  Public domain.  */
00005 
00006 #include "config.h"
00007 
00008 /* This is needed because web2c turns the Pascal construct 'x' into the
00009    C character constant 'x', not the string "x". And we need to keep it
00010    that way because that's how xord is initialized, etc.  But sometimes
00011    we want one-character strings -- e.g., in tangle.ch and weave.ch.
00012    There's no real alternative to wasting the two bytes of memory (plus
00013    malloc overhead) here, but it doesn't matter.  */
00014 
00015 string
00016 chartostring P1C(char, ch)
00017 {
00018   string str = (string)xmalloc (2);
00019   str[0] = ch;
00020   str[1] = 0;
00021   return str;
00022 }