aboutsummaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-20 14:24:37 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-20 14:24:37 -0400
commite33aff908b77f43309e61634985c03551ab9cd10 (patch)
tree2a220fb46ce838d78e75fdaea0da092200c1031a /builtins
parente79ce52125875e17ac0b460dfff07a8ecca63676 (diff)
Inline color file
Diffstat (limited to 'builtins')
-rw-r--r--builtins/array.h2
-rw-r--r--builtins/color.c17
-rw-r--r--builtins/color.h11
-rw-r--r--builtins/table.h2
-rw-r--r--builtins/tomo.h1
5 files changed, 4 insertions, 29 deletions
diff --git a/builtins/array.h b/builtins/array.h
index a2c100d5..5ee115ae 100644
--- a/builtins/array.h
+++ b/builtins/array.h
@@ -10,6 +10,8 @@
#include "functions.h"
#include "types.h"
+extern bool USE_COLOR;
+
// Convert negative indices to back-indexed without branching: index0 = index + (index < 0)*(len+1)) - 1
#define Array_get(item_type, arr_expr, index_expr, filename, start, end) *({ \
const array_t arr = arr_expr; int64_t index = (int64_t)(index_expr); \
diff --git a/builtins/color.c b/builtins/color.c
deleted file mode 100644
index d79aa9ef..00000000
--- a/builtins/color.c
+++ /dev/null
@@ -1,17 +0,0 @@
-// Logic for detecting whether console color should be used
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "util.h"
-#include "color.h"
-
-public bool USE_COLOR = true;
-
-public void detect_color(void)
-{
- USE_COLOR = getenv("COLOR") ? strcmp(getenv("COLOR"), "1") == 0 : isatty(STDOUT_FILENO);
-}
-
-// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/color.h b/builtins/color.h
deleted file mode 100644
index 26e912d8..00000000
--- a/builtins/color.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-// Logic for console color usage
-
-#include <stdbool.h>
-
-extern bool USE_COLOR;
-
-void detect_color(void);
-
-// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/table.h b/builtins/table.h
index 0d7af587..f51a8b31 100644
--- a/builtins/table.h
+++ b/builtins/table.h
@@ -10,6 +10,8 @@
#include "datatypes.h"
#include "array.h"
+extern bool USE_COLOR;
+
#define Table(key_t, val_t, key_info, value_info, fb, def, N, ...) ({ \
struct { key_t k; val_t v; } ents[N] = {__VA_ARGS__}; \
table_t table = Table$from_entries((array_t){ \
diff --git a/builtins/tomo.h b/builtins/tomo.h
index 03817e0f..f0455ad1 100644
--- a/builtins/tomo.h
+++ b/builtins/tomo.h
@@ -17,7 +17,6 @@
#include "array.h"
#include "bool.h"
-#include "color.h"
#include "datatypes.h"
#include "functions.h"
#include "halfsiphash.h"