version 1.86, 2014/08/18 09:11:47 |
version 1.91, 2015/01/21 20:33:25 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011-2015 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 79 mandoc_escape(const char **end, const char **start, in |
|
Line 79 mandoc_escape(const char **end, const char **start, in |
|
break; |
break; |
case '[': |
case '[': |
gly = ESCAPE_SPECIAL; |
gly = ESCAPE_SPECIAL; |
/* |
|
* Unicode escapes are defined in groff as \[uXXXX] to |
|
* \[u10FFFF], where the contained value must be a valid |
|
* Unicode codepoint. Here, however, only check whether |
|
* it's not a zero-width escape. |
|
*/ |
|
if ('u' == (*start)[0] && ']' != (*start)[1]) |
|
gly = ESCAPE_UNICODE; |
|
term = ']'; |
term = ']'; |
break; |
break; |
case 'C': |
case 'C': |
if ('\'' != **start) |
if ('\'' != **start) |
return(ESCAPE_ERROR); |
return(ESCAPE_ERROR); |
*start = ++*end; |
*start = ++*end; |
if ('u' == (*start)[0] && '\'' != (*start)[1]) |
gly = ESCAPE_SPECIAL; |
gly = ESCAPE_UNICODE; |
|
else |
|
gly = ESCAPE_SPECIAL; |
|
term = '\''; |
term = '\''; |
break; |
break; |
|
|
Line 167 mandoc_escape(const char **end, const char **start, in |
|
Line 156 mandoc_escape(const char **end, const char **start, in |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case 'D': |
case 'D': |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case 'o': |
|
/* FALLTHROUGH */ |
|
case 'R': |
case 'R': |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case 'X': |
case 'X': |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case 'Z': |
case 'Z': |
if ('\0' == **start) |
|
return(ESCAPE_ERROR); |
|
gly = ESCAPE_IGNORE; |
gly = ESCAPE_IGNORE; |
|
/* FALLTHROUGH */ |
|
case 'o': |
|
if (**start == '\0') |
|
return(ESCAPE_ERROR); |
|
if (gly == ESCAPE_ERROR) |
|
gly = ESCAPE_OVERSTRIKE; |
term = **start; |
term = **start; |
*start = ++*end; |
*start = ++*end; |
break; |
break; |
Line 236 mandoc_escape(const char **end, const char **start, in |
|
Line 227 mandoc_escape(const char **end, const char **start, in |
|
|
|
/* See +/- counts as a sign. */ |
/* See +/- counts as a sign. */ |
if ('+' == **end || '-' == **end || ASCII_HYPH == **end) |
if ('+' == **end || '-' == **end || ASCII_HYPH == **end) |
(*end)++; |
*start = ++*end; |
|
|
switch (**end) { |
switch (**end) { |
case '(': |
case '(': |
Line 344 mandoc_escape(const char **end, const char **start, in |
|
Line 335 mandoc_escape(const char **end, const char **start, in |
|
case ESCAPE_SPECIAL: |
case ESCAPE_SPECIAL: |
if (1 == *sz && 'c' == **start) |
if (1 == *sz && 'c' == **start) |
gly = ESCAPE_NOSPACE; |
gly = ESCAPE_NOSPACE; |
|
/* |
|
* Unicode escapes are defined in groff as \[u0000] |
|
* to \[u10FFFF], where the contained value must be |
|
* a valid Unicode codepoint. Here, however, only |
|
* check the length and range. |
|
*/ |
|
if (**start != 'u' || *sz < 5 || *sz > 7) |
|
break; |
|
if (*sz == 7 && ((*start)[1] != '1' || (*start)[2] != '0')) |
|
break; |
|
if (*sz == 6 && (*start)[1] == '0') |
|
break; |
|
if ((int)strspn(*start + 1, "0123456789ABCDEFabcdef") |
|
+ 1 == *sz) |
|
gly = ESCAPE_UNICODE; |
break; |
break; |
default: |
default: |
break; |
break; |
Line 476 time2a(time_t t) |
|
Line 482 time2a(time_t t) |
|
int isz; |
int isz; |
|
|
tm = localtime(&t); |
tm = localtime(&t); |
|
if (tm == NULL) |
|
return(NULL); |
|
|
/* |
/* |
* Reserve space: |
* Reserve space: |