How can I de-escape my strings at run time?

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Tue Jun 5 11:27:14 AEST 1990


In article <+2X3GW9 at xds13.ferranti.com>, peter at ficc.ferranti.com (Peter da Silva) writes:
: In article <MEISSNER.90Jun3154100 at curley.osf.org> meissner at osf.org (Michael Meissner) writes:
: > It came up a few times.  The problem is that ANSI C is not mandated to
: > require ASCII (or even ISO646).  EBCDIC is the classic counterpoint.

: Are the rest of the escapes, in fact, portable? For example, does ebcdic
: have a separate \r and \n? I know some ASCII-based systems use the two
: interchangeably (OS/9, for example).

EBCDIC has three separate characters: NL (\n), CR (\r), and LF (\012).
Some C compilers for /370s identify \n with LF, some with NL (\x15).
Since IBM mainframes use length (fixed or variable) to specify record
boundaries, not embedded special characters, only the C library cares
what \n is.  In fact most of the ASCII "control characters" have
equivalents in EBCDIC, and many of them even have the same numeric value.
In particular, \e for ESC would have been _more_ portable to EBCDIC than
\n is, there is only one candidate for ESC and three for end of line.
(What would have been wrong with mapping \n to Record Separator?)

-- 
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists.  However, no example could be found to include here."



More information about the Comp.lang.c mailing list