Skip to content

Instantly share code, notes, and snippets.

@chendotjs
Last active September 17, 2023 07:33
Show Gist options
  • Save chendotjs/9bec5dfba8e328e905c605480fb5958e to your computer and use it in GitHub Desktop.
Save chendotjs/9bec5dfba8e328e905c605480fb5958e to your computer and use it in GitHub Desktop.
#/bin/bash
if [[ $# -lt 1 ]]; then
ctags -R -x --kinds-C=pd /usr/include/bpf/
else
funcline=$(ctags -R -x --kinds-C=pd /usr/include/bpf/ | grep $1)
echo $funcline | awk '{printf("%s %s\n", $4, $3)}' | if read -r src linenum; then
ag -B 1 -A 5 "$1\(" $src
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment