๐ŸŽ€ Toy Gemini Client Written in C99
cli retro gemini gemtext terminal tls lightweight minimal c99 gemini-protocol
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(viv): implement `VIV_split` for future use

Fuwn 15722d02 12083cb8

+19
+4
include/viv/viv.h
··· 6 6 7 7 #pragma once 8 8 9 + typedef void(*split_fn)(const char *, int, void *); 10 + 9 11 static const char *VIV_version = "1.0.0"; 10 12 11 13 int VIV_exit(int, const char *, ...); 14 + /* http://www.martinbroadhurst.com/split-a-string-in-c.html */ 15 + void VIV_split(const char *, char, split_fn, void *); 12 16 13 17 #endif /* VIV_VIV_H */
+15
viv/viv.c
··· 168 168 169 169 return print_result; 170 170 } 171 + 172 + void VIV_split(const char *string, char separator, split_fn function, void *data) { 173 + unsigned int start, stop; 174 + 175 + start, stop = 0; 176 + 177 + for (stop = 0; string[stop]; ++stop) { 178 + if (string[stop] == separator) { 179 + function(string + start, stop - start, data); 180 + start = stop + 1; 181 + } 182 + } 183 + 184 + function(string + start, stop - start, data); 185 + }