diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-12-17 19:18:21 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-12-26 18:28:34 -0700 |
commit | 79284b25994d90149f4a9a5286ec739770db94ea (patch) | |
tree | 1e6918d094ac7bf2df1041cdc901bb4fe62391e3 /libmisc/intercept.c | |
parent | 3756c77e536a293fc735726eac0e5f0c3a8b89da (diff) |
libmisc: Rework how test-intercepts work
Diffstat (limited to 'libmisc/intercept.c')
-rw-r--r-- | libmisc/intercept.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libmisc/intercept.c b/libmisc/intercept.c new file mode 100644 index 0000000..dda8c09 --- /dev/null +++ b/libmisc/intercept.c @@ -0,0 +1,25 @@ +/* libmisc/intercept.c - Interceptable ("weak") functions + * + * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#include <stdarg.h> /* for va_list, va_start(), va_end() */ +#include <stdio.h> /* for vprintf() */ +#include <stdlib.h> /* for abort() */ + +#include <libmisc/_intercept.h> + +[[gnu::weak]] +int __lm_printf(const char *format, ...) { + va_list va; + va_start(va, format); + int ret = vprintf(format, va); + va_end(va); + return ret; +} + +[[gnu::weak]] +void __lm_abort(void) { + abort(); +} |