summaryrefslogtreecommitdiff
path: root/bin/extra/include.sh
blob: 2b5d5364193333a46990c230af87b42f3b945a84 (plain)
1
2
3
4
5
6
7
8
#!/bin/sh

# 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 <[^>]\+>'