musl-legacy-compat: add error.h header.

This commit is contained in:
Érico Rolim 2020-12-16 17:56:20 -03:00 committed by Érico Nogueira Rolim
parent cced1b6668
commit 9544d86ceb
2 changed files with 34 additions and 3 deletions

View File

@ -0,0 +1,29 @@
#ifndef _ERROR_H_
#define _ERROR_H_
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#warning usage of non-standard #include <error.h> is deprecated
static unsigned int error_message_count = 0;
static inline void error(int status, int errnum, const char* format, ...)
{
va_list ap;
fprintf(stderr, "%s: ", program_invocation_name);
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
if (errnum)
fprintf(stderr, ": %s", strerror(errnum));
fprintf(stderr, "\n");
error_message_count++;
if (status)
exit(status);
}
#endif /* _ERROR_H_ */

View File

@ -1,7 +1,7 @@
# Template file for 'musl-legacy-compat' # Template file for 'musl-legacy-compat'
pkgname=musl-legacy-compat pkgname=musl-legacy-compat
version=0.3 version=0.4
revision=4 revision=1
archs="*-musl" archs="*-musl"
bootstrap=yes bootstrap=yes
short_desc="Legacy compatibility headers for the musl libc" short_desc="Legacy compatibility headers for the musl libc"
@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
homepage="http://www.voidlinux.org" homepage="http://www.voidlinux.org"
do_install() { do_install() {
for f in ${FILESDIR}/*.h; do for f in ${FILESDIR}/{cdefs,queue,tree}.h
do
vinstall ${f} 644 usr/include/sys vinstall ${f} 644 usr/include/sys
done done
vinstall ${FILESDIR}/error.h 644 usr/include
sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause