1997-11-24 22:37:52 +00:00
|
|
|
|
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
|
1998-04-13 02:02:47 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1998-04-13 02:02:47 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1998-04-13 02:02:47 +00:00
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Stripped down, converted to UTF-8 and test cases added
|
|
|
|
|
*
|
|
|
|
|
* Owen Taylor, 13 December 2002;
|
|
|
|
|
*/
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2012-10-02 17:27:25 +00:00
|
|
|
|
|
|
|
|
|
#include "gtkprivate.h"
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#include <string.h>
|
1997-12-05 04:29:22 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
|
|
static gunichar
|
|
|
|
|
get_char (const char **str)
|
|
|
|
|
{
|
|
|
|
|
gunichar c = g_utf8_get_char (*str);
|
|
|
|
|
*str = g_utf8_next_char (*str);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
Merge from stable:
2003-01-19 Tor Lillqvist <tml@iki.fi>
Merge from stable:
Fix for #103614 and some other problems with GtkFileSelection on
Windows:
* gtk/fnmatch.c (get_char): Need to use g_unichar_tolower(), not
g_ascii_tolower(). Windows file names are case-insensitive for all
Unicode letters.
* gtk/gtkfilesel.c: Instead of checking for G_OS_WIN32 or
G_WITH_CYGWIN, check G_PLATFORM_WIN32. Move inclusion of gtkintl.h
earlier, as it includes config.h unconditionally, and gtkprivate.h
redefines GTK_LOCALEDIR.
(struct _CompletionDirSent): Ifdef out the fields not used on
Windows.
(compare_utf8_filenames, compare_sys_filenames): Need different
comparison implementation for UTF-8 file names and system locale
file names on Win32. Cannot simply use g_ascii_strcasecmp(), but
need to casefold all Unicode letters.
(cmpl_completion_matches, open_dir, correct_parent): Ifdef out
variables not used on Win32 to avoid warnings about unused
variables.
(open_ref_dir): Use g_path_skip_root() to skip past potential
drive letter in front of the leading (back)slash.
(open_new_dir): Ifdef out use of CompletionDirSent fields not
there on Win32.
(correct_parent): Bypass inode check also on Cygwin.
Fix bug noticed by Alex Shaduri: Tooltips and other
GDK_WINDOW_TEMP windows were activated. This looked very odd, and
was a regression from earlier versions.
* gdk/win32/gdkwindow-win32.c (show_window_internal): Fine-tune
behaviour. Don't ever activate GDK_WINDOW_TEMP windows.
(gdk_window_move, gdk_window_resize): Add debug logging.
* gdk/win32/gdkevents-win32.c (gdk_event_translate): When we get a
WM_SIZE message for a non-visible (withdrawn) window, don't clear
the GDK_WINDOW_STATE_WITHDRAWN bit. The window is still withdrawn
even if its size changes.
2003-01-19 21:18:15 +00:00
|
|
|
|
#ifdef G_PLATFORM_WIN32
|
|
|
|
|
c = g_unichar_tolower (c);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return c;
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
|
|
|
|
#define DO_ESCAPE 0
|
|
|
|
|
#else
|
|
|
|
|
#define DO_ESCAPE 1
|
|
|
|
|
#endif
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
static gunichar
|
|
|
|
|
get_unescaped_char (const char **str,
|
|
|
|
|
gboolean *was_escaped)
|
|
|
|
|
{
|
|
|
|
|
gunichar c = get_char (str);
|
|
|
|
|
|
|
|
|
|
*was_escaped = DO_ESCAPE && c == '\\';
|
|
|
|
|
if (*was_escaped)
|
|
|
|
|
c = get_char (str);
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
/* Match STRING against the filename pattern PATTERN, returning zero if
|
|
|
|
|
it matches, nonzero if not. */
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_fnmatch_intern (const char *pattern,
|
|
|
|
|
const char *string,
|
2004-06-02 17:46:21 +00:00
|
|
|
|
gboolean component_start,
|
|
|
|
|
gboolean no_leading_period)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
{
|
|
|
|
|
const char *p = pattern, *n = string;
|
|
|
|
|
|
|
|
|
|
while (*p)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-12-13 23:18:03 +00:00
|
|
|
|
const char *last_n = n;
|
|
|
|
|
|
|
|
|
|
gunichar c = get_char (&p);
|
|
|
|
|
gunichar nc = get_char (&n);
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
switch (c)
|
|
|
|
|
{
|
2002-12-13 23:18:03 +00:00
|
|
|
|
case '?':
|
|
|
|
|
if (nc == '\0')
|
|
|
|
|
return FALSE;
|
|
|
|
|
else if (nc == G_DIR_SEPARATOR)
|
|
|
|
|
return FALSE;
|
2004-06-02 17:46:21 +00:00
|
|
|
|
else if (nc == '.' && component_start && no_leading_period)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
break;
|
|
|
|
|
case '\\':
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (DO_ESCAPE)
|
|
|
|
|
c = get_char (&p);
|
|
|
|
|
if (nc != c)
|
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
break;
|
|
|
|
|
case '*':
|
2004-06-02 17:46:21 +00:00
|
|
|
|
if (nc == '.' && component_start && no_leading_period)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
{
|
2021-05-03 11:33:49 +00:00
|
|
|
|
const char *last_p;
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
for (last_p = p, c = get_char (&p);
|
|
|
|
|
c == '?' || c == '*';
|
|
|
|
|
last_p = p, c = get_char (&p))
|
|
|
|
|
{
|
|
|
|
|
if (c == '?')
|
|
|
|
|
{
|
|
|
|
|
if (nc == '\0')
|
|
|
|
|
return FALSE;
|
|
|
|
|
else if (nc == G_DIR_SEPARATOR)
|
|
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
last_n = n; nc = get_char (&n);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
/* If the pattern ends with wildcards, we have a
|
|
|
|
|
* guaranteed match unless there is a dir separator
|
|
|
|
|
* in the remainder of the string.
|
|
|
|
|
*/
|
|
|
|
|
if (c == '\0')
|
|
|
|
|
{
|
|
|
|
|
if (strchr (last_n, G_DIR_SEPARATOR) != NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
else
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (DO_ESCAPE && c == '\\')
|
|
|
|
|
c = get_char (&p);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
for (p = last_p; nc != '\0';)
|
|
|
|
|
{
|
|
|
|
|
if ((c == '[' || nc == c) &&
|
2004-06-02 17:46:21 +00:00
|
|
|
|
gtk_fnmatch_intern (p, last_n, component_start, no_leading_period))
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
component_start = (nc == G_DIR_SEPARATOR);
|
|
|
|
|
last_n = n;
|
|
|
|
|
nc = get_char (&n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
|
{
|
|
|
|
|
/* Nonzero if the sense of the character class is inverted. */
|
2002-12-13 23:18:03 +00:00
|
|
|
|
gboolean not;
|
|
|
|
|
gboolean was_escaped;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (nc == '\0' || nc == G_DIR_SEPARATOR)
|
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2004-06-02 17:46:21 +00:00
|
|
|
|
if (nc == '.' && component_start && no_leading_period)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
|
|
not = (*p == '!' || *p == '^');
|
|
|
|
|
if (not)
|
|
|
|
|
++p;
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
c = get_unescaped_char (&p, &was_escaped);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
for (;;)
|
|
|
|
|
{
|
2002-12-13 23:18:03 +00:00
|
|
|
|
register gunichar cstart = c, cend = c;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (c == '\0')
|
|
|
|
|
/* [ (unterminated) loses. */
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
c = get_unescaped_char (&p, &was_escaped);
|
|
|
|
|
|
|
|
|
|
if (!was_escaped && c == '-' && *p != ']')
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-12-13 23:18:03 +00:00
|
|
|
|
cend = get_unescaped_char (&p, &was_escaped);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (cend == '\0')
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
c = get_char (&p);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (nc >= cstart && nc <= cend)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
goto matched;
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (!was_escaped && c == ']')
|
1997-11-24 22:37:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!not)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
matched:;
|
|
|
|
|
/* Skip the rest of the [...] that already matched. */
|
2002-12-13 23:18:03 +00:00
|
|
|
|
/* XXX 1003.2d11 is unclear if was_escaped is right. */
|
|
|
|
|
while (was_escaped || c != ']')
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (c == '\0')
|
|
|
|
|
/* [... (unterminated) loses. */
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
c = get_unescaped_char (&p, &was_escaped);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
if (not)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2002-12-13 23:18:03 +00:00
|
|
|
|
if (c != nc)
|
|
|
|
|
return FALSE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
component_start = (nc == G_DIR_SEPARATOR);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*n == '\0')
|
2002-12-13 23:18:03 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Match STRING against the filename pattern PATTERN, returning zero if
|
|
|
|
|
* it matches, nonzero if not.
|
|
|
|
|
*
|
|
|
|
|
* GTK+ used to use a old version of GNU fnmatch() that was buggy
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* in various ways and didn’t handle UTF-8. The following is
|
2002-12-13 23:18:03 +00:00
|
|
|
|
* converted to UTF-8. To simplify the process of making it
|
|
|
|
|
* correct, this is special-cased to the combinations of flags
|
|
|
|
|
* that gtkfilesel.c uses.
|
|
|
|
|
*
|
|
|
|
|
* FNM_FILE_NAME - always set
|
|
|
|
|
* FNM_LEADING_DIR - never set
|
|
|
|
|
* FNM_NOESCAPE - set only on windows
|
|
|
|
|
* FNM_CASEFOLD - set only on windows
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
_gtk_fnmatch (const char *pattern,
|
2004-06-02 17:46:21 +00:00
|
|
|
|
const char *string,
|
|
|
|
|
gboolean no_leading_period)
|
2002-12-13 23:18:03 +00:00
|
|
|
|
{
|
2004-06-02 17:46:21 +00:00
|
|
|
|
return gtk_fnmatch_intern (pattern, string, TRUE, no_leading_period);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-31 23:19:19 +00:00
|
|
|
|
#undef FNMATCH_TEST_CASES
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#ifdef FNMATCH_TEST_CASES
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2004-06-02 17:46:21 +00:00
|
|
|
|
#define TEST(pat, str, no_leading_period, result) \
|
|
|
|
|
g_assert (_gtk_fnmatch ((pat), (str), (no_leading_period)) == result)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
int main (int argc, char **argv)
|
|
|
|
|
{
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("[a-]", "-", TRUE, TRUE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("a", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("a", "b", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Test what ? matches */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("?", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("?", ".", TRUE, FALSE);
|
|
|
|
|
TEST ("a?", "a.", TRUE, TRUE);
|
|
|
|
|
TEST ("a/?", "a/b", TRUE, TRUE);
|
|
|
|
|
TEST ("a/?", "a/.", TRUE, FALSE);
|
|
|
|
|
TEST ("?", "/", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Test what * matches */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("*", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("*", ".", TRUE, FALSE);
|
|
|
|
|
TEST ("a*", "a.", TRUE, TRUE);
|
|
|
|
|
TEST ("a/*", "a/b", TRUE, TRUE);
|
|
|
|
|
TEST ("a/*", "a/.", TRUE, FALSE);
|
|
|
|
|
TEST ("*", "/", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Range tests */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("[ab]", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("[ab]", "c", TRUE, FALSE);
|
|
|
|
|
TEST ("[^ab]", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("[!ab]", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("[^ab]", "c", TRUE, TRUE);
|
|
|
|
|
TEST ("[!ab]", "c", TRUE, TRUE);
|
|
|
|
|
TEST ("[a-c]", "b", TRUE, TRUE);
|
|
|
|
|
TEST ("[a-c]", "d", TRUE, FALSE);
|
|
|
|
|
TEST ("[a-]", "-", TRUE, TRUE);
|
|
|
|
|
TEST ("[]]", "]", TRUE, TRUE);
|
|
|
|
|
TEST ("[^]]", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("[!]]", "a", TRUE, TRUE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Various unclosed ranges */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("[ab", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("[a-", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("[ab", "c", TRUE, FALSE);
|
|
|
|
|
TEST ("[a-", "c", TRUE, FALSE);
|
|
|
|
|
TEST ("[^]", "a", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Ranges and special no-wildcard matches */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("[.]", ".", TRUE, FALSE);
|
|
|
|
|
TEST ("a[.]", "a.", TRUE, TRUE);
|
|
|
|
|
TEST ("a/[.]", "a/.", TRUE, FALSE);
|
|
|
|
|
TEST ("[/]", "/", TRUE, FALSE);
|
|
|
|
|
TEST ("[^/]", "a", TRUE, TRUE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Basic tests of * (and combinations of * and ?) */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("a*b", "ab", TRUE, TRUE);
|
|
|
|
|
TEST ("a*b", "axb", TRUE, TRUE);
|
|
|
|
|
TEST ("a*b", "axxb", TRUE, TRUE);
|
|
|
|
|
TEST ("a**b", "ab", TRUE, TRUE);
|
|
|
|
|
TEST ("a**b", "axb", TRUE, TRUE);
|
|
|
|
|
TEST ("a**b", "axxb", TRUE, TRUE);
|
|
|
|
|
TEST ("a*?*b", "ab", TRUE, FALSE);
|
|
|
|
|
TEST ("a*?*b", "axb", TRUE, TRUE);
|
|
|
|
|
TEST ("a*?*b", "axxb", TRUE, TRUE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Test of *[range] */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("a*[cd]", "ac", TRUE, TRUE);
|
|
|
|
|
TEST ("a*[cd]", "axc", TRUE, TRUE);
|
|
|
|
|
TEST ("a*[cd]", "axx", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("a/[.]", "a/.", TRUE, FALSE);
|
|
|
|
|
TEST ("a*[.]", "a/.", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
/* Test of UTF-8 */
|
|
|
|
|
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("ä", "ä", TRUE, TRUE); /* TEST ("ä", "ä", TRUE); */
|
|
|
|
|
TEST ("?", "ä", TRUE, TRUE); /* TEST ("?", "ä", TRUE); */
|
|
|
|
|
TEST ("*ö", "äö", TRUE, TRUE); /* TEST ("*ö", "äö", TRUE); */
|
|
|
|
|
TEST ("*ö", "ääö", TRUE, TRUE); /* TEST ("*ö", "ääö", TRUE); */
|
|
|
|
|
TEST ("[ä]", "ä", TRUE, TRUE); /* TEST ("[ä]", "ä", TRUE); */
|
|
|
|
|
TEST ("[ä-ö]", "é", TRUE, TRUE); /* TEST ("[ä-ö]", "é", TRUE); */
|
|
|
|
|
TEST ("[ä-ö]", "a", TRUE, FALSE); /* TEST ("[ä-ö]", "a", FALSE); */
|
2002-12-13 23:18:03 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DO_ESCAPE
|
|
|
|
|
/* Tests of escaping */
|
2004-06-02 17:46:21 +00:00
|
|
|
|
TEST ("\\\\", "\\", TRUE, TRUE);
|
|
|
|
|
TEST ("\\?", "?", TRUE, TRUE);
|
|
|
|
|
TEST ("\\?", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("\\*", "*", TRUE, TRUE);
|
|
|
|
|
TEST ("\\*", "a", TRUE, FALSE);
|
|
|
|
|
TEST ("\\[a-b]", "[a-b]", TRUE, TRUE);
|
|
|
|
|
TEST ("[\\\\]", "\\", TRUE, TRUE);
|
|
|
|
|
TEST ("[\\^a]", "a", TRUE, TRUE);
|
|
|
|
|
TEST ("[a\\-c]", "b", TRUE, FALSE);
|
|
|
|
|
TEST ("[a\\-c]", "-", TRUE, TRUE);
|
|
|
|
|
TEST ("[a\\]", "a", TRUE, FALSE);
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#endif /* DO_ESCAPE */
|
|
|
|
|
|
|
|
|
|
return 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-13 23:18:03 +00:00
|
|
|
|
#endif /* FNMATCH_TEST_CASES */
|