Compare commits
No commits in common. "1996e05ff664f2530cb8daaa9ea3a3504cf3c07c" and "b7a4fec16253177a95db956f1a39305ffc657913" have entirely different histories.
1996e05ff6
...
b7a4fec162
6
buffer.c
6
buffer.c
|
@ -24,10 +24,4 @@ b_truncate(Row *row) {
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
b_countlines(Row *row) {
|
||||
int lines = 1;
|
||||
for(; row->n != NULL; row = row->n) lines++;
|
||||
return lines;
|
||||
}
|
||||
|
||||
|
|
4
c_file.c
4
c_file.c
|
@ -1,7 +1,6 @@
|
|||
void
|
||||
c_open(char *file, char **argv) {
|
||||
if(argv[1] == NULL) { puts("usage: O filename"); return;}
|
||||
FILE *f = fopen(argv[1], "r");
|
||||
FILE *f = fopen(file + 2, "r");
|
||||
if(f == NULL) { puts("couldnt open file."); return; }
|
||||
b_truncate(buffer);
|
||||
Row *row = buffer;
|
||||
|
@ -39,4 +38,3 @@ c_save(char *file, char **argv) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
19
c_print.c
19
c_print.c
|
@ -7,7 +7,6 @@ else printf("%c", row->text[i]);
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
c_print(char *c, char **argv) {
|
||||
Row *row = buffer;
|
||||
|
@ -23,24 +22,6 @@ c_print(char *c, char **argv) {
|
|||
row = row -> n;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void
|
||||
c_print(char *c, char **argv) {
|
||||
int start = argv[1] != NULL ? atoi(argv[1]) : 1;
|
||||
int end = argv[2] != NULL ? atoi(argv[2]) : b_countlines(buffer);
|
||||
start = start > 1 ? start : 1;
|
||||
end = end < b_countlines(buffer) ? end : b_countlines(buffer);
|
||||
Row *row = b_getline(buffer, start);
|
||||
for(int line = start; line <= end; line++) {
|
||||
printf("%3.i| ", line);
|
||||
print_with_fixed_tabs(row);
|
||||
puts("");
|
||||
row = row->n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue