version 1.67, 2013/06/20 22:39:30 |
version 1.72, 2013/12/25 22:45:33 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 40 static char *time2a(time_t); |
|
Line 40 static char *time2a(time_t); |
|
|
|
|
|
enum mandoc_esc |
enum mandoc_esc |
mandoc_escape(const char **end, const char **start, int *sz) |
mandoc_escape(const char const **end, const char const **start, int *sz) |
{ |
{ |
const char *local_start; |
const char *local_start; |
int local_sz; |
int local_sz; |
Line 93 mandoc_escape(const char **end, const char **start, in |
|
Line 93 mandoc_escape(const char **end, const char **start, in |
|
case ('C'): |
case ('C'): |
if ('\'' != **start) |
if ('\'' != **start) |
return(ESCAPE_ERROR); |
return(ESCAPE_ERROR); |
gly = ESCAPE_SPECIAL; |
|
*start = ++*end; |
*start = ++*end; |
|
if ('u' == (*start)[0] && '\'' != (*start)[1]) |
|
gly = ESCAPE_UNICODE; |
|
else |
|
gly = ESCAPE_SPECIAL; |
term = '\''; |
term = '\''; |
break; |
break; |
|
|
/* |
/* |
|
* Escapes taking no arguments at all. |
|
*/ |
|
case ('d'): |
|
/* FALLTHROUGH */ |
|
case ('u'): |
|
return(ESCAPE_IGNORE); |
|
|
|
/* |
* The \z escape is supposed to output the following |
* The \z escape is supposed to output the following |
* character without advancing the cursor position. |
* character without advancing the cursor position. |
* Since we are mostly dealing with terminal mode, |
* Since we are mostly dealing with terminal mode, |
Line 296 mandoc_escape(const char **end, const char **start, in |
|
Line 307 mandoc_escape(const char **end, const char **start, in |
|
|
|
switch (gly) { |
switch (gly) { |
case (ESCAPE_FONT): |
case (ESCAPE_FONT): |
/* |
if (2 == *sz) { |
* Pretend that the constant-width font modes are the |
if ('C' == **start) { |
* same as the regular font modes. |
/* |
*/ |
* Treat constant-width font modes |
if (2 == *sz && 'C' == **start) { |
* just like regular font modes. |
(*start)++; |
*/ |
(*sz)--; |
(*start)++; |
|
(*sz)--; |
|
} else { |
|
if ('B' == (*start)[0] && 'I' == (*start)[1]) |
|
gly = ESCAPE_FONTBI; |
|
break; |
|
} |
} else if (1 != *sz) |
} else if (1 != *sz) |
break; |
break; |
|
|
Line 410 mandoc_strdup(const char *ptr) |
|
Line 427 mandoc_strdup(const char *ptr) |
|
* Parse a quoted or unquoted roff-style request or macro argument. |
* Parse a quoted or unquoted roff-style request or macro argument. |
* Return a pointer to the parsed argument, which is either the original |
* Return a pointer to the parsed argument, which is either the original |
* pointer or advanced by one byte in case the argument is quoted. |
* pointer or advanced by one byte in case the argument is quoted. |
* Null-terminate the argument in place. |
* NUL-terminate the argument in place. |
* Collapse pairs of quotes inside quoted arguments. |
* Collapse pairs of quotes inside quoted arguments. |
* Advance the argument pointer to the next argument, |
* Advance the argument pointer to the next argument, |
* or to the null byte terminating the argument line. |
* or to the NUL byte terminating the argument line. |
*/ |
*/ |
char * |
char * |
mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) |
mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) |
Line 484 mandoc_getarg(struct mparse *parse, char **cpp, int ln |
|
Line 501 mandoc_getarg(struct mparse *parse, char **cpp, int ln |
|
if (1 == quoted) |
if (1 == quoted) |
mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL); |
mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL); |
|
|
/* Null-terminate this argument and move to the next one. */ |
/* NUL-terminate this argument and move to the next one. */ |
if (pairs) |
if (pairs) |
cp[-pairs] = '\0'; |
cp[-pairs] = '\0'; |
if ('\0' != *cp) { |
if ('\0' != *cp) { |