summaryrefslogtreecommitdiff
path: root/src/common/extstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/extstr.c')
-rw-r--r--src/common/extstr.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/common/extstr.c b/src/common/extstr.c
index bd561ba..83dcace 100644
--- a/src/common/extstr.c
+++ b/src/common/extstr.c
@@ -251,6 +251,52 @@ char *_strxxx(char *str, int (* fn) (int))
/******************************************************************************
* *
+* Paramètres : str = chaîne de caractères à traiter. [OUT] *
+* delim = mot de séparation entre les mots identifiés. *
+* *
+* Description : Extrait un mot d'une chaîne selon des séparations longues. *
+* *
+* Retour : Chaîne de caractères cernée ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *strtok_w(char **str, const char *delim)
+{
+ char *result;
+ char *haystack;
+ char *next;
+ const char *diter;
+
+ haystack = *str;
+
+ if (haystack == NULL)
+ result = NULL;
+
+ else
+ {
+ result = haystack;
+
+ next = strstr(haystack, delim);
+
+ if (next != NULL)
+ {
+ for (diter = delim; *diter; diter++, next++)
+ *next = '\0';
+ }
+
+ *str = next;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : str = chaîne de caractères à traiter. *
* delim = séparateur entre les mots. *
* count = nombre de mots trouvés. [OUT] *