-/* $Id: chars.c,v 1.63 2014/10/28 13:24:44 schwarze Exp $ */
+/* $Id: chars.c,v 1.65 2014/10/29 00:17:43 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
const struct ln *ln;
ln = find(arg, p, sz);
- return(ln != NULL ? ln->unicode : sz == 1 ? *p : 0xFFFD);
+ return(ln != NULL ? ln->unicode : sz == 1 ? (unsigned char)*p : -1);
}
-char
+int
mchars_num2char(const char *p, size_t sz)
{
int i;
- if ((i = mandoc_strntoi(p, sz, 10)) < 0)
- return('\0');
-
- return(i > 0 && i < 256 && isprint(i) ? i : '\0');
+ i = mandoc_strntoi(p, sz, 10);
+ return(i >= 0 && i < 256 ? i : -1);
}
int