2022-04-03 07:15:22 +00:00
|
|
|
Row *
|
|
|
|
b_getline(Row *r, int l) {
|
|
|
|
if (l == 1) return r;
|
|
|
|
if (r->n == NULL) return NULL;
|
|
|
|
return b_getline(r->n, l - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
Row *
|
|
|
|
b_insert(Row *r) {
|
|
|
|
Row *new = calloc(1, sizeof(Row));
|
|
|
|
new->n = r->n;
|
|
|
|
new->p = r;
|
|
|
|
r->n = new;
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
b_truncate(Row *row) {
|
|
|
|
Row *n = row->n;
|
|
|
|
row->n = NULL;
|
|
|
|
if (n != NULL) {
|
|
|
|
b_truncate(n);
|
|
|
|
free(n);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-03 08:28:24 +00:00
|
|
|
int
|
|
|
|
b_countlines(Row *row) {
|
|
|
|
int lines = 1;
|
|
|
|
for(; row->n != NULL; row = row->n) lines++;
|
|
|
|
return lines;
|
|
|
|
}
|
2022-04-03 07:15:22 +00:00
|
|
|
|