diff options
author | Linnnus <[email protected]> | 2024-02-01 22:59:38 +0100 |
---|---|---|
committer | Linnnus <[email protected]> | 2024-02-04 09:58:06 +0100 |
commit | d38f82f6462af4e5aad6a2c776f5c00ce5b13c87 (patch) | |
tree | 01a222792dfb10473ae4370b4fc90f3a48e1a499 /src/die.h |
feat: initial commit
Here is a small overview of the state of the project at this first
commit.
I have basic Git Repo -> HTML working, and a plan for how setting up an
actual server would work (mainly, NGINX + a git hook to rebuild).
The main thing I'm working on right now is parsing WikiCreole, though I
am starting to wonder if this is the right langauge. WikiCreole is
pretty irregular and has a lot of edge cases (e.g. around emphasis).
Diffstat (limited to 'src/die.h')
-rw-r--r-- | src/die.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/die.h b/src/die.h new file mode 100644 index 0000000..891d10f --- /dev/null +++ b/src/die.h @@ -0,0 +1,31 @@ +#ifndef DIE_H +#define DIE_H + +// +// This module defines various utilities for ending program execution +// abnormally. +// + +#include <stdnoreturn.h> // noreturn + +#ifdef __GNUC__ +#define _DIE_PRINTF_ATTR __attribute__((format(printf, 1, 2))) +#else +#define _DIE_PRINTF_ATTR +#endif + +// Exit the program, displaying no extra information. +_DIE_PRINTF_ATTR +noreturn void die(const char *msg, ...); + +// Exit the program, displaying the last libgit error. +// It is an error to invoke this if there has been no libgit error. +_DIE_PRINTF_ATTR +noreturn void die_git(const char *msg, ...); + +// Exit the program, displaying errno message. +// It is NOT an error to invoke this if errno is 0, just pretty weird. +_DIE_PRINTF_ATTR +noreturn void die_errno(const char *msg, ...); + +#endif |