diff options
author | phk <phk@FreeBSD.org> | 2003-01-03 17:21:39 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-01-03 17:21:39 +0000 |
commit | 88734795406f0dbfae9859a0eab3f5f879515d09 (patch) | |
tree | 8feaa467578282fdd9269f66671671b311090d3b /tools | |
parent | d6f399392ed34649b9bc2255c6744e3527ff9f71 (diff) | |
download | FreeBSD-src-88734795406f0dbfae9859a0eab3f5f879515d09.zip FreeBSD-src-88734795406f0dbfae9859a0eab3f5f879515d09.tar.gz |
Add various command line options, most notably sort order.
Submitted by: "Matthew Emmerton" <matt@gsicomp.on.ca>
Sat on for far too long: phk
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/kernxref/kernxref.sh | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/tools/tools/kernxref/kernxref.sh b/tools/tools/kernxref/kernxref.sh index 1c0581a..439f385 100644 --- a/tools/tools/kernxref/kernxref.sh +++ b/tools/tools/kernxref/kernxref.sh @@ -7,22 +7,63 @@ # this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp # ---------------------------------------------------------------------------- # +# Sort options by "Matthew Emmerton" <matt@gsicomp.on.ca> +# # $FreeBSD$ # -# This shellscript will make a cross reference of the symbols of the LINT -# kernel. +# This shell script will make a cross reference of the symbols of a kernel. +# COMPILEDIR=/sys/`uname -m`/compile KERNELNAME=LINT +SORTORDER=-k1 -if [ "x$1" != "x" ]; then - KERNELNAME=$1; -fi - -if [ ! -d ${COMPILEDIR}/${KERNELNAME} ]; then - echo "Kernel $KERNELNAME does not exist in ${COMPILEDIR}!"; - exit 1; +args=`getopt h?k:s: $*`; +if [ $? != 0 ] +then + args="-h"; fi +set -- $args; +for i +do + case "$i" + in + -h|-\?) + echo "Usage: $0 [ -k <kernelname> ] [ -s [ 'symbol' | 'filename' ] ]"; + exit 0; + ;; + -k) + KERNELNAME=$2 + if [ -d ${COMPILEDIR}/${KERNELNAME} ]; + then + shift; shift; + continue; + fi + echo "Kernel '$KERNELNAME' does not exist in ${COMPILEDIR}!"; + exit 1; + ;; + -s) + if [ "x$2" = "xsymbol" ] + then + SORTORDER=-k1 + shift; shift; + continue; + fi + if [ "x$2" = "xfilename" ] + then + SORTORDER=-k2 + shift; shift; + continue; + fi + echo "Invalid selection for -s: $2"; + exit 1; + ;; + --) + shift; + break; + ;; + esac +done cd ${COMPILEDIR}/${KERNELNAME} @@ -73,7 +114,7 @@ END { printf "%s {%s} %s\n",i,def[i],ref[i] } } -' | sort | awk ' +' | sort $SORTORDER | awk ' { if ($2 == "{S}") $2 = "<Linker set>" |