version 1.59, 2011/09/18 14:14:15 |
version 1.63, 2012/05/31 22:29:13 |
|
|
/* $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 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011, 2012 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 143 mandoc_escape(const char **end, const char **start, in |
|
Line 143 mandoc_escape(const char **end, const char **start, in |
|
break; |
break; |
|
|
/* |
/* |
|
* The \z escape is supposed to output the following |
|
* character without advancing the cursor position. |
|
* Since we are mostly dealing with terminal mode, |
|
* let us just skip the next character. |
|
*/ |
|
case ('z'): |
|
(*end)++; |
|
return(ESCAPE_SKIPCHAR); |
|
|
|
/* |
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where |
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where |
* 'X' is the trigger. These have opaque sub-strings. |
* 'X' is the trigger. These have opaque sub-strings. |
*/ |
*/ |
Line 161 mandoc_escape(const char **end, const char **start, in |
|
Line 171 mandoc_escape(const char **end, const char **start, in |
|
case ('V'): |
case ('V'): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case ('Y'): |
case ('Y'): |
if (ESCAPE_ERROR == gly) |
gly = ESCAPE_IGNORE; |
gly = ESCAPE_IGNORE; |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case ('f'): |
case ('f'): |
if (ESCAPE_ERROR == gly) |
if (ESCAPE_ERROR == gly) |
Line 222 mandoc_escape(const char **end, const char **start, in |
|
Line 231 mandoc_escape(const char **end, const char **start, in |
|
case ('L'): |
case ('L'): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case ('l'): |
case ('l'): |
|
gly = ESCAPE_NUMBERED; |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case ('N'): |
|
if (ESCAPE_ERROR == gly) |
|
gly = ESCAPE_NUMBERED; |
|
/* FALLTHROUGH */ |
|
case ('S'): |
case ('S'): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case ('v'): |
case ('v'): |
Line 241 mandoc_escape(const char **end, const char **start, in |
|
Line 247 mandoc_escape(const char **end, const char **start, in |
|
term = numeric = '\''; |
term = numeric = '\''; |
break; |
break; |
|
|
|
/* |
|
* Special handling for the numbered character escape. |
|
* XXX Do any other escapes need similar handling? |
|
*/ |
|
case ('N'): |
|
if ('\0' == cp[i]) |
|
return(ESCAPE_ERROR); |
|
*end = &cp[++i]; |
|
if (isdigit((unsigned char)cp[i-1])) |
|
return(ESCAPE_IGNORE); |
|
while (isdigit((unsigned char)**end)) |
|
(*end)++; |
|
if (start) |
|
*start = &cp[i]; |
|
if (sz) |
|
*sz = *end - &cp[i]; |
|
if ('\0' != **end) |
|
(*end)++; |
|
return(ESCAPE_NUMBERED); |
|
|
/* |
/* |
* Sizes get a special category of their own. |
* Sizes get a special category of their own. |
*/ |
*/ |
|
|
|
|
switch (gly) { |
switch (gly) { |
case (ESCAPE_FONT): |
case (ESCAPE_FONT): |
if (1 != rlim) |
/* |
|
* Pretend that the constant-width font modes are the |
|
* same as the regular font modes. |
|
*/ |
|
if (2 == rlim && 'C' == *rstart) |
|
rstart++; |
|
else if (1 != rlim) |
break; |
break; |
|
|
switch (*rstart) { |
switch (*rstart) { |
case ('3'): |
case ('3'): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
Line 600 mandoc_normdate(struct mparse *parse, char *in, int ln |
|
Line 633 mandoc_normdate(struct mparse *parse, char *in, int ln |
|
mandoc_msg(MANDOCERR_NODATE, parse, ln, pos, NULL); |
mandoc_msg(MANDOCERR_NODATE, parse, ln, pos, NULL); |
time(&t); |
time(&t); |
} |
} |
|
else if (a2time(&t, "%Y-%m-%d", in)) |
|
t = 0; |
else if (!a2time(&t, "$" "Mdocdate: %b %d %Y $", in) && |
else if (!a2time(&t, "$" "Mdocdate: %b %d %Y $", in) && |
!a2time(&t, "%b %d, %Y", in) && |
!a2time(&t, "%b %d, %Y", in)) { |
!a2time(&t, "%Y-%m-%d", in)) { |
|
mandoc_msg(MANDOCERR_BADDATE, parse, ln, pos, NULL); |
mandoc_msg(MANDOCERR_BADDATE, parse, ln, pos, NULL); |
t = 0; |
t = 0; |
} |
} |