diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-08 21:39:42 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-08 21:39:42 +0100 |
| commit | 764f8d22b250e09c1dea98fb8073e71a720892f7 (patch) | |
| tree | 8357f9f673846125ac49ff0f12288d242eb2fa49 /lib/cstr/cstr.h | |
| parent | b97ec93748902c90f25524116d3d189f1b263474 (diff) | |
add pager
Diffstat (limited to 'lib/cstr/cstr.h')
| -rw-r--r-- | lib/cstr/cstr.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/cstr/cstr.h b/lib/cstr/cstr.h index 80dc359..ce27eb0 100644 --- a/lib/cstr/cstr.h +++ b/lib/cstr/cstr.h @@ -3,6 +3,11 @@ #include "../sys/sizes.h" +typedef struct { + char *begin; + char *end; +} substr_t; + u64 cstr_length(const char *); i8 cstr_compare(const char *a, const char *b); u64 cstr_split(char *cstr, char split); @@ -10,6 +15,10 @@ const char *next_split(const char *previous); u64 strip_front(char *cstr, char strip); u64 strip_back(char *cstr, char strip); u64 strip_cstr(char *cstr, char strip); +u64 number_of_lines(const char *cstr); + +substr_t getline(const char *cstr, u64 n); +substr_t nextline(substr_t line); u64 cstr_utf8_length(const char *); u8 next_utf8(const char **); |