diff options
author | Leah Neukirchen <leah@vuxu.org> | 2024-01-19 16:00:48 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2024-01-19 16:00:48 +0100 |
commit | f555fa01697bde241a4152af4075cf4ba639e96e (patch) | |
tree | 2af8e4c015c6551a0afb401c3892a825deb6e7e3 | |
parent | 186bf1f894242c91e1877d3bfe11ae0623200450 (diff) | |
download | nitro-f555fa01697bde241a4152af4075cf4ba639e96e.tar.gz nitro-f555fa01697bde241a4152af4075cf4ba639e96e.tar.xz nitro-f555fa01697bde241a4152af4075cf4ba639e96e.zip |
assert: print location when debugging
-rw-r--r-- | nitro.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nitro.c b/nitro.c index 24d5464..1718832 100644 --- a/nitro.c +++ b/nitro.c @@ -26,8 +26,14 @@ #include <termios.h> #include <unistd.h> -// no error message +/* no stdio */ +#ifdef DEBUG +#define assert(x) \ + do { if(!(x)) { prn(2, "%s:%d: %s: error: assertion failed: %s\n", \ + __FILE__, __LINE__, __func__, #x); abort(); } } while(0); +#else #define assert(x) do { if(!(x)) abort(); } while(0); +#endif extern char **environ; char **child_environ; |