From 764f8d22b250e09c1dea98fb8073e71a720892f7 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 8 Feb 2023 21:39:42 +0100 Subject: add pager --- lib/cstr/cstr.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/cstr/cstr.h') 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 **); -- cgit v1.2.3-70-g09d2