summaryrefslogtreecommitdiff
path: root/src/common/extstr.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-02-21 21:34:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-02-21 21:34:55 (GMT)
commita60e1fe19d09eb379c88fdbbe018ca086dc05bcb (patch)
treee72fa012a465517fe3b2f728d750b008ba88d707 /src/common/extstr.c
parent0769fafb253b846b58cd97c4a1df98ca7417ae1c (diff)
Cut symbol labels using words instead of single characters.
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] *