Add setlocale LC_CTYPE and 8 bit clean ctype support.

Original author: ache
This commit is contained in:
Paul Traina 1996-09-08 00:34:51 +00:00
parent 0ab452aa42
commit 9c1953ee9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18133
4 changed files with 28 additions and 4 deletions

View File

@ -19,12 +19,15 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include "cmap.h"
cmap cmlower(CMAP_BUILTIN);
cmap cmupper(CMAP_BUILTIN);
#ifdef isascii
#if defined(isascii) && !defined(__FreeBSD__)
#define ISASCII(c) isascii(c)
#else
#define ISASCII(c) (1)
@ -49,6 +52,9 @@ cmap_init::cmap_init()
if (initialised)
return;
initialised = 1;
#ifdef __FreeBSD__
(void) setlocale(LC_CTYPE, "");
#endif
for (int i = 0; i <= UCHAR_MAX; i++) {
cmupper.v[i] = ISASCII(i) && islower(i) ? toupper(i) : i;
cmlower.v[i] = ISASCII(i) && isupper(i) ? tolower(i) : i;

View File

@ -19,6 +19,9 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include "cset.h"
cset csalpha(CSET_BUILTIN);
@ -33,7 +36,7 @@ cset csprint(CSET_BUILTIN);
cset csgraph(CSET_BUILTIN);
cset cscntrl(CSET_BUILTIN);
#ifdef isascii
#if defined(isascii) && !defined(__FreeBSD__)
#define ISASCII(c) isascii(c)
#else
#define ISASCII(c) (1)
@ -86,6 +89,9 @@ cset_init::cset_init()
if (initialised)
return;
initialised = 1;
#ifdef __FreeBSD__
(void) setlocale(LC_CTYPE, "");
#endif
for (int i = 0; i <= UCHAR_MAX; i++) {
csalpha.v[i] = ISASCII(i) && isalpha(i);
csupper.v[i] = ISASCII(i) && isupper(i);

View File

@ -19,12 +19,15 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include "cmap.h"
cmap cmlower(CMAP_BUILTIN);
cmap cmupper(CMAP_BUILTIN);
#ifdef isascii
#if defined(isascii) && !defined(__FreeBSD__)
#define ISASCII(c) isascii(c)
#else
#define ISASCII(c) (1)
@ -49,6 +52,9 @@ cmap_init::cmap_init()
if (initialised)
return;
initialised = 1;
#ifdef __FreeBSD__
(void) setlocale(LC_CTYPE, "");
#endif
for (int i = 0; i <= UCHAR_MAX; i++) {
cmupper.v[i] = ISASCII(i) && islower(i) ? toupper(i) : i;
cmlower.v[i] = ISASCII(i) && isupper(i) ? tolower(i) : i;

View File

@ -19,6 +19,9 @@ with groff; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ctype.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include "cset.h"
cset csalpha(CSET_BUILTIN);
@ -33,7 +36,7 @@ cset csprint(CSET_BUILTIN);
cset csgraph(CSET_BUILTIN);
cset cscntrl(CSET_BUILTIN);
#ifdef isascii
#if defined(isascii) && !defined(__FreeBSD__)
#define ISASCII(c) isascii(c)
#else
#define ISASCII(c) (1)
@ -86,6 +89,9 @@ cset_init::cset_init()
if (initialised)
return;
initialised = 1;
#ifdef __FreeBSD__
(void) setlocale(LC_CTYPE, "");
#endif
for (int i = 0; i <= UCHAR_MAX; i++) {
csalpha.v[i] = ISASCII(i) && isalpha(i);
csupper.v[i] = ISASCII(i) && isupper(i);