This commit is contained in:
Your Name 2025-05-04 12:52:17 +03:00
parent ec265a4c23
commit ad0d7d25ff
5 changed files with 171 additions and 109 deletions

16
libmu/file_open.c Normal file
View file

@ -0,0 +1,16 @@
#include "file_open.h"
FILE *file_open(const char *prog, const char *path, const char *mode) {
if (!strcmp(path, "-"))
return stdin;
FILE *fp = fopen(path, mode);
if (fp == NULL) {
if (prog)
fprintf(stderr, "%s: %s\n", prog, strerror(errno));
return NULL;
}
return fp;
}