PATCH: wineshellink

Marcus Meissner marcus at jet.franken.de
Wed Dec 12 11:15:30 CST 2001


Hi,

This patch fixes some places, where whitespace might make trouble in 
wineshelllink. I am not a shellguru, so some of them might be superflous.

The ones on mkdir lines most likely are not.

It also fixes a 99% CPU usage problem, related to the use of `cmd` within
cat <<EOF constructs (probably a bash1 only problem).


Ciao, Marcus

Changelog:
	Fixed some places where whitespace was not handled correctly.
	Do not use `cmd`s within cat <<EOF since bash1 sometimes gets
	confused by it.
	

Index: wineshelllink
===================================================================
RCS file: /home/wine/wine/tools/wineshelllink,v
retrieving revision 1.6
diff -u -r1.6 wineshelllink
--- wineshelllink	2001/11/20 18:53:33	1.6
+++ wineshelllink	2001/12/12 15:34:43
@@ -42,12 +42,12 @@
   case "$1" in
     (--desktop) mode="desktop"; shift 1 ;;
     (--menu)    mode="menu"; shift 1 ;;
-    (--path)    path=$2; shift 2 ;;
-    (--link)    link=$2; shift 2 ;;
-    (--args)    args=$2; shift 2 ;;
-    (--icon)    icon=$2; shift 2 ;;
-    (--descr)   descr=$2; shift 2 ;;
-    (--workdir) workdir=$2; shift 2 ;;
+    (--path)    path="$2"; shift 2 ;;
+    (--link)    link="$2"; shift 2 ;;
+    (--args)    args="$2"; shift 2 ;;
+    (--icon)    icon="$2"; shift 2 ;;
+    (--descr)   descr="$2"; shift 2 ;;
+    (--workdir) workdir="$2"; shift 2 ;;
     (*) usage ;;
   esac
 done
@@ -64,10 +64,11 @@
 
 kde_entry()
 {
+    xname=`basename "$link"`
     cat <<EOF
 # KDE Config File
 [KDE Desktop Entry]
-Name=`basename "$link"`
+Name=$xname
 Exec=wine "$path" $args
 Type=Application
 Comment=$descr
@@ -78,9 +79,10 @@
 
 gnome_entry()
 {
+    xname=`basename "$link"`
     cat <<EOF
 [Desktop Entry]
-Name=`basename "$link"`
+Name=$xname
 Exec=wine "$path" $args
 Type=Application
 Comment=$descr
@@ -100,7 +102,7 @@
 # copy the icon file to a specified dir and set xpmicon to the resulting path
 copy_icon()
 {
-  dir=$1
+  dir="$1"
   mkdir -p "$dir"
   mkdir -p "$dir/""`dirname "$link"`" || true
   if [ -f "$icon" ]
@@ -121,7 +123,7 @@
   dir="$HOME/.menu/icons"
   if [ -f "$icon" ]
   then
-    mkdir -p $dir
+    mkdir -p "$dir"
     cp "$icon" "$dir/$iconname"
     xpmicon="$dir/$iconname"
   else




More information about the wine-patches mailing list