summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:37:55 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-07-31 17:37:55 -0300
commit300d834e9151637962d36df1ba650fbf1666c722 (patch)
treeafdc42757aab0b24c58d1af870725f600a854172 /misc.c
parent85d46c79c53ea73d76e5146523c09603788bcb2a (diff)
misc: Make sure that `s` starts at the character before the delimiter in
`find_delm()` Also `s` doesn't get incremented when checking if the current character is a backslash now.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/misc.c b/misc.c
index a2502e2..97333eb 100644
--- a/misc.c
+++ b/misc.c
@@ -72,9 +72,9 @@ char *get_line(char **str) {
char *find_delm(char *str, const char *delm, int skip_delm) {
if (!is_empty(str)) {
char *s;
- for (s = str; *s != '\0'; s += strcspn(s, delm)) {
- if (*s++ == '\\') {
- s += strspn(s, delm);
+ for (s = &str[strcspn(str, delm)]; *s != '\0'; s += strcspn(s, delm)) {
+ if (*s == '\\') {
+ s += strspn(++s, delm);
continue;
} else {
break;