summary refs log tree commit diff
path: root/home/.local/bin/whinclude
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-02-02 11:17:53 -0500
committerJune McEnroe <june@causal.agency>2022-02-02 11:17:53 -0500
commit6b444bf93fececa65427ca37a599ff7e55eba259 (patch)
treeee95437e1ed93e8de3c3ce1797a3d4eda8a4211b /home/.local/bin/whinclude
parentAdd ASCII diagram of keyboard layout (diff)
downloadsrc-6b444bf93fececa65427ca37a599ff7e55eba259.tar.gz
src-6b444bf93fececa65427ca37a599ff7e55eba259.zip
Add whinclude
Diffstat (limited to '')
-rwxr-xr-xhome/.local/bin/whinclude11
1 files changed, 11 insertions, 0 deletions
diff --git a/home/.local/bin/whinclude b/home/.local/bin/whinclude
new file mode 100755
index 00000000..26445cdc
--- /dev/null
+++ b/home/.local/bin/whinclude
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -eu
+
+echo "#include <${1}>" |
+cc ${CFLAGS:-} -E -x c - |
+sed -En '
+	/^# [0-9]+ "[^<]/{
+		s/.*"([^"]+)".*/\1/p
+		q
+	}
+'