Table of Contents
The
function copies into a string which represents the character If needs
no encoding, it is copied in unaltered. The string is null terminated,
and a pointer to the end of the string is returned. The maximum length
of any encoding is four characters (not including the trailing thus, when
encoding a set of characters into a buffer, the size of the buffer should
be four times the number of characters encoded, plus one for the trailing
The flag parameter is used for altering the default range of characters
considered for encoding and for altering the visual representation. The
additional character, is only used when selecting the encoding format
(explained below). The and functions copy into a visual representation
of the string The function encodes characters from up to the first
The function encodes exactly characters from (this is useful for encoding
a block of data that may contain Both forms terminate The size of must
be four times the number of characters encoded from (plus one for the
Both forms return the number of characters in dst (not including the trailing
The encoding is a unique, invertible representation comprised entirely
of graphic characters; it can be decoded back into the original form using
the or functions. There are two parameters that can be controlled: the
range of characters that are encoded, and the type of representation used.
By default, all non-graphic characters. except space, tab, and newline
are encoded. (See The following flags alter this: Also encode space.
Also encode tab. Also encode newline. Synonym for | | Only encode "unsafe"
characters. Unsafe means control characters which may cause common terminals
to perform unexpected functions. Currently this form allows space, tab,
newline, backspace, bell, and return - in addition to all graphic characters
- unencoded. There are three forms of encoding. All forms use the backslash
character to introduce a special sequence; two backslashes are used to
represent a real backslash. These are the visual formats: Use an to represent
meta characters (characters with the 8th bit set), and use caret to represent
control characters see The following formats are used: Represents the
control character Spans characters through and (as Represents character
with the 8th bit set. Spans characters through Represents control character
with the 8th bit set. Spans characters through and (as Represents
space. Represents Meta-space. Use C-style backslash sequences to represent
standard non-printable characters. The following sequences are used to represent
the indicated characters: When using this format, the nextc
parameter is looked at to determine if a character can be encoded as
instead of If is an octal digit, the latter representation is used to
avoid ambiguity. Use a three digit octal sequence. The form is where
represents an octal digit. There is one additional flag, which inhibits
the doubling of backslashes and the backslash before the default format
(that is, control characters are represented by and meta characters as
With this flag set, the encoding is ambiguous and non-invertible.
These functions first appeared in 4.4BSD.
Table of Contents