X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=wildcard.c;h=c1cb0b49e657169493aacb48a0d1454426a987e8;hb=510f49e405e71ba5c97875e7a019364e1ef5fac9;hp=4084e0936f054560cb8a12022e7e52e5c83cdbc2;hpb=78acf8edb871f70216c268ba7d23cd31dbb1c1be;p=PuTTY.git diff --git a/wildcard.c b/wildcard.c index 4084e093..c1cb0b49 100644 --- a/wildcard.c +++ b/wildcard.c @@ -10,6 +10,8 @@ #include #include +#include "putty.h" + /* * Definition of wildcard syntax: * @@ -27,6 +29,17 @@ * - All other characters are non-special and match themselves. */ +/* + * Some notes on differences from POSIX globs (IEEE Std 1003.1, 2003 ed.): + * - backslashes act as escapes even within [] bracket expressions + * - does not support [!...] for non-matching list (POSIX are weird); + * NB POSIX allows [^...] as well via "A bracket expression starting + * with an unquoted circumflex character produces unspecified + * results". If we wanted to allow [!...] we might want to define + * [^!] as having its literal meaning (match '^' or '!'). + * - none of the scary [[:class:]] stuff, etc + */ + /* * The wildcard matching technique we use is very simple and * potentially O(N^2) in running time, but I don't anticipate it @@ -313,7 +326,8 @@ int wc_unescape(char *output, const char *wildcard) wildcard++; } } - *output = '\0'; + if (output) + *output = '\0'; return 1; /* it's clean */ }