#!/bin/sh verbose=-q while getopts vc:f:m:p arg; do case $arg in c ) check_file=$OPTARG ;; f ) kernel_config=$OPTARG ;; m ) mode=$OPTARG ;; v ) verbose=;; p ) picky=1;; *) : ;; esac done for var in $(cat "$check_file") ;do case $var in \#*) : ;; *) case $mode in defined) if ! grep $verbose "$var" "$kernel_config" ; then if grep $verbose $(echo "$var"|sed 's/y/m/g') "$kernel_config" ; then [ $picky ] && echo "$var not y" >&2 else echo "$var not defined" >&2 fi fi ;; kconfig) if ! grep $verbose "$var" "$kernel_config" ; then if grep $verbose $(echo "$var"|sed 's/y/m/g') "$kernel_config" ; then [ $picky ] && echo "CONFIG_$var" else echo "CONFIG_$var" fi fi ;; notfound) if ! grep -q $(echo "$var" |sed -e 's/=.*//') "$kernel_config" ; then echo "$var not found" >&2 fi ;; *) echo "error undefined mode" >&2 exit 1 ;; esac ;; esac done