Fix binary printing bug

This commit is contained in:
Shav Kinderlehrer 2023-04-17 10:44:30 -04:00
parent c3e8f013d2
commit 15986b04ff
2 changed files with 1 additions and 3 deletions

View File

@ -28,8 +28,6 @@ struct filedata readfile(FILE *fp) {
die("fread"); die("fread");
} }
f.lc = 10000;
// guess if printable // guess if printable
// from https://github.com/sharkdp/content_inspector/blob/master/src/lib.rs // from https://github.com/sharkdp/content_inspector/blob/master/src/lib.rs
int testlen = f.buflen >= 64 ? 64 : f.buflen; int testlen = f.buflen >= 64 ? 64 : f.buflen;

View File

@ -50,7 +50,7 @@ void run(FILE *fp, char *filename, bool tty) {
free(f.lines[i].buf); free(f.lines[i].buf);
} }
} else { } else {
printf("%s", f.buf); fwrite(f.buf, 1, f.buflen, stdout);
} }
free(f.buf); free(f.buf);