From 6c284b9c7cb0d711981c2e0ee6fe42ec98c9223c Mon Sep 17 00:00:00 2001 From: mathias Date: Sat, 18 Jun 2005 17:21:13 +0000 Subject: fbgm used non-portable grep - option (-m) which is now replaced by grep | head -n 1 --- ChangeLog | 2 ++ util/fluxbox-generate_menu.in | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34907bb..ec6d673 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.14: *05/06/18: + * Fixes #1206821, unportable usage of grep in fbgm (thanx Dung) + util/fluxbox-generate_menu.in * Fixes #1116965, shadwd windows on restart (Mathias) Window.cc * little Fix for font effects (Mathias) diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in index eafb793..141cafb 100755 --- a/util/fluxbox-generate_menu.in +++ b/util/fluxbox-generate_menu.in @@ -38,6 +38,7 @@ # - don't use id -u or $UID, use whoami # - getopts won't work on all platforms, but the config-file can # compensate for that. +# - OpenBSD and Solaris grep do not have the -m option # - various software like grep/sed/perl may be not present or not # the version you have. for example grep '\W' only works on gnu-grep. # Keep this in mind, use bare basic defaults. @@ -271,7 +272,7 @@ doSearch(){ # $dnlamVERBOSE "# Searching for icon $temp_icon for $execname" >> $ICONMAPPING # check in $ICONMAPPING before searching directories - entry_icon=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` + entry_icon=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'` if [ -n "$entry_icon" ]; then entry_icon=`replaceWithinString "$entry_icon" "<"` entry_icon=`replaceWithinString "$entry_icon" ">"` @@ -365,16 +366,16 @@ createIconMapping(){ # >> $ICONMAPPING find "$DIR" -type f -name "*.desktop" | while read DESKTOP_FILE; do # echo $DESKTOP_FILE; - #entry_name=`grep -m 1 '^[ ]*Name=' $DESKTOP_FILE` + #entry_name=`grep '^[ ]*Name=' $DESKTOP_FILE | head -n 1` #entry_name=${entry_name##*=} - entry_exec=`grep -m 1 '^[ ]*Exec=' "$DESKTOP_FILE"` + entry_exec=`grep '^[ ]*Exec=' "$DESKTOP_FILE" | head -n 1` entry_exec=${entry_exec##*=} entry_exec=`replaceWithinString "$entry_exec" "\""` if [ -z "$entry_exec" ]; then entry_exec=${DESKTOP_FILE%%.desktop*} fi - entry_icon=`grep -m 1 '^[ ]*Icon=' "$DESKTOP_FILE"` + entry_icon=`grep '^[ ]*Icon=' "$DESKTOP_FILE" | head -n 1` entry_icon=${entry_icon##*=} # $dnlamVERBOSE echo "--- $entry_exec $entry_icon" >&2 @@ -407,11 +408,11 @@ lookupIcon() { execname=`removePath "$execname"` #echo "grepping ${execname}" - iconString=`grep -m 1 "^\"${execname}\"" $ICONMAPPING | grep -o '<.*>'` + iconString=`grep "^\"${execname}\"" $ICONMAPPING | head -n 1 | grep -o '<.*>'` # $dnlamVERBOSE "lookupIcon $execname, $iconString" >&2 if [ -z "$iconString" ] ; then - iconString=`grep -m 1 "^\"${execname%% *}" $ICONMAPPING | grep -o '<.*>'` + iconString=`grep "^\"${execname%% *}" $ICONMAPPING | head -n 1 | grep -o '<.*>'` fi if [ -z "$iconString" ] && [ -z "$PARSING_DESKTOP" ] ; then -- cgit v0.11.2