first commit

This commit is contained in:
2026-05-26 23:15:35 +09:00
commit 3df6e5d0dc
16 changed files with 5962 additions and 0 deletions

21
str.c Normal file
View File

@@ -0,0 +1,21 @@
#include "dat.h"
#include "fn.h"
enum
{
Maxrunes = nelem(((Str*)0)->r),
};
void
sinit(Str *s, char *src, int n)
{
int len;
s->n = 0;
while(n > 0 && s->n < Maxrunes){
len = chartorune(&s->r[s->n], src);
s->n++;
src += len;
n -= len;
}
}