This commit is contained in:
2025-07-14 23:07:13 -04:00
parent d6cf8c5dd6
commit 3a9d52c513
10 changed files with 40 additions and 6 deletions

View File

@@ -1,9 +0,0 @@
#ifndef ERROR_H
#define ERROR_H
typedef struct {
int stat;
const char *src;
} error_t;
#endif

View File

@@ -1,22 +0,0 @@
#include "file.h"
#include "e.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
error_t write(char *path, char *format, ...) {
error_t err;
va_list args;
va_start(args, format);
FILE *fp;
fp = fopen(path, "w");
if (!fp) {
err.stat = errno;
err.src = strerror(errno);
}
vfprintf(fp, format, args);
fclose(fp);
va_end(args);
return err;
}

View File

@@ -1,9 +0,0 @@
#ifndef FILE_H
#define FILE_H
#include "e.h"
error_t write(char *, char *, ...);
void printfn(char *, ...);
#endif

View File

@@ -1,14 +0,0 @@
#include "print.h"
#include <stdarg.h>
#include <stdio.h>
int printfn(char *format, ...) {
int len;
va_list args;
va_start(args, format);
fprintf(stderr, "yait: ");
len = vfprintf(stderr, format, args);
putchar('\n');
va_end(args);
return len;
}

View File

@@ -1,9 +0,0 @@
#ifndef PRINT_H
#define PRINT_H
#include <stdarg.h>
#include <stdio.h>
int printfn(char *, ...);
#endif