initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

38
enca/PKGBUILD Normal file
View File

@@ -0,0 +1,38 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=enca
pkgver=1.19
pkgrel=1
pkgdesc='Charset analyser and converter'
arch=('i686' 'x86_64')
url='https://cihar.com/software/enca/'
license=('GPL-2')
depends=('recode')
options=('!docs')
source=("https://dl.cihar.com/${pkgname}/${pkgname}-${pkgver}.tar.xz"
"enca-bad-file-descriptor.patch")
sha512sums=('6678639992685180457bbef7b0da6e475071ec6935dfd672188fc242ef80b906e75eff9a206e07989893d0ef4ae5eb500f1d0bbd6b4d58146c94bb143b5fb296'
'e8b0aab0de2dad40255a539eb12d716b78232e7acd42834b856a763cc6653d49af04922724a844d703040d83581a3802b7f2f43c8c514cc7f133fb543cdbf82e')
prepare() {
cd $pkgname-$pkgver
patch -p1 -i ../enca-bad-file-descriptor.patch
}
build() {
cd ${pkgname}-${pkgver}
./configure --prefix=/usr \
--libexecdir=/usr/lib \
--mandir=/usr/share/man \
--with-librecode=/usr \
--enable-external
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/$pkgname"
}

View File

@@ -0,0 +1,35 @@
--- a/src/convert_recode.c
+++ b/src/convert_recode.c
@@ -101,7 +101,8 @@ convert_recode(File *file,
return ERR_IOFAIL;
file->buffer->pos = 0;
- if ((tempfile = file_temporary(file->buffer, 1)) == NULL
+ /* We do not unlink tempfile, because we want to reopen it later */
+ if ((tempfile = file_temporary(file->buffer, 0)) == NULL
|| file_seek(file, 0, SEEK_SET) != 0) {
file_free(tempfile);
return ERR_IOFAIL;
@@ -112,9 +113,20 @@ convert_recode(File *file,
task->fail_level = enca_recode_fail_level;
task->abort_level = RECODE_SYSTEM_ERROR;
task->input.name = NULL;
- task->input.file = file->stream;
task->output.name = NULL;
- task->output.file = tempfile->stream;
+ /* recode_perform_task closes given streams, so we need to duplicate them */
+ task->input.file = fopen(file->name, "rb");
+ if (task->input.file == NULL) {
+ fprintf(stderr, "failed to reopen `%s'\n", file->name);
+ file_free(tempfile);
+ return ERR_IOFAIL;
+ }
+ task->output.file = fopen(tempfile->name, "wb");
+ if (task->input.file == NULL) {
+ fprintf(stderr, "failed to reopen `%s'\n", tempfile->name);
+ file_free(tempfile);
+ return ERR_IOFAIL;
+ }
/* Now run conversion original -> temporary file. */
success = recode_perform_task(task);