1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

- Fixed some non-portable shell constructs used in installed scripts

(Johnny C. Lam <lamj@stat.cmu.edu>)
- Fixed crash with long titles in the window list menu
  (Alban Hertroys <dalroi@wit401310.student.utwente.nl>)
This commit is contained in:
dan
2001-07-21 20:42:04 +00:00
parent d4097e11c9
commit c687b42960
4 changed files with 39 additions and 32 deletions

View File

@@ -258,10 +258,11 @@ UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action)
if (entry->text) if (entry->text)
wfree(entry->text); wfree(entry->text);
if (wwin->frame->title) if (wwin->frame->title)
sprintf(title, "%s", wwin->frame->title); snprintf(title, MAX_MENU_TEXT_LENGTH, "%s",
else wwin->frame->title);
sprintf(title, "%s", DEF_WINDOW_TITLE); else
sprintf(title, "%s", DEF_WINDOW_TITLE);
t = ShrinkString(scr->menu_entry_font, title, MAX_WINDOWLIST_WIDTH); t = ShrinkString(scr->menu_entry_font, title, MAX_WINDOWLIST_WIDTH);
entry->text = t; entry->text = t;

View File

@@ -293,7 +293,7 @@ if test -z "#LITE#" ; then
echo "menu that will be used by default is the property list one. Read" echo "menu that will be used by default is the property list one. Read"
echo " $GSDIR/Library/WindowMaker/README" echo " $GSDIR/Library/WindowMaker/README"
echo "for information on how to change it." echo "for information on how to change it."
if [ "${inst_menu%.*}" == "menu" ]; then if [ "${inst_menu%.*}" = "menu" ]; then
echo "However, since you have locale set to $LOCALE and plmenu for such locale" echo "However, since you have locale set to $LOCALE and plmenu for such locale"
echo "was not found, your WMRootMenu contains path to text formated menu:" echo "was not found, your WMRootMenu contains path to text formated menu:"
echo " $GSDIR/Library/WindowMaker/$inst_menu" echo " $GSDIR/Library/WindowMaker/$inst_menu"

View File

@@ -9,7 +9,7 @@
PROGRAM=`basename $0` PROGRAM=`basename $0`
VERSION="0.1" VERSION="0.1"
if [ "x$GNUSTEP_USER_ROOT" == "x" ]; then if [ "x$GNUSTEP_USER_ROOT" = "x" ]; then
GSDIR="$HOME/GNUstep" GSDIR="$HOME/GNUstep"
else else
GSDIR="$GNUSTEP_USER_ROOT" GSDIR="$GNUSTEP_USER_ROOT"
@@ -33,7 +33,7 @@ help_msg() {
exit 0 exit 0
} }
if (( $# == 0 )); then if [ $# -eq 0 ]; then
help_msg help_msg
fi fi
@@ -52,7 +52,7 @@ for i in $*; do
fi;; fi;;
esac esac
done done
if [ "$new_locale" == "default" ]; then if [ "$new_locale" = "default" ]; then
new_locale="" new_locale=""
fi fi
@@ -75,7 +75,7 @@ fi
echo -n "Setting Window Maker root menu... " echo -n "Setting Window Maker root menu... "
if [ -z "$new_locale" ] || [ "$new_locale" == "en" ]; then if [ -z "$new_locale" ] || [ "$new_locale" = "en" ]; then
menu_list="plmenu menu" menu_list="plmenu menu"
else else
menu_list="plmenu.$new_locale menu.$new_locale plmenu menu" menu_list="plmenu.$new_locale menu.$new_locale plmenu menu"
@@ -88,7 +88,12 @@ for new_menu in $menu_list; do
else else
echo "fail (copying default)" echo "fail (copying default)"
fi fi
if [ "${new_menu:0:4}" == "menu" ]; then # plain new_menu_tmp=$new_menu
# Set new_menu_tmp to first 4 letters of $new_menu.
while [ ${#new_menu_tmp} -gt 4 ]; do
new_menu_tmp=${new_menu_tmp%?}
done
if [ "${new_menu_tmp}" = "menu" ]; then # plain
echo "\"$wm_dir/$new_menu\"" >"$GSDIR/Defaults/WMRootMenu" echo "\"$wm_dir/$new_menu\"" >"$GSDIR/Defaults/WMRootMenu"
else # proplist else # proplist
cp -f "$wm_dir/$new_menu" "$GSDIR/Defaults/WMRootMenu" cp -f "$wm_dir/$new_menu" "$GSDIR/Defaults/WMRootMenu"
@@ -104,7 +109,7 @@ fi
echo -n "Setting Window Maker fonts... " echo -n "Setting Window Maker fonts... "
if [ -z "$new_locale" ] || [ "$new_locale" == "en" ]; then if [ -z "$new_locale" ] || [ "$new_locale" = "en" ]; then
args="default $nodef" args="default $nodef"
else else
args="--locale=$new_locale $nodef" args="--locale=$new_locale $nodef"

View File

@@ -115,7 +115,7 @@ DomainWindowMaker="WindowTitleFont MenuTitleFont MenuTextFont IconTitleFont Clip
for i in $DomainNames; do for i in $DomainNames; do
tmp="Domain$i" tmp="Domain$i"
AllKeys="$AllKeys ${!tmp}" eval AllKeys="\"$AllKeys \$${tmp}\""
done done
# #
@@ -212,8 +212,9 @@ if [ -z "$family" ]; then
family="default" family="default"
else else
for i in $all_codings; do for i in $all_codings; do
for j in ${!i}; do eval _i="\$$i"
if [ "$j" == "${locale%_*}" ]; then for j in ${_i}; do
if [ "$j" = "${locale%_*}" ]; then
family="$i" family="$i"
break 2 break 2
fi fi
@@ -227,7 +228,7 @@ fi
# #
is_supported="" is_supported=""
for i in $Supported; do for i in $Supported; do
if test "$family" == "$i"; then if test "$family" = "$i"; then
is_supported="YES" is_supported="YES"
break break
fi fi
@@ -245,7 +246,7 @@ fi
# #
is_nodef_unable="" is_nodef_unable=""
for i in $NodefUnable; do for i in $NodefUnable; do
if test "$family" == "$i"; then if test "$family" = "$i"; then
if test -n "$nodef"; then # --nodef with one from $NodefUnable if test -n "$nodef"; then # --nodef with one from $NodefUnable
echo -e "\n"\ echo -e "\n"\
"Sorry, --nodef argument is not allowed for these font codings:\n"\ "Sorry, --nodef argument is not allowed for these font codings:\n"\
@@ -268,22 +269,22 @@ if test -z "$nodef"; then
for i in $AllKeys; do for i in $AllKeys; do
if test -n "$is_nodef_unable"; then # japanese,... defaults if test -n "$is_nodef_unable"; then # japanese,... defaults
tmp="$family$i" tmp="$family$i"
eval $i=${!tmp} eval $i="\$${tmp}"
else # rest, load defaults else # rest, load defaults
not_font="" not_font=""
for j in $NotFont; do for j in $NotFont; do
if test "$i" == "$j"; then if test "$i" = "$j"; then
not_font="YES" not_font="YES"
break break
fi fi
done done
if test -n "$not_font"; then # don't append coding (not default!) if test -n "$not_font"; then # don't append coding (not default!)
tmp="${family}$i" tmp="${family}$i"
eval $i="${!tmp}" eval $i="\$${tmp}"
else # append coding else # append coding
tmp="Default$i" tmp="Default$i"
tmp1="${family}Coding" tmp1="${family}Coding"
eval $i="${!tmp}${!tmp1}" eval $i="\$${tmp}\$${tmp1}"
fi fi
fi fi
done done
@@ -305,36 +306,36 @@ for i in $DomainNames; do
echo echo
echo "Setting up $i domain file..." echo "Setting up $i domain file..."
tmp="Domain$i" tmp="Domain$i"
for j in ${!tmp}; do eval _tmp="\$${tmp}"
for j in ${_tmp}; do
if test -n "$nodef"; then # --nodef, change coding only if test -n "$nodef"; then # --nodef, change coding only
not_font="" not_font=""
for k in $NotFont; do for k in $NotFont; do
if test "$k" == "$j"; then if test "$k" = "$j"; then
not_font="YES" not_font="YES"
break; break;
fi fi
done done
if test -n "$not_font"; then # don't append coding if test -n "$not_font"; then # don't append coding
tmp1="${family}$j" tmp1="${family}$j"
eval $j=${!tmp1} eval $j="\$${tmp1}"
else # append coding else # append coding
#TODO:make this funny sed script a lot smarter to let us make changes in font #TODO:make this funny sed script a lot smarter to let us make changes in font
# lists, etc... (then we can enable --nodef for NodefUnable codings) # lists, etc... (then we can enable --nodef for NodefUnable codings)
#TODO:better (or at least any) check, whether wmaker is installed... #TODO:better (or at least any) check, whether wmaker is installed...
tmp1="${family}Coding" tmp1="${family}Coding"
eval $j=$($WDREAD $i $j | sed -e "s/\(^-.*-\).*-.*$/\1${!tmp1}/g") eval _tmp1="\$${tmp1}"
if test -z "${!j}"; then # failed, load default eval $j=$($WDREAD $i $j | sed -e "s/\(^-.*-\).*-.*$/\1${_tmp1}/g")
eval _j="\$$j"
if test -z "${_j}"; then # failed, load default
tmp2="Default$j" tmp2="Default$j"
eval $j=${!tmp2} eval $j="\$${tmp2}"
fi fi
fi fi
fi fi
tmp1="$j=\"${!j}\"" # cosmetic length workaround eval _j="\$$j"
if (( ${#tmp1} > 80 )); then echo $j="${_j}"
tmp1=$(echo "${tmp1:0:76}...\"") $WDWRITE $i $j \"${_j}\"
fi
echo "$tmp1"
$WDWRITE $i $j \"${!j}\"
done done
done done
echo echo