aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils.c9
-rw-r--r--utils.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/utils.c b/utils.c
new file mode 100644
index 0000000..6a42a7c
--- /dev/null
+++ b/utils.c
@@ -0,0 +1,9 @@
+#include "utils.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+int is_debug() {
+ char* env = getenv("DEBUG");
+ return env && (strcmp(env, "true") == 0 || strcmp(env, "1") == 0);
+}
diff --git a/utils.h b/utils.h
new file mode 100644
index 0000000..b274877
--- /dev/null
+++ b/utils.h
@@ -0,0 +1,6 @@
+#ifndef SF_UTILS_H
+#define SF_UTILS_H
+
+int is_debug();
+
+#endif /* SF_UTILS_H */