main/keepfileopen: new aport (MR 1640)

Sometimes it's just nice to open a file, do nothing with it
and keep it open forever. Yay.
This commit is contained in:
Minecrell 2020-10-07 17:05:54 +02:00 committed by Bart Ribbers
parent 799821e163
commit 36eb719b51
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# Maintainer: Minecrell <minecrell@minecrell.net>
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"

View file

@ -0,0 +1,19 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "Usage: keepfileopen <file>\n");
return EXIT_FAILURE;
}
if (open(argv[1], O_RDONLY) < 0) {
perror("Failed to open file");
return EXIT_FAILURE;
}
pause();
return EXIT_SUCCESS;
}