File: chartostring.c

package info (click to toggle)
texlive-bin 2007.dfsg.2-4%2Blenny3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 245,472 kB
  • ctags: 135,653
  • sloc: ansic: 971,350; cpp: 307,149; sh: 53,218; perl: 39,201; makefile: 12,611; python: 6,078; xml: 5,342; asm: 4,245; yacc: 3,108; pascal: 2,483; ruby: 2,089; ada: 1,681; lex: 1,654; objc: 1,357; awk: 1,214; tcl: 973; cs: 879; lisp: 708; sed: 536; java: 172; csh: 47
file content (22 lines) | stat: -rw-r--r-- 689 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}