| 1 | #!/bin/sh |
| 2 | |
| 3 | # a wrapper to kernel-doc from the kernel source tree |
| 4 | # |
| 5 | # Copyright (C) 2009 by Xorcom <[email protected]> |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | |
| 21 | # For 'man' version: build_tools/kernel-doc -f man | man -l - |
| 22 | |
| 23 | files="drivers/dahdi/dahdi-base.c" |
| 24 | format="html" |
| 25 | kernel="/lib/modules/`uname -r`/build" |
| 26 | |
| 27 | usage() { |
| 28 | me=`basename $0` |
| 29 | cat <<EOF |
| 30 | $me: wrapper around the kernel's kernel-doc script |
| 31 | Extracts kernel-doc from $files . |
| 32 | |
| 33 | $me [options] |
| 34 | |
| 35 | Options: |
| 36 | -f --format: Alternative output format (man, text, docbook. Default: html) |
| 37 | -k --kernel: kernel source tree. Default: $kernel . |
| 38 | EOF |
| 39 | } |
| 40 | |
| 41 | options=`getopt -o f:hk: --long format:,help,kernel: -- "$@"` |
| 42 | if [ $? != 0 ] ; then echo >&2 "Terminating..." ; exit 1 ; fi |
| 43 | |
| 44 | eval set -- "$options" |
| 45 | |
| 46 | while true ; do |
| 47 | case "$1" in |
| 48 | -f|--format) format="$2"; shift ;; |
| 49 | -h|--help) usage; exit 0;; |
| 50 | -k|--kernel) kernel="$2"; shift ;; |
| 51 | --) shift ; break ;; |
| 52 | esac |
| 53 | shift; |
| 54 | done |
| 55 | |
| 56 | if [ "$*" != '' ]; then |
| 57 | files="$*" #FIXME: spaces |
| 58 | fi |
| 59 | |
| 60 | script="$kernel/scripts/kernel-doc" |
| 61 | $script -$format $files |
| 62 | |
| 63 |