Sdsutils
Collection of C utils based on Redis SDSlib string library.
Install / Use
/learn @paulc/SdsutilsREADME
Collection of C utils based on the excellent Redis SDSlib string library (https://github.com/antirez/redis).
This is intended to be used in standalone C programs and has no dependencies other than libc. This is mostly for the benefit of people who dislike dynamic library depenencies.
The library supports the normal SDSlib functions and also adds a number of utility functions based around these including basic file reading, regex searching (using SLRE), compression (using LZF), encryption (using Blowfish), and functional list-processing utilities (map/reduce/apply)
There isn't (currently( and documentation other tha the sdsutil.c source code and the example programs (readfile.c provides a fairly useful example of use of the library)
NOTE: The library is based on a fairly old version of the zmalloc/sds/list code from Redis. At some point syncing with head would be a good thing.
License: BSD
The additional functions provided are (from sdsutil.h):
int sdscount(sds s,char c); int sdsstartswith(sds s,sds prefix); int64_t sdsgetint(sds s,int len); sds sdscatint(sds s,int64_t num,int len); sds sdsread(FILE *fp,size_t nbyte); sds sdsreadfile(FILE *fp); sds sdsreaddelim(FILE *fp,void *delim,int len); sds sdsreadline(FILE *fp,const char *prompt); list *sdsmatchre(sds s,struct slre *slre,int ncap); list *sdsmatch(sds s,char *re); sds sdssha256(sds s); sds sdscompress(sds s); sds sdsdecompress(sds s); sds sdsencrypt(sds s,sds key,sds iv); sds sdsdecrypt(sds z,sds key); sds sdshex(sds s); sds sdsunhex(sds s); sds sdsrepr(sds s); sds sdsunrepr(sds s); void sdsprintrepr(FILE *fp,char *prefix,sds s,char *suffix); void sdsprinthex(FILE *fp,char *prefix,sds s,char *suffix); sds sdsexec(char *cmd); sds sdspipe(char *cmd,sds input); list *sdssplit(sds s,sds delim); sds listJoin(list *l,sds delim); list *listMap(list *l,void *(*f)(void *data),void (*free)(void *ptr),void *(*dup)(void *)); void listApply(list *l,void *(*f)(void *data)); void listReduce(list *l,void *init,void (*f)(void *acc,void *val)); list *listRange(list *l,int start,int end); list *listRangeDup(list *l,int start,int end); list *listFilter(list *l,int (*f)(void *data)); list *listFilterDup(list *l,int (*f)(void *data));
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
