fastbuf ff-binary ff-string ff-printf ff-unicode \
fb-file carefulio fb-mem fb-temp fb-mmap fb-limfd fb-buffer fb-grow fb-pool fb-atomic fb-param fb-socket \
str_ctype str_upper str_lower unicode stkstring \
- wildmatch wordsplit ctmatch patimatch patmatch regex \
+ wildmatch ctmatch regex \
prime primetable random timer randomkey \
bit-ffs bit-fls \
db \
base64 base224 \
sync \
qache \
- string str-esc \
+ string str-esc str-split str-match str-imatch \
bbuf \
getopt
+++ /dev/null
-/*
- * UCW Library -- Shell-Like Case-Insensitive Pattern Matching (currently only '?' and '*')
- *
- * (c) 1997 Martin Mares <mj@ucw.cz>
- *
- * This software may be freely distributed and used according to the terms
- * of the GNU Lesser General Public License.
- */
-
-#include "lib/lib.h"
-#include "lib/chartype.h"
-
-#define Convert(x) Cupcase(x)
-#define MATCH_FUNC_NAME str_match_pattern_nocase
-
-#include "lib/patmatch.h"
+++ /dev/null
-/*
- * UCW Library -- Shell-Like Pattern Matching (currently only '?' and '*')
- *
- * (c) 1997 Martin Mares <mj@ucw.cz>
- *
- * This software may be freely distributed and used according to the terms
- * of the GNU Lesser General Public License.
- */
-
-#include "lib/lib.h"
-
-#define Convert(x) (x)
-#define MATCH_FUNC_NAME str_match_pattern
-
-#include "lib/patmatch.h"
+++ /dev/null
-/*
- * UCW Library -- Generic Shell-Like Pattern Matching (currently only '?' and '*')
- *
- * (c) 1997 Martin Mares <mj@ucw.cz>
- *
- * This software may be freely distributed and used according to the terms
- * of the GNU Lesser General Public License.
- */
-
-#include "lib/string.h"
-
-int
-MATCH_FUNC_NAME(const char *p, const char *s)
-{
- while (*p)
- {
- if (*p == '?' && *s)
- p++, s++;
- else if (*p == '*')
- {
- int z = p[1];
-
- if (!z)
- return 1;
- if (z == '\\' && p[2])
- z = p[2];
- z = Convert(z);
- for(;;)
- {
- while (*s && Convert(*s) != z)
- s++;
- if (!*s)
- return 0;
- if (MATCH_FUNC_NAME(p+1, s))
- return 1;
- s++;
- }
- }
- else
- {
- if (*p == '\\' && p[1])
- p++;
- if (Convert(*p++) != Convert(*s++))
- return 0;
- }
- }
- return !*s;
-}
--- /dev/null
+/*
+ * UCW Library -- Shell-Like Case-Insensitive Pattern Matching (currently only '?' and '*')
+ *
+ * (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#include "lib/lib.h"
+#include "lib/chartype.h"
+
+#define Convert(x) Cupcase(x)
+#define MATCH_FUNC_NAME str_match_pattern_nocase
+
+#include "lib/str-match.h"
--- /dev/null
+/*
+ * UCW Library -- Shell-Like Pattern Matching (currently only '?' and '*')
+ *
+ * (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#include "lib/lib.h"
+
+#define Convert(x) (x)
+#define MATCH_FUNC_NAME str_match_pattern
+
+#include "lib/str-match.h"
--- /dev/null
+/*
+ * UCW Library -- Generic Shell-Like Pattern Matching (currently only '?' and '*')
+ *
+ * (c) 1997 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#include "lib/string.h"
+
+int
+MATCH_FUNC_NAME(const char *p, const char *s)
+{
+ while (*p)
+ {
+ if (*p == '?' && *s)
+ p++, s++;
+ else if (*p == '*')
+ {
+ int z = p[1];
+
+ if (!z)
+ return 1;
+ if (z == '\\' && p[2])
+ z = p[2];
+ z = Convert(z);
+ for(;;)
+ {
+ while (*s && Convert(*s) != z)
+ s++;
+ if (!*s)
+ return 0;
+ if (MATCH_FUNC_NAME(p+1, s))
+ return 1;
+ s++;
+ }
+ }
+ else
+ {
+ if (*p == '\\' && p[1])
+ p++;
+ if (Convert(*p++) != Convert(*s++))
+ return 0;
+ }
+ }
+ return !*s;
+}
--- /dev/null
+/*
+ * UCW Library -- Word Splitting
+ *
+ * (c) 1997 Martin Mares <mj@ucw.cz>
+ * (c) 2004 Robert Spalek <robert@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
+ */
+
+#include "lib/lib.h"
+#include "lib/chartype.h"
+#include "lib/string.h"
+
+#include <string.h>
+
+int
+str_sepsplit(char *str, uns sep, char **rec, uns max)
+{
+ uns cnt = 0;
+ while (1)
+ {
+ rec[cnt++] = str;
+ str = strchr(str, sep);
+ if (!str)
+ return cnt;
+ if (cnt >= max)
+ return -1;
+ *str++ = 0;
+ }
+}
+
+int
+str_wordsplit(char *src, char **dst, uns max)
+{
+ uns cnt = 0;
+
+ for(;;)
+ {
+ while (Cspace(*src))
+ *src++ = 0;
+ if (!*src)
+ break;
+ if (cnt >= max)
+ return -1;
+ if (*src == '"')
+ {
+ src++;
+ dst[cnt++] = src;
+ while (*src && *src != '"')
+ src++;
+ if (*src)
+ *src++ = 0;
+ }
+ else
+ {
+ dst[cnt++] = src;
+ while (*src && !Cspace(*src))
+ src++;
+ }
+ }
+ return cnt;
+}
#ifndef _UCW_STRING_H
#define _UCW_STRING_H
-char *str_unesc(char *dest, const char *src);
+/* string.c */
+
char *str_format_flags(char *dest, const char *fmt, uns flags);
-/* wordsplit.c */
+/* str-esc.c */
+
+char *str_unesc(char *dest, const char *src);
+
+/* str-split.c */
int str_sepsplit(char *str, uns sep, char **rec, uns max);
int str_wordsplit(char *str, char **rec, uns max);
-/* pat(i)match.c: Matching of shell patterns */
+/* str-(i)match.c: Matching of shell patterns */
int str_match_pattern(const char *patt, const char *str);
int str_match_pattern_nocase(const char *patt, const char *str);
+++ /dev/null
-/*
- * UCW Library -- Word Splitting
- *
- * (c) 1997 Martin Mares <mj@ucw.cz>
- * (c) 2004 Robert Spalek <robert@ucw.cz>
- *
- * This software may be freely distributed and used according to the terms
- * of the GNU Lesser General Public License.
- */
-
-#include "lib/lib.h"
-#include "lib/chartype.h"
-#include "lib/string.h"
-
-#include <string.h>
-
-int
-str_sepsplit(char *str, uns sep, char **rec, uns max)
-{
- uns cnt = 0;
- while (1)
- {
- rec[cnt++] = str;
- str = strchr(str, sep);
- if (!str)
- return cnt;
- if (cnt >= max)
- return -1;
- *str++ = 0;
- }
-}
-
-int
-str_wordsplit(char *src, char **dst, uns max)
-{
- uns cnt = 0;
-
- for(;;)
- {
- while (Cspace(*src))
- *src++ = 0;
- if (!*src)
- break;
- if (cnt >= max)
- return -1;
- if (*src == '"')
- {
- src++;
- dst[cnt++] = src;
- while (*src && *src != '"')
- src++;
- if (*src)
- *src++ = 0;
- }
- else
- {
- dst[cnt++] = src;
- while (*src && !Cspace(*src))
- src++;
- }
- }
- return cnt;
-}