diff --git a/sdk/tools/mkisofs/schilytools/libschily/wctype.c b/sdk/tools/mkisofs/schilytools/libschily/wctype.c new file mode 100644 index 0000000..69cfac0 --- /dev/null +++ b/sdk/tools/mkisofs/schilytools/libschily/wctype.c @@ -0,0 +1,98 @@ +#if defined __REACTOS__ && defined(_MSC_VER) && _MSC_VER == 1700 +#pragma message("Warning VS2012 extrawurst: wctype should come from MS CRT") +// due to bugs in libschily the VS2012 does fail to link wctype-functions +// used by match.c and fnmatch.c. But VS2010/VS2013 can properly link the MS CRT versions of it. +// Therefore we provide libschily implementation of wctype.c for VS2012. + + +/* @(#)wctype.c 1.3 17/08/13 Copyright 2017 J. Schilling */ +/* + * Emulate the behavior of wctype() and iswctype() + * + * Copyright (c) 2017 J. Schilling + */ +/* + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * See the file CDDL.Schily.txt in this distribution for details. + * A copy of the CDDL is also available via the Internet at + * http://www.opensource.org/licenses/cddl1.txt + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file CDDL.Schily.txt from this distribution. + */ + +#include +#include +#include +#include +#include + +#ifndef HAVE_WCTYPE +LOCAL struct wct { + char *name; + wctype_t val; +} wct[] = { + {"alnum", 1}, + {"alpha", 2}, + {"blank", 3}, + {"cntrl", 4}, + {"digit", 5}, + {"graph", 6}, + {"lower", 7}, + {"print", 8}, + {"punct", 9}, + {"space", 10}, + {"upper", 11}, + {"xdigit", 12}, + { NULL, 0} +}; + +wctype_t +wctype(n) + const char *n; +{ + register struct wct *wp = wct; + + for (; wp->name; wp++) { + if (*n != *wp->name) + continue; + if (strcmp(n, wp->name) == 0) + return (wp->val); + } + return (0); +} + +int +iswctype(wc, t) + wint_t wc; + wctype_t t; +{ + switch (t) { + + case 1: return (iswalnum(wc)); + case 2: return (iswalpha(wc)); +#if defined(HAVE_ISWBLANK) || ((MB_LEN_MAX == 1) && defined(HAVE_ISBLANK)) + case 3: return (iswblank(wc)); +#else + case 3: return (isspace(wc)); +#endif + case 4: return (iswcntrl(wc)); + case 5: return (iswdigit(wc)); + case 6: return (iswgraph(wc)); + case 7: return (iswlower(wc)); + case 8: return (iswprint(wc)); + case 9: return (iswpunct(wc)); + case 10: return (iswspace(wc)); + case 11: return (iswupper(wc)); + case 12: return (iswxdigit(wc)); + + default: + return (0); + } +} +#endif /* HAVE_WCTYPE */ +#endif //__REACTOS__ diff --git a/sdk/tools/mkisofs/CMakeLists.txt b/sdk/tools/mkisofs/CMakeLists.txt index 37d85bc..b2462e5 100644 --- a/sdk/tools/mkisofs/CMakeLists.txt +++ b/sdk/tools/mkisofs/CMakeLists.txt @@ -57,6 +57,7 @@ add_library(libschily schilytools/libschily/strlcat.c schilytools/libschily/strlcpy.c schilytools/libschily/uid.c + schilytools/libschily/wctype.c schilytools/libschily/zerobytes.c) add_library(libsiconv diff --git a/sdk/tools/mkisofs/schilytools/include/schily/wctype.h b/sdk/tools/mkisofs/schilytools/include/schily/wctype.h index 56fe3e7..d8ec4f4 100644 --- a/sdk/tools/mkisofs/schilytools/include/schily/wctype.h +++ b/sdk/tools/mkisofs/schilytools/include/schily/wctype.h @@ -46,7 +46,7 @@ #if defined(HAVE_ISWPRINT) && defined(USE_WCHAR) #ifndef USE_WCTYPE -#undef USE_WCTYPE +#undef USE_WCTYPE //FIXME: bug! This is #define USE_WCTYPE in newer versions, see https://github.com/roytam1/schilytools/tree/master/include/schily/wctype.h for surrounding changes also #endif #endif warning: LF will be replaced by CRLF in sdk/tools/mkisofs/schilytools/include/schily/wctype.h. The file will have its original line endings in your working directory.