Fix typos + wrong header includes

This commit is contained in:
Shav Kinderlehrer 2023-04-10 23:47:45 -04:00
parent 907dbe6cae
commit 41487c8ae6
2 changed files with 3 additions and 6 deletions

View File

@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "file.h" #include "file.h"
#include "lib.h" #include "util.h"
struct filedata readfile(FILE *fp) { struct filedata readfile(FILE *fp) {
struct filedata f; struct filedata f;

View File

@ -15,9 +15,6 @@
void run(FILE *fp, char *filename) { void run(FILE *fp, char *filename) {
int tty = isatty(STDOUT_FILENO); int tty = isatty(STDOUT_FILENO);
if (fp == NULL)
die("fopen");
struct filedata f; struct filedata f;
f = readfile(fp); f = readfile(fp);
@ -56,9 +53,9 @@ void run(FILE *fp, char *filename) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc > 1) { if (argc > 1) {
for (int i = 1; i < argc; i++) { // start at one to offset argv[0] for (int i = 1; i < argc; i++) { // start at one to offset argv[0]
printf("%s\r\n", argv[i]);
FILE *fp = fopen(argv[i], "rb"); FILE *fp = fopen(argv[i], "rb");
if (fp == NULL)
die(argv[i]);
run(fp, argv[i]); run(fp, argv[i]);
fclose(fp); fclose(fp);