Author: cfinck Date: Sat Sep 9 15:06:48 2017 New Revision: 75806
URL: http://svn.reactos.org/svn/reactos?rev=75806&view=rev Log: [MKISOFS] Update mkisofs to schily-2017-09-07. Among other things, this version comes with an upstream fix for David's x64 fix in r75399. We are now using 100% unmodified upstream code again.
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/cdrecord/version.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/fcntl.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/inttypes.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/libport.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/maxpath.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/patmatch.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/string.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/unistd.h trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/wctype.h trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/comerr.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/fnmatch.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/getargs.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/match.c
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/cdrecord/version.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/cdrecord/version.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/cdrecord/version.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,6 +1,6 @@ -/* @(#)version.h 1.93 16/12/15 Copyright 2007-2016 J. Schilling */ +/* @(#)version.h 1.94 17/03/28 Copyright 2007-2017 J. Schilling */
/* * The version for cdrtools programs */ -#define VERSION "3.02a07" +#define VERSION "3.02a08"
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/fcntl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/fcntl.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/fcntl.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -11,6 +11,8 @@ * 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.
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/inttypes.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/inttypes.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/inttypes.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -11,6 +11,8 @@ * 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.
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/libport.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/libport.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/libport.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,9 +1,9 @@ -/* @(#)libport.h 1.44 15/05/09 Copyright 1995-2015 J. Schilling */ +/* @(#)libport.h 1.45 17/05/02 Copyright 1995-2017 J. Schilling */ /* * Prototypes for POSIX standard functions that may be missing on the * local platform and thus are implemented inside libschily. * - * Copyright (c) 1995-2015 J. Schilling + * Copyright (c) 1995-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -213,8 +213,8 @@ #endif /* _SCHILY_WCHAR_H */
#ifndef HAVE_RENAME -extern int rename __PR((const char *old, - const char *new)); +extern int rename __PR((const char *__old, + const char *__new)); #endif
/* @@ -378,8 +378,8 @@ char *lbuf, size_t lbufsize)); #endif #ifndef HAVE_RENAMEAT -extern int renameat __PR((int oldfd, const char *old, - int newfd, const char *new)); +extern int renameat __PR((int oldfd, const char *__old, + int newfd, const char *__new)); #endif #ifndef HAVE_SYMLINKAT extern int symlinkat __PR((const char *content,
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/maxpath.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/maxpath.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/maxpath.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,8 +1,8 @@ -/* @(#)maxpath.h 1.12 10/08/27 Copyright 1985, 1995, 1998, 2001-2010 J. Schilling */ +/* @(#)maxpath.h 1.13 17/04/27 Copyright 1985, 1995, 1998, 2001-2017 J. Schilling */ /* * Definitions for dealing with statically limitations on pathnames * - * Copyright (c) 1985, 1995, 1998, 2001-2010 J. Schilling + * Copyright (c) 1985, 1995, 1998, 2001-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -11,6 +11,8 @@ * 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. @@ -54,7 +56,7 @@ #endif
#if !defined(FOUND_MAXPATHNAME) -# define MAXPATHNAME 256 /* Is there a limit? */ +# define MAXPATHNAME 1024 /* Is there a limit? */ #endif
#ifndef PATH_MAX @@ -95,12 +97,16 @@ # define FOUND_MAXFILENAME #endif
-#if !defined(FOUND_MAXPATHNAME) +#if !defined(FOUND_MAXFILENAME) #include <schily/stdlib.h> #endif #if !defined(FOUND_MAXFILENAME) && defined(_MAX_FNAME) # define MAXFILENAME _MAX_FNAME /* From MS stdlib.h */ # define FOUND_MAXFILENAME +#endif + +#if !defined(FOUND_MAXFILENAME) +# define MAXFILENAME 256 #endif
#ifndef NAME_MAX @@ -109,5 +115,8 @@ #ifndef MAXNAMLEN #define MAXNAMLEN MAXFILENAME #endif +#ifndef MAXNAMELEN +#define MAXNAMELEN MAXFILENAME +#endif
#endif /* _SCHILY_MAXPATH_H */
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/patmatch.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/patmatch.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/patmatch.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,11 +1,11 @@ -/* @(#)patmatch.h 1.15 10/08/27 Copyright 1985,1993-2010 J. Schilling */ +/* @(#)patmatch.h 1.16 17/07/02 Copyright 1985,1993-2017 J. Schilling */
#ifndef _SCHILY_PATMATCH_H #define _SCHILY_PATMATCH_H /* * Definitions for the pattern matching functions. * - * Copyright (c) 1985,1993-2010 J. Schilling + * Copyright (c) 1985,1993-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -14,6 +14,8 @@ * 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. @@ -121,6 +123,17 @@ int __soff, int __slen, int __alt, int __state[]));
+extern unsigned char *patmbmatch __PR((const wchar_t *__pat, + const int *__aux, + const unsigned char *__str, + int __soff, int __slen, + int __alt, int __state[])); +extern unsigned char *patmblmatch __PR((const wchar_t *__pat, + const int *__aux, + const unsigned char *__str, + int __soff, int __slen, + int __alt, int __state[])); +
#ifdef __cplusplus }
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/schily.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,4 +1,4 @@ -/* @(#)schily.h 1.122 16/12/18 Copyright 1985-2016 J. Schilling */ +/* @(#)schily.h 1.123 17/08/03 Copyright 1985-2016 J. Schilling */ /* * Definitions for libschily * @@ -46,9 +46,6 @@ #endif #ifndef _SCHILY_CCOMDEFS_H #include <schily/ccomdefs.h> -#endif -#ifndef _SCHILY_STDINT_H -#include <schily/stdint.h> #endif
#ifdef __cplusplus @@ -467,12 +464,12 @@ extern int wcseql __PR((const wchar_t *, const wchar_t *)); #endif #ifdef va_arg -extern int format __PR((void (*)(char, intptr_t), intptr_t, const char *, +extern int format __PR((void (*)(char, void *), void *, const char *, va_list)); -extern int fprformat __PR((intptr_t, const char *, va_list)); +extern int fprformat __PR((void *, const char *, va_list)); #else -extern int format __PR((void (*)(char, intptr_t), intptr_t, const char *, void *)); -extern int fprformat __PR((intptr_t, const char *, void *)); +extern int format __PR((void (*)(char, void *), void *, const char *, void *)); +extern int fprformat __PR((void *, const char *, void *)); #endif
extern int ftoes __PR((char *, double, int, int));
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/string.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/string.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/string.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -11,6 +11,8 @@ * 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.
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/unistd.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/unistd.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/unistd.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,8 +1,8 @@ -/* @(#)unistd.h 1.27 14/06/19 Copyright 1996-2014 J. Schilling */ +/* @(#)unistd.h 1.28 17/04/30 Copyright 1996-2017 J. Schilling */ /* * Definitions for unix system interface * - * Copyright (c) 1996-2014 J. Schilling + * Copyright (c) 1996-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -124,12 +124,12 @@ #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif
+#ifdef __cplusplus +extern "C" { +#endif + #ifndef HAVE_ENVIRON_DEF extern char **environ; -#endif - -#ifdef __cplusplus -extern "C" { #endif
#if !defined(HAVE_UNISTD_H) || !defined(_POSIX_VERSION)
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/wctype.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/wctype.h [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/include/schily/wctype.h [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,8 +1,8 @@ -/* @(#)wctype.h 1.8 13/07/08 Copyright 2009-2013 J. Schilling */ +/* @(#)wctype.h 1.9 17/08/05 Copyright 2009-2017 J. Schilling */ /* * Abstraction from wctype.h * - * Copyright (c) 2009-2013 J. Schilling + * Copyright (c) 2009-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -68,6 +68,10 @@ #define iswalnum(c) isalnum(c) #undef iswalpha #define iswalpha(c) isalpha(c) +#ifdef HAVE_ISBLANK +#undef iswblank +#define iswblank(c) isblank(c) +#endif #undef iswcntrl #define iswcntrl(c) iscntrl(c) #undef iswcntrl
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/comerr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/comerr.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/comerr.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,8 +1,8 @@ -/* @(#)comerr.c 1.43 15/07/01 Copyright 1985-1989, 1995-2015 J. Schilling */ +/* @(#)comerr.c 1.44 17/03/13 Copyright 1985-1989, 1995-2017 J. Schilling */ /* * Routines for printing command errors * - * Copyright (c) 1985-1989, 1995-2015 J. Schilling + * Copyright (c) 1985-1989, 1995-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -332,8 +332,12 @@ int err; { while (exfuncs) { + ex_t *fp; + (*exfuncs->func)(err, exfuncs->arg); + fp = exfuncs; exfuncs = exfuncs->next; + free(fp); } exit(err); /* NOTREACHED */
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/fnmatch.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/fnmatch.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/fnmatch.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,8 +1,8 @@ -/* @(#)fnmatch.c 8.20 15/07/06 2005-2015 J. Schilling from 8.2 (Berkeley) */ +/* @(#)fnmatch.c 8.24 17/08/30 2005-2017 J. Schilling from 8.2 (Berkeley) */ #include <schily/mconfig.h> #ifndef lint static UConst char sccsid[] = - "@(#)fnmatch.c 8.20 15/07/06 2005-2015 J. Schilling from 8.2 (Berkeley)"; + "@(#)fnmatch.c 8.24 17/08/30 2005-2017 J. Schilling from 8.2 (Berkeley)"; #endif /* * Copyright (c) 1989, 1993, 1994 @@ -10,6 +10,12 @@ * * This code is derived from software contributed to Berkeley by * Guido van Rossum. + * + * Copyright (c) 2005-2017 J. Schilling + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * under sponsorship from the FreeBSD Foundation. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,7 +43,7 @@ */
#if defined(LIBC_SCCS) && !defined(lint) -static UConst char sccsid[] = "@(#)fnmatch.c 8.20 (Berkeley) 07/06/15"; +static UConst char sccsid[] = "@(#)fnmatch.c 8.24 (Berkeley) 08/30/17"; #endif /* LIBC_SCCS and not lint */ /* "FBSD src/lib/libc/gen/fnmatch.c,v 1.19 2010/04/16 22:29:24 jilles Exp $" */
@@ -70,6 +76,8 @@ #define RANGE_MATCH 1 #define RANGE_NOMATCH 0 #define RANGE_ERROR (-1) + +#define CL_SIZE 32 /* Max size for '[: :]' */
static int rangematch __PR((const char *, wchar_t, int, char **, mbstate_t *)); static int fnmatch1 __PR((const char *, const char *, const char *, int, @@ -127,11 +135,14 @@ mbstate_t patmbs; mbstate_t strmbs; { + const char *bt_pattern, *bt_string; + mbstate_t bt_patmbs, bt_strmbs; char *newp; char c; wchar_t pc, sc; size_t pclen, sclen;
+ bt_pattern = bt_string = NULL; for (;;) { pclen = mbrtowc(&pc, pattern, MB_LEN_MAX, &patmbs); if (pclen == (size_t)-1 || pclen == (size_t)-2) @@ -147,16 +158,18 @@ case EOS: if ((flags & FNM_LEADING_DIR) && sc == '/') return (0); - return (sc == EOS ? 0 : FNM_NOMATCH); + if (sc == EOS) + return (0); + goto backtrack; case '?': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack; string += sclen; break; case '*': @@ -168,7 +181,7 @@ if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack;
/* Optimize for pattern with * at end or before /. */ if (c == EOS) { @@ -184,43 +197,34 @@ break; }
- /* General case, use recursion. */ - while (sc != EOS) { - if (!fnmatch1(pattern, string, stringstart, - flags, patmbs, strmbs)) - return (0); - sclen = mbrtowc(&sc, string, MB_LEN_MAX, - &strmbs); - if (sclen == (size_t)-1 || - sclen == (size_t)-2) { - sc = (unsigned char)*string; - sclen = 1; - memset(&strmbs, 0, sizeof (strmbs)); - } - if (sc == '/' && (flags & FNM_PATHNAME)) - break; - string += sclen; - } - return (FNM_NOMATCH); + /* + * First try the shortest match for the '*' that + * could work. We can forget any earlier '*' since + * there is no way having it match more characters + * can help us, given that we are already here. + */ + bt_pattern = pattern, bt_patmbs = patmbs; + bt_string = string, bt_strmbs = strmbs; + break; case '[': if (sc == EOS) return (FNM_NOMATCH); if (sc == '/' && (flags & FNM_PATHNAME)) - return (FNM_NOMATCH); + goto backtrack; if (sc == '.' && (flags & FNM_PERIOD) && (string == stringstart || ((flags & FNM_PATHNAME) && *(string - 1) == '/'))) - return (FNM_NOMATCH); + goto backtrack;
switch (rangematch(pattern, sc, flags, &newp, - &patmbs)) { + &patmbs)) { case RANGE_ERROR: goto norm; case RANGE_MATCH: pattern = newp; break; case RANGE_NOMATCH: - return (FNM_NOMATCH); + goto backtrack; } string += sclen; break; @@ -231,20 +235,45 @@ if (pclen == (size_t)-1 || pclen == (size_t)-2) return (FNM_NOMATCH); if (pclen == 0) - pc = '\'; + return (FNM_NOMATCH); pattern += pclen; } /* FALLTHROUGH */ default: norm: - if (pc == sc) + string += sclen; + if (pc == sc) { ; - else if ((flags & FNM_CASEFOLD) && - (towlower(pc) == towlower(sc))) + } else if ((flags & FNM_CASEFOLD) && + (towlower(pc) == towlower(sc))) { ; - else - return (FNM_NOMATCH); - string += sclen; + } else { + backtrack: + /* + * If we have a mismatch (other than hitting + * the end of the string), go back to the last + * '*' seen and have it match one additional + * character. + */ + if (bt_pattern == NULL) + return (FNM_NOMATCH); + sclen = mbrtowc(&sc, bt_string, MB_LEN_MAX, + &bt_strmbs); + if (sclen == (size_t)-1 || + sclen == (size_t)-2) { + sc = (unsigned char)*bt_string; + sclen = 1; + memset(&bt_strmbs, 0, + sizeof (bt_strmbs)); + } + if (sc == EOS) + return (FNM_NOMATCH); + if (sc == '/' && flags & FNM_PATHNAME) + return (FNM_NOMATCH); + bt_string += sclen; + pattern = bt_pattern, patmbs = bt_patmbs; + string = bt_string, strmbs = bt_strmbs; + } break; } } @@ -253,7 +282,8 @@
#ifdef PROTOTYPES static int -rangematch(const char *pattern, wchar_t test, int flags, char **newp, mbstate_t *patmbs) +rangematch(const char *pattern, wchar_t test, int flags, char **newp, + mbstate_t *patmbs) #else static int rangematch(pattern, test, flags, newp, patmbs) @@ -266,8 +296,13 @@ { int negate, ok; wchar_t c, c2; + wchar_t otest = test; size_t pclen; const char *origpat; +#ifdef XXX_COLLATE + struct xlocale_collate *table = (struct xlocale_collate *) + __get_locale()->components[XLC_COLLATE]; +#endif
/* * A bracket expression starting with an unquoted circumflex @@ -290,6 +325,8 @@ ok = 0; origpat = pattern; for (;;) { + int quoted = 0; + if (*pattern == ']' && pattern > origpat) { pattern++; break; @@ -297,12 +334,53 @@ return (RANGE_ERROR); } else if (*pattern == '/' && (flags & FNM_PATHNAME)) { return (RANGE_NOMATCH); - } else if (*pattern == '\' && !(flags & FNM_NOESCAPE)) + } else if (*pattern == '\' && !(flags & FNM_NOESCAPE)) { pattern++; + quoted++; + } pclen = mbrtowc(&c, pattern, MB_LEN_MAX, patmbs); if (pclen == (size_t)-1 || pclen == (size_t)-2) return (RANGE_NOMATCH); pattern += pclen; + + if (!quoted && c == '[') { + if (pattern[0] == ':') { + char class[CL_SIZE+1]; + char *pc = class; + const char *p; + + p = pattern + 1; /* Eat ':' */ + for (;;) { + if (*p == '\0') + return (RANGE_ERROR); + if (*p == ':' && p[1] == ']') + break; + if (pc >= &class[CL_SIZE]) + return (RANGE_ERROR); + *pc++ = *p++; + } + if (pc == class) + return (RANGE_ERROR); + *pc = '\0'; + pattern = p + 2; /* Skip ":]" */ + if (iswctype(otest, wctype(class))) { + ok = 1; + } else if (flags & FNM_CASEFOLD) { + /* + * Convert to the other case + */ + if (strcmp(class, "upper") == 0) + if (iswctype(otest, + wctype("lower"))) + ok = 1; + else if (strcmp(class, "lower") == 0) + if (iswctype(otest, + wctype("upper"))) + ok = 1; + } + continue; + } + }
if (flags & FNM_CASEFOLD) c = towlower(c); @@ -323,10 +401,10 @@ c2 = towlower(c2);
#ifdef XXX_COLLATE - if (__collate_load_error ? + if (table->__collate_load_error ? c <= test && test <= c2 : - __collate_range_cmp(c, test) <= 0 && - __collate_range_cmp(test, c2) <= 0) + __wcollate_range_cmp(c, test) <= 0 && + __wcollate_range_cmp(test, c2) <= 0) ok = 1; #else if (c <= test && test <= c2)
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/format.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,4 +1,4 @@ -/* @(#)format.c 1.61 16/08/10 Copyright 1985-2016 J. Schilling */ +/* @(#)format.c 1.62 17/08/03 Copyright 1985-2017 J. Schilling */ /* * format * common code for printf fprintf & sprintf @@ -6,7 +6,7 @@ * allows recursive printf with "%r", used in: * error, comerr, comerrno, errmsg, errmsgno and the like * - * Copyright (c) 1985-2016 J. Schilling + * Copyright (c) 1985-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -138,9 +138,9 @@ char *ptr; /* Current ptr in buf */ int cnt; /* Free char count in buf */ #else - void (*outf)__PR((char, intptr_t)); /* Func from format(fun, arg) */ -#endif - intptr_t farg; /* Arg from format (fun, arg) */ + void (*outf)__PR((char, void *)); /* Func from format(fun, arg) */ +#endif + void *farg; /* Arg from format (fun, arg) */ int minusflag; /* Fieldwidth is negative */ int flags; /* General flags (+-#) */ int fldwidth; /* Field width as in %3d */ @@ -227,7 +227,7 @@ #define FORMAT_FUNC_NAME format #define FORMAT_FUNC_PARM
-#define FORMAT_FUNC_PROTO_DECL void (*fun)(char, intptr_t), +#define FORMAT_FUNC_PROTO_DECL void (*fun)(char, void *), #define FORMAT_FUNC_KR_DECL register void (*fun)(); #define FORMAT_FUNC_KR_ARGS fun,
@@ -235,7 +235,7 @@ #endif
#ifdef FORMAT_BUFFER -#define FARG (farg|1) +#define FARG ((void *)((UIntptr_t)farg|1)) #else #define FARG farg #endif @@ -243,14 +243,14 @@ #ifdef PROTOTYPES EXPORT int FORMAT_FUNC_NAME(FORMAT_FUNC_PROTO_DECL - intptr_t farg, + void *farg, const char *fmt, va_list oargs) #else EXPORT int FORMAT_FUNC_NAME(FORMAT_FUNC_KR_ARGS farg, fmt, oargs) FORMAT_FUNC_KR_DECL - register intptr_t farg; + register void *farg; register char *fmt; va_list oargs; #endif @@ -287,14 +287,14 @@ #endif
#ifdef FORMAT_BUFFER - if ((farg & 1) == 0) { /* Called externally */ + if (((UIntptr_t)farg & 1) == 0) { /* Called externally */ fa.cnt = BFSIZ; fa.ptr = fa.iobuf; fa.fp = (FILE *)farg; fa.err = 0; - farg = fa.farg = (intptr_t)&fa; + farg = fa.farg = &fa; } else { /* recursion */ - farg &= ~1; + farg = (void *)((UIntptr_t)farg & ~1); } #endif #ifdef FORMAT_FUNC_PARM @@ -1023,7 +1023,7 @@ } out: #ifdef FORMAT_BUFFER - if (farg == (intptr_t)&fa) { /* Top level call, flush buffer */ + if (farg == &fa) { /* Top level call, flush buffer */ if (fa.err) return (EOF); if ((fa.ptr != fa.iobuf) && @@ -1208,9 +1208,9 @@ { register int diff; register int rfillc; - register intptr_t arg = fa->farg; + register void *arg = fa->farg; #ifdef FORMAT_FUNC_PARM - register void (*fun) __PR((char, intptr_t)) = fa->outf; + register void (*fun) __PR((char, void *)) = fa->outf; #endif register int count; register int lzero = 0; @@ -1274,9 +1274,9 @@ { register int diff; register int rfillc; - register intptr_t arg = fa->farg; + register void *arg = fa->farg; #ifdef FORMAT_FUNC_PARM - register void (*fun) __PR((char, intptr_t)) = fa->outf; + register void (*fun) __PR((char, void *)) = fa->outf; #endif register int count;
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/getargs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/getargs.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/getargs.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,12 +1,12 @@ -/* @(#)getargs.c 2.70 16/10/23 Copyright 1985, 1988, 1994-2016 J. Schilling */ +/* @(#)getargs.c 2.71 17/07/16 Copyright 1985, 1988, 1994-2017 J. Schilling */ #include <schily/mconfig.h> #ifndef lint static UConst char sccsid[] = - "@(#)getargs.c 2.70 16/10/23 Copyright 1985, 1988, 1994-2016 J. Schilling"; + "@(#)getargs.c 2.71 17/07/16 Copyright 1985, 1988, 1994-2017 J. Schilling"; #endif #define NEW /* - * Copyright (c) 1985, 1988, 1994-2016 J. Schilling + * Copyright (c) 1985, 1988, 1994-2017 J. Schilling * * 1.3.88 Start implementation of release 2 */ @@ -1096,8 +1096,10 @@ if (rsf[i].c == *p) break; } - if (i >= MAXSF) + if (i >= MAXSF) { + va_end(args); return (BADFLAG); + } if (i == nsf) { rsf[i].curarg = (void *)0; rsf[i].curfun = (void *)0;
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jsprintf.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,6 +1,6 @@ -/* @(#)jsprintf.c 1.19 16/01/21 Copyright 1985, 1995-2016 J. Schilling */ +/* @(#)jsprintf.c 1.20 17/08/03 Copyright 1985, 1995-2017 J. Schilling */ /* - * Copyright (c) 1985, 1995-2016 J. Schilling + * Copyright (c) 1985, 1995-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -57,7 +57,7 @@ #else va_start(args); #endif - ret = fprformat((intptr_t)stdout, form, args); + ret = fprformat(stdout, form, args); va_end(args); return (ret); } @@ -82,7 +82,7 @@ #else va_start(args); #endif - ret = fprformat((intptr_t)file, form, args); + ret = fprformat(file, form, args); va_end(args); return (ret); } @@ -103,7 +103,7 @@ } *BUF, _BUF;
LOCAL void _bflush __PR((BUF)); -LOCAL void _bput __PR((char, intptr_t)); +LOCAL void _bput __PR((char, void *)); EXPORT int js_fprintf __PR((FILE *, const char *, ...)); EXPORT int js_printf __PR((const char *, ...));
@@ -120,12 +120,12 @@
#ifdef PROTOTYPES LOCAL void -_bput(char c, intptr_t l) +_bput(char c, void *l) #else LOCAL void _bput(c, l) char c; - intptr_t l; + void *l; #endif { register BUF bp = (BUF)l; @@ -158,7 +158,7 @@ #else va_start(args); #endif - format(_bput, (intptr_t)&bb, form, args); + format(_bput, &bb, form, args); va_end(args); if (bb.cnt < BFSIZ) _bflush(&bb); @@ -189,7 +189,7 @@ #else va_start(args); #endif - format(_bput, (intptr_t)&bb, form, args); + format(_bput, &bb, form, args); va_end(args); if (bb.cnt < BFSIZ) _bflush(&bb);
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/jssnprintf.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,6 +1,6 @@ -/* @(#)jssnprintf.c 1.13 16/08/10 Copyright 1985, 1995-2016 J. Schilling */ +/* @(#)jssnprintf.c 1.14 17/08/03 Copyright 1985, 1995-2017 J. Schilling */ /* - * Copyright (c) 1985, 1995-2016 J. Schilling + * Copyright (c) 1985, 1995-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -33,12 +33,12 @@
#ifdef PROTOTYPES static void -_cput(char c, intptr_t l) +_cput(char c, void *l) #else static void _cput(c, l) char c; - intptr_t l; + void *l; #endif { register BUF bp = (BUF)l; @@ -78,7 +78,7 @@ #else va_start(args); #endif - cnt = format(_cput, (intptr_t)&bb, form, args); + cnt = format(_cput, &bb, form, args); va_end(args); if (maxcnt > 0) *(bb.ptr) = '\0';
Modified: trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/match.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/tools/mkisofs/schilytoo... ============================================================================== --- trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/match.c [iso-8859-1] (original) +++ trunk/reactos/sdk/tools/mkisofs/schilytools/libschily/match.c [iso-8859-1] Sat Sep 9 15:06:48 2017 @@ -1,10 +1,18 @@ -/* @(#)match.c 1.24 10/08/21 Copyright 1985, 1995-2010 J. Schilling */ +/* @(#)match.c 1.27 17/08/13 Copyright 1985, 1995-2017 J. Schilling */ #include <schily/standard.h> #include <schily/patmatch.h> +#define POSIX_CLASS /* Support [[:alpha:]] by default */ +#ifdef NO_POSIX_CLASS /* Allow to disable [[:alpha:]] */ +#undef POSIX_CLASS +#endif +#ifdef POSIX_CLASS +#include <schily/wchar.h> /* With [[:alpha:]], we need wctype() */ +#include <schily/wctype.h> /* and thus wchar.h and wctype.h */ +#endif /* * Pattern matching functions * - * Copyright (c) 1985, 1995-2010 J. Schilling + * Copyright (c) 1985, 1995-2017 J. Schilling */ /* * The contents of this file are subject to the terms of the @@ -13,6 +21,8 @@ * 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. @@ -33,6 +43,7 @@ * * Character classes have been added to allow "[<character list>]" * to be used. + * POSIX features like [[:alpha:]] have been added. * Start of line '^' and end of line '$' have been added. */
@@ -53,14 +64,35 @@ #define patmatch patwmatch #endif #define CHAR wchar_t +#define PCHAR wchar_t +#endif + +#ifdef __MB_CHAR +#undef patmatch +#ifdef __LINE_MATCH +#define patmatch patmblmatch +#else +#define patmatch patmbmatch +#endif +#define PCHAR wchar_t #endif
#ifndef CHAR typedef unsigned char Uchar; +#define DID_UCHAR_TYPE #define CHAR Uchar #endif
+#ifndef PCHAR +#ifndef DID_UCHAR_TYPE +typedef unsigned char Uchar; +#endif +#define PCHAR Uchar +#endif + #define ENDSTATE (-1) + +#define CL_SIZE 32 /* Max size for '[: :]' */
/* * The Interpreter @@ -91,22 +123,63 @@
/* * match a character in class - */ + * + * Syntax errors do not appear here, they are handled by the compiler, + * so in theory we could remove the "return (0)" statements from the + * the POSIX class code. + */ +#ifdef POSIX_CLASS +#define CHK_POSIX_CLASS \ + else if (*lpat == LCLASS) { \ + if (lpat[1] == ':') { \ + char class[CL_SIZE+1]; \ + char *pc = class; \ + \ + lpat += 2; /* Eat ':' */ \ + for (;;) { \ + if (*lpat == '\0') { \ + ok = FALSE; \ + goto out; \ + } \ + if (*lpat == ':' && lpat[1] == RCLASS) \ + break; \ + if (pc >= &class[CL_SIZE]) { \ + ok = FALSE; \ + goto out; \ + } \ + *pc++ = *lpat++; \ + } \ + if (pc == class) { \ + ok = FALSE; \ + goto out; \ + } \ + *pc = '\0'; \ + lpat += 2; /* Skip ":]" */ \ + if (iswctype(lc, wctype(class))) { \ + ok = !ok; \ + goto out; \ + } \ + continue; \ + } \ + } +#else +#define CHK_POSIX_CLASS +#endif #define in_class(found, pat, c) { \ - register const CHAR *lpat = pat; \ + register const PCHAR *lpat = pat; \ register int lc = c; \ int lo_bound; \ int hi_bound; \ - \ - found = FALSE; \ + BOOL ok = FALSE; \ \ if (*lpat == NOT) { \ lpat++; \ - found = TRUE; \ + ok = TRUE; \ } \ while (*lpat != RCLASS) { \ if (*lpat == QUOTE) \ lpat++; \ + CHK_POSIX_CLASS \ lo_bound = *lpat++; \ if (*lpat == RANGE) { \ lpat++; \ @@ -117,10 +190,12 @@ hi_bound = lo_bound; \ } \ if (lo_bound <= lc && lc <= hi_bound) { \ - found = !found; \ - break; \ + ok = !ok; \ + goto out; \ } \ } \ +out: \ + found = ok; \ }
/* @@ -129,10 +204,10 @@ * Trys to match a string beginning at offset * against the compiled pattern. */ -#ifndef __WIDE_CHAR +#if !defined(__WIDE_CHAR) && !defined(__MB_CHAR) EXPORT CHAR *opatmatch(pat, aux, str, soff, slen, alt) - const CHAR *pat; + const PCHAR *pat; const int *aux; const CHAR *str; int soff; @@ -153,7 +228,7 @@ */ EXPORT CHAR * patmatch(pat, aux, str, soff, slen, alt, state) - const CHAR *pat; + const PCHAR *pat; const int *aux; const CHAR *str; int soff; @@ -166,7 +241,12 @@ register int *i; register int p; register int q, s, k; +#ifdef __MB_CHAR + wchar_t c; + int mlen = 1; +#else int c; +#endif const CHAR *lastp = (CHAR *)NULL;
#ifdef __LINE_MATCH @@ -178,14 +258,29 @@ if (alt != ENDSTATE) put(sp, state, sp, alt);
+#ifdef __MB_CHAR + mbtowc(NULL, NULL, 0); + for (s = soff; ; s += mlen) { +#else for (s = soff; ; s++) { +#endif /* * next char from input string */ - if (s >= slen) + if (s >= slen) { c = 0; - else + } else { +#ifdef __MB_CHAR + mlen = mbtowc(&c, (char *)str, slen - s); + if (mlen < 0) { + mbtowc(NULL, NULL, 0); + c = str[s]; + mlen = 1; + } +#else c = str[s]; +#endif + } /* * first complete the closure */ @@ -287,17 +382,17 @@ }
-#ifndef __LINE_MATCH +#if !defined(__LINE_MATCH) && !defined(__MB_CHAR) /* * The Compiler */
typedef struct args { - const CHAR *pattern; + const PCHAR *pattern; int *aux; int patp; int length; - CHAR Ch; + PCHAR Ch; } arg_t;
LOCAL void nextitem __PR((arg_t *)); @@ -318,6 +413,15 @@ }
/* + * 'peek' the next character from pattern + */ +#define pch(ap) \ + ((((ap)->patp + 1) >= (ap)->length) ? \ + 0 \ + : \ + (ap)->pattern[(ap)->patp+1]) \ + +/* * get the next item from pattern */ LOCAL void @@ -348,8 +452,39 @@ case RBRACK: return (ENDSTATE); case LCLASS: - while (ap->Ch != RCLASS && ap->Ch != '\0') + while (ap->Ch != RCLASS && ap->Ch != '\0') { +#ifdef POSIX_CLASS + if (ap->Ch == LCLASS) { + if (pch(ap) == ':') { /* [:alpha:] */ + char class[CL_SIZE+1]; + char *pc = class; + + nextitem(ap); + nextitem(ap); + while (ap->Ch != ':' && + ap->Ch != '\0') { + if (pc > &class[CL_SIZE]) + return (ENDSTATE); + *pc = ap->Ch; + if (*pc++ != ap->Ch) + return (ENDSTATE); + nextitem(ap); + } + if (pc == class) + return (ENDSTATE); + *pc = '\0'; + if (ap->Ch == '\0') + return (ENDSTATE); + if (wctype(class) == 0) + return (ENDSTATE); + nextitem(ap); + } + if (ap->Ch != RCLASS) + return (ENDSTATE); + } +#endif nextitem(ap); + } if (ap->Ch == '\0') return (ENDSTATE); nextitem(ap); @@ -381,10 +516,12 @@ int exits = ENDSTATE; int a; int *aux = ap->aux; - CHAR Ch; + PCHAR Ch;
for (;;) { a = prim(ap); + if (a == ENDSTATE) + return (ENDSTATE); Ch = ap->Ch; if (Ch == ALT || Ch == RBRACK || Ch == '\0') { exits = join(aux, exits, a); @@ -445,7 +582,7 @@ */ EXPORT int patcompile(pat, len, aux) - const CHAR *pat; + const PCHAR *pat; int len; int *aux; { @@ -467,4 +604,4 @@ setexits(aux, i, ENDSTATE); return (alt); } -#endif /* LMATCH */ +#endif /* !defined(__LINE_MATCH) && !defined(__MB_CHAR) */