--- qpkg.orig 2004-06-30 23:38:57.761180680 +0200 +++ qpkg 2004-07-01 00:31:50.216894104 +0200 @@ -50,6 +50,10 @@ -s|--slot) slot=y ;; + + -S|--ssensitive) + sensitive=y + ;; -f|--find-file) ffind=y @@ -205,6 +209,7 @@ ${BL}-nc, --no-color${NO}${T}don't use colors ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twice ] ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO} + ${BL}-S, --sensitive${NO}${T}Be case sensitive ${YL}Notes${NO}: ${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages. @@ -231,6 +236,11 @@ exit fi +#For case sensitive matches +if [ ! "${sensitive}" ]; then + grepopts="-i" +fi + #For the --dups switch only if [ "${dups}" ]; then if [ "${grepmask}" ]; then @@ -301,7 +311,7 @@ # package/CONTENTS containing if [ "${fpat}" ]; then dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -l "${arg}" \ + | xargs grep -l ${grepopts} "${arg}" \ | xargs --no-run-if-empty -n 1 dirname` else # if the user didnt specify a full path assume they @@ -309,7 +319,7 @@ [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}" dirs=`ls /var/db/pkg/${group}/*/CONTENTS \ - | xargs grep -Fl " ${arg}" \ + | xargs grep -Fl ${grepopts} " ${arg}" \ | xargs --no-run-if-empty -n 1 dirname` fi ipak=`( @@ -329,7 +339,7 @@ if [ ${arg} ]; then # avoid ${arg}="db" from pulling in every installed package temp="/var/db/pkg/.*${arg}" - ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep -i ${temp}` + ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${grepopts} ${temp}` fi if [ -n "${mask}" ]; then ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` @@ -342,7 +352,7 @@ upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}` fi if [ ${arg} ]; then - upak=`echo ${upak}|sed -e "s: :\n:g"|grep -i ${arg}` + upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${grepopts} ${arg}` fi if [ -n "${mask}" ]; then upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"` @@ -448,9 +458,9 @@ else if [ "${ffind}" ]; then if [ "${fpat}" ]; then - grep "${arg}" $d/CONTENTS + grep ${grepopts} "${arg}" $d/CONTENTS else - grep " ${arg}\( .*\)*$" $d/CONTENTS + grep " ${grepopts} ${arg}\( .*\)*$" $d/CONTENTS fi else cat $d/CONTENTS @@ -476,9 +486,9 @@ cat ${d}/CONTENTS | if [ "${ffind}" -a ${verb} -lt 2 ];then if [ "${fpat}" ]; then - grep "${arg}" + grep ${grepopts} "${arg}" else - grep " ${arg} " + grep ${grepopts} " ${arg} " fi else cat