summaryrefslogtreecommitdiff
path: root/qstd
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2025-01-04 18:41:27 +1100
committerquou <quou@disroot.org>2025-01-04 18:41:57 +1100
commitd05d908ac86243ca9413fbcad38e3d09a66c4b8a (patch)
treef847e944a8537f320425143b118dea9600211778 /qstd
parente85c68ffd7a9741fef24fa60e8be8a2deb63a8d0 (diff)
next_line in qstd
Diffstat (limited to 'qstd')
-rw-r--r--qstd/str.c8
-rw-r--r--qstd/str.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/qstd/str.c b/qstd/str.c
index 5461880..710409b 100644
--- a/qstd/str.c
+++ b/qstd/str.c
@@ -64,3 +64,11 @@ char* dup_stringh(struct Heap* h, const char* s) {
string_copy(d, s);
return d;
}
+
+const char* next_line(const char* line) {
+ const char* c;
+ for (c = line; *c != '\n'; c++) {
+ if (!*c) return 0;
+ }
+ return c + 1;
+}
diff --git a/qstd/str.h b/qstd/str.h
index 8158554..cb35796 100644
--- a/qstd/str.h
+++ b/qstd/str.h
@@ -16,5 +16,6 @@ int string_copy(char* dst, const char* src);
int string_len(const char* s);
char* dup_string(struct Arena* a, const char* s);
char* dup_stringh(struct Heap* h, const char* s);
+const char* next_line(const char* line);
#endif