commit 13d49d2d94041002d509994a2f7fe7908aea4f64
parent 6c3db99dc0c73c16baa620ceebd6b213caa2d897
Author: phoebos <ben@bvnf.space>
Date: Tue, 11 Oct 2022 11:14:50 +0100
ed: add some comments
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ed.c b/ed.c
@@ -23,7 +23,7 @@ struct line {
struct line *first;
int num_lines = 0;
-int cur_line = 1;
+int cur_line = 1; // TODO: should start at 0
void
print_byte_counts(size_t n) {
@@ -117,7 +117,7 @@ read_buf(char *path) {
return 1;
}
print_byte_counts(bytes);
- cur_line = 1;
+ cur_line = 1; // TODO: POSIX wants cur_line to be the last line in the buf
return 0;
}
@@ -237,8 +237,10 @@ ed(char *startfile) {
if (read_buf(startfile) != 0)
return 1;
+ /* main loop */
while (1) {
char *c;
+ /* print prompt */
if (prompt) {
printf("%c ", prompt);
if (fflush(stdout) == EOF) {