quotestrdup, quoterunestrdup, unquotestrdup, unquoterunestrdup, quotestrfmt, quoterunestrfmt, quotefmtinstall, doquote, needsrcquote – quoted character strings
char *quotestrdup(char *s)
Rune *quoterunestrdup(Rune *s)
char *unquotestrdup(char *s)
Rune *unquoterunestrdup(Rune *s)
int (*doquote)(int c)
int needsrcquote(int c)
These routines manipulate character strings, either adding or removing
quotes as necessary.
In the quoted form, the strings are in the style of
with single quotes surrounding the string.
Embedded single quotes are indicated by a doubled single quote.
when quoted becomes
The empty string is represented by two quotes,
The first four functions act as variants of
Each returns a
freshly allocated copy of the string, created using
returns a quoted copy of
returns a copy of
with the quotes evaluated.
versions of these functions do the same for
unhandled troff command .CW
The string returned by
has the following properties:
If the original string
is empty, the returned string is
contains no quotes, blanks, or control characters,
the returned string is identical to
needs quotes to be added, the first character of the returned
string will be a quote.
The function pointer
If it is non-nil, characters are passed to that function to see if they should
This mechanism allows programs to specify that
characters other than blanks, control characters, or quotes be quoted.
Regardless of the return value of
blanks, control characters, and quotes are always quoted.
is provided as a
function that flags any character special to
formatting routines that produce quoted strings as output.
They may be installed by hand, but
installs them under the standard format characters
(They are not installed automatically.)
If the format string includes the alternate format character
the printed string will always be quoted; otherwise quotes will only be provided if necessary
to avoid ambiguity.
statements so the compiler can type-check uses of