summaryrefslogtreecommitdiff
path: root/rushs/tinyprintf/my_strtok_r
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-10-11 22:19:00 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-10-11 22:19:00 +0200
commit73c2b00a10c5786ddeeacc915e233fd4df1c9321 (patch)
treee299ea4e8ac161b2b21170172ff8f182c1c3fe1a /rushs/tinyprintf/my_strtok_r
parentc9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (diff)
fix: evalexpr & tinyprintf contenaient toute la piscine
Diffstat (limited to 'rushs/tinyprintf/my_strtok_r')
-rw-r--r--rushs/tinyprintf/my_strtok_r/my_strtok_r.c51
-rw-r--r--rushs/tinyprintf/my_strtok_r/my_strtok_r.h6
2 files changed, 0 insertions, 57 deletions
diff --git a/rushs/tinyprintf/my_strtok_r/my_strtok_r.c b/rushs/tinyprintf/my_strtok_r/my_strtok_r.c
deleted file mode 100644
index ec052b7..0000000
--- a/rushs/tinyprintf/my_strtok_r/my_strtok_r.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "my_strtok_r.h"
-
-#include <stddef.h>
-
-static int is_delim(char c, const char *delims)
-{
- for (const char *d = delims; *d; d++)
- {
- if (*d == c)
- return 1;
- }
- return 0;
-}
-
-char *my_strtok_r(char *str, const char *delim, char **saveptr)
-{
- if (str == NULL)
- {
- if (*saveptr == NULL)
- {
- return NULL;
- }
- str = *saveptr;
- }
-
- size_t i = 0;
- while (str[i] != '\0' && is_delim(str[i], delim))
- {
- i++;
- }
- if (str[i] == '\0')
- {
- *saveptr = NULL;
- return NULL;
- }
-
- char *res = str + i;
-
- while (str[i] != '\0' && !is_delim(str[i], delim))
- {
- i++;
- }
- if (str[i] == '\0')
- {
- *saveptr = NULL;
- return res;
- }
- *saveptr = str + i + 1;
- str[i] = '\0';
- return res;
-}
diff --git a/rushs/tinyprintf/my_strtok_r/my_strtok_r.h b/rushs/tinyprintf/my_strtok_r/my_strtok_r.h
deleted file mode 100644
index 5603729..0000000
--- a/rushs/tinyprintf/my_strtok_r/my_strtok_r.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef MY_STRTOK_R_H
-#define MY_STRTOK_R_H
-
-char *my_strtok_r(char *str, const char *delim, char **saveptr);
-
-#endif /* ! MY_STRTOK_R_H */