diff --git a/main/keepfileopen/APKBUILD b/main/keepfileopen/APKBUILD new file mode 100644 index 000000000..bea577761 --- /dev/null +++ b/main/keepfileopen/APKBUILD @@ -0,0 +1,20 @@ +# Maintainer: Minecrell +pkgname=keepfileopen +pkgver=1 +pkgrel=0 +pkgdesc="Small utility to keep a file open. Yes, that's all it does :)" +url="https://postmarketos.org" +arch="all" +license="MIT" +source="keepfileopen.c" +options="!check" # No tests. Not much can go wrong here... + +build() { + gcc -o keepfileopen keepfileopen.c +} + +package() { + install -Dm755 "$srcdir"/keepfileopen "$pkgdir"/usr/bin/keepfileopen +} + +sha512sums="ac9ed0f6ec07ef813ce3a539919acbe8a5a70d5765a5fff267674a3fb239cdb1dba58a14d72a64f990bdcb87c6476d30ef7add21f152df7cb48e36932ef14dbb keepfileopen.c" diff --git a/main/keepfileopen/keepfileopen.c b/main/keepfileopen/keepfileopen.c new file mode 100644 index 000000000..6ad90e86d --- /dev/null +++ b/main/keepfileopen/keepfileopen.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 2) { + fprintf(stderr, "Usage: keepfileopen \n"); + return EXIT_FAILURE; + } + + if (open(argv[1], O_RDONLY) < 0) { + perror("Failed to open file"); + return EXIT_FAILURE; + } + + pause(); + return EXIT_SUCCESS; +}