diff options
author | Yuri Pankov <yuripv@FreeBSD.org> | 2018-10-27 23:31:42 +0000 |
---|---|---|
committer | Yuri Pankov <yuripv@FreeBSD.org> | 2018-10-27 23:31:42 +0000 |
commit | 2d1cfed1b14d27e1d478863225bc849ef17633b6 (patch) | |
tree | f7016cbb25f513e6a9bd2cab6375755ca2c08d36 /usr.bin | |
parent | 8d56c80545a234d84bb83da6792e1851dbeb7e38 (diff) | |
download | src-test-2d1cfed1b14d27e1d478863225bc849ef17633b6.tar.gz src-test-2d1cfed1b14d27e1d478863225bc849ef17633b6.zip |
localedef: define characters in "space" class also as "print", except
for the known conflicts ("control" characters can't be "print"able).
POSIX doesn't explicitly forbid this, and actually includes <space>
character in "print".
PR: 225692
Reviewed by: bapt, cem (previous version), pfg (previous version)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D17467
Notes
Notes:
svn path=/head/; revision=339827
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/localedef/ctype.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c index bf3415b95d752..e6fb5e796372a 100644 --- a/usr.bin/localedef/ctype.c +++ b/usr.bin/localedef/ctype.c @@ -120,7 +120,13 @@ add_ctype_impl(ctype_node_t *ctn) ctn->ctype |= (_ISDIGIT | _ISGRAPH | _ISPRINT | _ISXDIGIT | _E4); break; case T_ISSPACE: - ctn->ctype |= _ISSPACE; + /* + * This can be troublesome as <form-feed>, <newline>, + * <carriage-return>, <tab>, and <vertical-tab> are defined both + * as space and cntrl, and POSIX doesn't allow cntrl/print + * combination. We will take care of this in dump_ctype(). + */ + ctn->ctype |= (_ISSPACE | _ISPRINT); break; case T_ISCNTRL: ctn->ctype |= _ISCNTRL; @@ -378,9 +384,15 @@ dump_ctype(void) ctn->ctype |= _ISPRINT; /* - * Finally, POSIX requires that certain combinations - * are invalid. We don't flag this as a fatal error, - * but we will warn about. + * POSIX requires that certain combinations are invalid. + * Try fixing the cases we know about (see add_ctype_impl()). + */ + if ((ctn->ctype & (_ISSPACE|_ISCNTRL)) == (_ISSPACE|_ISCNTRL)) + ctn->ctype &= ~_ISPRINT; + + /* + * Finally, don't flag remaining cases as a fatal error, + * and just warn about them. */ if ((ctn->ctype & _ISALPHA) && (ctn->ctype & (_ISPUNCT|_ISDIGIT))) |