diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-12-26 20:09:17 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-12-26 20:09:17 -0700 |
commit | e7e0cff1960fca598e0ba01be2bb56b65cbb9e2b (patch) | |
tree | 1e2c607ae9980b47917effe4203b4448a1dd4c5f /libmisc/intercept.c | |
parent | d0e9e9c4a178fe396f3ba255bc440a15b107a097 (diff) | |
parent | 1aecc70750ee6ce9c96ebf3e6b4a7fb322ff8ca3 (diff) |
Merge branch 'lukeshu/check-build'
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(); +} |