#! /bin/sh # from linux/Documentation/kernel-doc-nano-HOWTO.txt # uses linux/scripts/kernel-doc or a copy of it (in $PATH). # using "LANG=C or LC_ALL=C kdoc_function " can be useful. # Can use "KERNDOC= kdoc_function " to vary # which kernel-doc script is used. verbose= debug= if [ "$KERNDOC" = "" ]; then KERNDOC=kernel-doc fi # careful: must enter -v before -x: if [ "$1" = "-v" ]; then verbose="-v" shift fi if [ "$1" = "-x" ]; then debug="-x" shift fi file="$1" fn="$2" # fmt can be "text|man|html|docbook|xml" (default is "text") # docbook produces xml fmt="$3" if [ x$3 = x ]; then fmt="text" fi if [ "$2" = "" ]; then echo "usage: kdoc_function filename funcname [text|man|html|docbook|xml]" exit 1 fi case $fmt in man) $KERNDOC $verbose $debug -man -function $fn $file | nroff -man | less ;; html) $KERNDOC $verbose $debug -html -function $fn $file >kerneldoc.html echo "see kerneldoc.html" ;; docbook|xml) $KERNDOC $verbose $debug -docbook -function $fn $file >kerneldoc.xml echo "see kerneldoc.xml" ;; *) $KERNDOC $verbose $debug -text -function $fn $file | less ;; esac