Skip to content

Commit

Permalink
remove more read-only mode functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ikozyris committed Oct 4, 2024
1 parent 1ba3bea commit 668f523
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
14 changes: 3 additions & 11 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,9 @@ int main(int argc, char *argv[])
}

eligible = isc(argv[1]); // syntax highlighting
if (argc > 2 && (strcmp(argv[2], "-ro") == 0 ||
strcmp(argv[2], "--read-only") == 0)) {
read_fread_sl(fi);
printed = print_text_w(0);
print2header("Read-Only", 3);
goto ro;
} else {
//read_fgets(fi);
read_fread(fi);
print_text(0);
}
//read_fgets(fi);
read_fread(fi);
print_text(0);
fclose(fi);
}
wmove(text_win, 0, 0);
Expand Down
20 changes: 0 additions & 20 deletions utils/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,6 @@ void print_text(unsigned line)
}
}

// print text with line wrapping
unsigned print_text_w(unsigned start)
{
wmove(text_win, 0, 0);
buf_indx = start;
while ((unsigned)getcury(text_win) < maxy - 1 && buf_indx < it->len)
waddch(text_win, it->buffer[buf_indx++]);
wclrtobot(text_win);
return buf_indx - start; // how many characters were printed
}

void save()
{
if (!filename)
Expand Down Expand Up @@ -116,15 +105,6 @@ void read_fgets(FILE *fi)
}
}

// read in single line
void read_fread_sl(FILE *fi)
{
char tmp[SZ];
unsigned a = 0; // bytes read
while ((a = fread(tmp, sizeof(tmp[0]), SZ, fi)))
apnd_s(*it, tmp, a);
}

inline long whereis(const char *str, char ch)
{
const char *end = strchr(str, ch);
Expand Down

0 comments on commit 668f523

Please sign in to comment.