version 1.47, 2011/07/07 06:41:50 |
version 1.51, 2011/09/18 14:14:15 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011 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 |
|
|
int unicode; |
int unicode; |
}; |
}; |
|
|
#define LINES_MAX 325 |
#define LINES_MAX 328 |
|
|
#define CHAR(in, ch, code) \ |
#define CHAR(in, ch, code) \ |
{ NULL, (in), (ch), (code) }, |
{ NULL, (in), (ch), (code) }, |
Line 111 mchars_num2char(const char *p, size_t sz) |
|
Line 111 mchars_num2char(const char *p, size_t sz) |
|
{ |
{ |
int i; |
int i; |
|
|
if ((i = mandoc_strntou(p, sz, 10)) < 0) |
if ((i = mandoc_strntoi(p, sz, 10)) < 0) |
return('\0'); |
return('\0'); |
return(isprint(i) ? i : '\0'); |
return(i > 0 && i < 256 && isprint(i) ? i : '\0'); |
} |
} |
|
|
int |
int |
Line 121 mchars_num2uc(const char *p, size_t sz) |
|
Line 121 mchars_num2uc(const char *p, size_t sz) |
|
{ |
{ |
int i; |
int i; |
|
|
if ((i = mandoc_strntou(p, sz, 16)) < 0) |
if ((i = mandoc_strntoi(p, sz, 16)) < 0) |
return('\0'); |
return('\0'); |
/* FIXME: make sure we're not in a bogus range. */ |
/* FIXME: make sure we're not in a bogus range. */ |
return(i > 0x80 && i <= 0x10FFFF ? i : '\0'); |
return(i > 0x80 && i <= 0x10FFFF ? i : '\0'); |
Line 133 mchars_spec2str(struct mchars *arg, const char *p, siz |
|
Line 133 mchars_spec2str(struct mchars *arg, const char *p, siz |
|
const struct ln *ln; |
const struct ln *ln; |
|
|
ln = find(arg, p, sz); |
ln = find(arg, p, sz); |
if (NULL == ln) |
if (NULL == ln) { |
|
*rsz = 1; |
return(NULL); |
return(NULL); |
|
} |
|
|
*rsz = strlen(ln->ascii); |
*rsz = strlen(ln->ascii); |
return(ln->ascii); |
return(ln->ascii); |