1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
From: =?utf-8?b?0L3QsNCx?= <nabijaczleweli@nabijaczleweli.xyz>
Date: Fri, 22 Aug 2025 00:38:23 +0200
Subject: Remove the only user of subfderr (replace with stdio)
---
meson.build | 1 -
readwrite.h | 6 ------
safecat.c | 1 -
strerr_die.c | 10 ++++------
subfd.h | 8 --------
subfderr.c | 7 -------
writefile.c | 3 +--
7 files changed, 5 insertions(+), 31 deletions(-)
delete mode 100644 readwrite.h
delete mode 100644 subfd.h
delete mode 100644 subfderr.c
diff --git a/meson.build b/meson.build
index 4275f25..91affc7 100644
--- a/meson.build
+++ b/meson.build
@@ -14,7 +14,6 @@ executable('safecat',
'stralloc_pend.c',
'strerr_die.c',
'strerr_sys.c',
- 'subfderr.c',
'substdi.c',
'substdio.c',
'substdo.c',
diff --git a/readwrite.h b/readwrite.h
deleted file mode 100644
index 89c20d7..0000000
--- a/readwrite.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef READWRITE_H
-#define READWRITE_H
-
-extern int false_write(int fd, char *buf, int len);
-
-#endif
diff --git a/safecat.c b/safecat.c
index 0a86cf3..30e0a07 100644
--- a/safecat.c
+++ b/safecat.c
@@ -13,7 +13,6 @@
#include "stat_dir.h"
#include "stralloc.h"
#include "strerr.h"
-#include "subfd.h"
#include "tempfile.h"
#include "writefile.h"
#include <sys/types.h>
diff --git a/strerr_die.c b/strerr_die.c
index 69d74f9..fc5cc35 100644
--- a/strerr_die.c
+++ b/strerr_die.c
@@ -1,7 +1,6 @@
-#include "substdio.h"
-#include "subfd.h"
#include "strerr.h"
#include <stdarg.h>
+#include <stdio.h>
#include <unistd.h>
void strerr_die(int e, struct strerr *se, ...)
@@ -11,15 +10,14 @@ void strerr_die(int e, struct strerr *se, ...)
va_list ap;
va_start(ap, se);
for(char *s; (s = va_arg(ap, char *)); ) {
- substdio_puts(subfderr,s);
+ fputs(s, stderr);
}
if(se) {
- if (se->x) substdio_puts(subfderr,se->x);
+ if (se->x) fputs(se->x, stderr);
}
- substdio_puts(subfderr,"\n");
- substdio_flush(subfderr);
+ fputc('\n', stderr);
_exit(e);
}
diff --git a/subfd.h b/subfd.h
deleted file mode 100644
index e36b8a6..0000000
--- a/subfd.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef SUBFD_H
-#define SUBFD_H
-
-#include "substdio.h"
-
-extern substdio *subfderr;
-
-#endif
diff --git a/subfderr.c b/subfderr.c
deleted file mode 100644
index 8c5c537..0000000
--- a/subfderr.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "readwrite.h"
-#include "substdio.h"
-#include "subfd.h"
-
-char subfd_errbuf[256];
-static substdio it = SUBSTDIO_FDBUF(false_write,2,subfd_errbuf,256);
-substdio *subfderr = ⁢
diff --git a/writefile.c b/writefile.c
index 4483ff2..5ca8a37 100644
--- a/writefile.c
+++ b/writefile.c
@@ -2,7 +2,6 @@
/* Copyright (c) 2000, Len Budney. See COPYING for details. */
#include "stralloc.h"
#include "strerr.h"
-#include "subfd.h"
#include "substdio.h"
#include "writefile.h"
#include <errno.h>
@@ -14,7 +13,7 @@ static int false_read(int fd, char *buf, int len) {
return read(fd, buf, len);
}
-int false_write(int fd, char *buf, int len) {
+static int false_write(int fd, char *buf, int len) {
return write(fd, buf, len);
}
|