2022-04-02 15:05:07 +00:00
|
|
|
void
|
2022-04-03 08:05:25 +00:00
|
|
|
c_insertline(char *c, char **argv) {
|
2022-04-02 15:05:07 +00:00
|
|
|
c += 2;
|
|
|
|
int line = atoi(c);
|
|
|
|
for(; *c != 0 && *c != ' '; c++);
|
|
|
|
c += 1; // start of text
|
|
|
|
Row *r = b_getline(buffer, line);
|
|
|
|
if (r == NULL) {
|
|
|
|
printf("%i, invalid line.\n", line);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ^ same as write line
|
|
|
|
r = b_insert(r);
|
|
|
|
// v same as write line
|
|
|
|
int i = 0;
|
|
|
|
for (;i < ROW_SIZE && c[i] != 0; i++) {
|
|
|
|
r->text[i] = c[i];
|
|
|
|
}
|
|
|
|
for(;i < ROW_SIZE; i++) {
|
|
|
|
r->text[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
2022-04-03 08:05:25 +00:00
|
|
|
|