Add setlocale LC_CTYPE

Fix ctype functions for 8bit charsets
This commit is contained in:
Andrey A. Chernov 1995-10-28 19:29:58 +00:00
parent 9203a11a55
commit 021d0b0c13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11888
2 changed files with 23 additions and 15 deletions

View file

@ -36,6 +36,9 @@
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#ifdef __FreeBSD__
#include <locale.h>
#endif
#include "system.h"
#include "long-options.h"
@ -1459,6 +1462,9 @@ main (argc, argv)
struct sigaction oldact, newact;
#endif /* _POSIX_VERSION */
#ifdef __FreeBSD__
(void) setlocale(LC_CTYPE, "");
#endif
program_name = argv[0];
parse_long_options (argc, argv, usage);

View file

@ -173,28 +173,30 @@ extern int errno;
#include <ctype.h>
#ifndef isascii
#define isascii(c) 1
#if !defined(isascii) || defined(__FreeBSD__)
#define ISASCII(c) 1
#else
#define ISASCII(c) isascii (c)
#endif
#ifdef isblank
#define ISBLANK(c) (isascii (c) && isblank (c))
#define ISBLANK(c) (ISASCII (c) && isblank (c))
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
#define ISGRAPH(c) (isascii (c) && isgraph (c))
#define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#else
#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c))
#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
#define ISPRINT(c) (isascii (c) && isprint (c))
#define ISDIGIT(c) (isascii (c) && isdigit (c))
#define ISALNUM(c) (isascii (c) && isalnum (c))
#define ISALPHA(c) (isascii (c) && isalpha (c))
#define ISCNTRL(c) (isascii (c) && iscntrl (c))
#define ISLOWER(c) (isascii (c) && islower (c))
#define ISPUNCT(c) (isascii (c) && ispunct (c))
#define ISSPACE(c) (isascii (c) && isspace (c))
#define ISUPPER(c) (isascii (c) && isupper (c))
#define ISXDIGIT(c) (isascii (c) && isxdigit (c))
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define ISLOWER(c) (ISASCII (c) && islower (c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))