-/*
- * Parse a quoted or unquoted roff-style request or macro argument.
- * Return a pointer to the parsed argument, which is either the original
- * pointer or advanced by one byte in case the argument is quoted.
- * Null-terminate the argument in place.
- * Collapse pairs of quotes inside quoted arguments.
- * Advance the argument pointer to the next argument,
- * or to the null byte terminating the argument line.
- */
-char *
-mandoc_getarg(char **cpp, mandocmsg msg, void *data, int ln, int *pos)
-{
- char *start, *cp;
- int quoted, pairs, white;
-
- /* Quoting can only start with a new word. */
- start = *cpp;
- if ('"' == *start) {
- quoted = 1;
- start++;
- } else
- quoted = 0;
-
- pairs = 0;
- white = 0;
- for (cp = start; '\0' != *cp; cp++) {
- /* Move left after quoted quotes and escaped backslashes. */
- if (pairs)
- cp[-pairs] = cp[0];
- if ('\\' == cp[0]) {
- if ('\\' == cp[1]) {
- /* Poor man's copy mode. */
- pairs++;
- cp++;
- } else if (0 == quoted && ' ' == cp[1])
- /* Skip escaped blanks. */
- cp++;
- } else if (0 == quoted) {
- if (' ' == cp[0]) {
- /* Unescaped blanks end unquoted args. */
- white = 1;
+ switch (gly) {
+ case ESCAPE_FONT:
+ gly = mandoc_font(*start, *sz);
+ break;
+ case ESCAPE_SPECIAL:
+ if (**start == 'c') {
+ if (*sz < 6 || *sz > 7 ||
+ strncmp(*start, "char", 4) != 0 ||
+ (int)strspn(*start + 4, "0123456789") + 4 < *sz)