summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-01-11 13:19:52 +0100
committerRaymaekers Luca <luca@spacehb.net>2025-01-11 13:19:52 +0100
commit449f969b19e1b6a5e402305f2c968d9ed09dedf7 (patch)
treee3c963bd18f4d8a27800449e0ec1def2da61d6ee /bin/extra
parent0467fa38e57589f2bcd5cfeca5643f360800460e (diff)
checkpoint
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/include.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/extra/include.sh b/bin/extra/include.sh
index 1a2c1f4..2b5d536 100755
--- a/bin/extra/include.sh
+++ b/bin/extra/include.sh
@@ -1,2 +1,8 @@
#!/bin/sh
-man -s 2,3p,3 -P cat "$1" | grep -m 1 -o '#include <[^>]\+>'
+
+# Show which C header needs to be included for '$1' by looking at the manpages for that keyword.
+
+{ man -c 2 "$1" ||
+ man -c 3p "$1" ||
+ man -c 3 "$1"; } 2>/dev/null | col -b |
+grep -m 1 -o '#include <[^>]\+>'