TECO-64
TECO-64 copied to clipboard
`^N` (end of file flag) cause crashes when no input file.
And a fix is provided:
diff --git a/src/flag_cmd.c b/src/flag_cmd.c
index e73646a2..9ede57df 100644
--- a/src/flag_cmd.c
+++ b/src/flag_cmd.c
@@ -514,9 +514,13 @@ bool scan_flag1(struct cmd *cmd)
confirm(cmd, NO_N);
struct ifile *ifile = &ifiles[istream];
- int_t eof = feof(ifile->fp) ? -1 : 0;
+ if (ifile->fp == NULL)
+ store_val(0);
+ else {
+ int_t eof = feof(ifile->fp) ? -1 : 0;
- store_val(eof);
+ store_val(eof);
+ }
return true;
}