summaryrefslogtreecommitdiff
path: root/startx.cpp
diff options
context:
space:
mode:
authorHarold L Hunt II <huntharo@msu.edu>2004-03-10 20:50:40 +0000
committerHarold L Hunt II <huntharo@msu.edu>2004-03-10 20:50:40 +0000
commit1f8f79e679d951cd9f4a5258b318ad299c4e2a17 (patch)
tree54a018e8f1bb5d58bb2516771323d74bd3a7d97e /startx.cpp
parent76fe43f3e1a0ecda6998f4e96d707e39a19f566e (diff)
Fix some of the problems with paths that have spaces in the startx script.
(Igor Pechtchanski)
Diffstat (limited to 'startx.cpp')
-rw-r--r--startx.cpp47
1 files changed, 26 insertions, 21 deletions
diff --git a/startx.cpp b/startx.cpp
index 6d9ef3a..aed51b2 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -48,8 +48,9 @@ fi
scoclientrc=$HOME/.startxrc
#endif
-userclientrc=$HOME/.xinitrc
-userserverrc=$HOME/.xserverrc
+userclientrc="$HOME/.xinitrc"
+userserverrc="$HOME/.xserverrc"
+/* Note: XINITDIR and BINDIR should be space-free */
sysclientrc=XINITDIR/xinitrc
sysserverrc=XINITDIR/xserverrc
defaultclient=BINDIR/xterm
@@ -64,19 +65,19 @@ if [ -f $scoclientrc ]; then
defaultclientargs=$scoclientrc
else
#endif
-if [ -f $userclientrc ]; then
- defaultclientargs=$userclientrc
-elif [ -f $sysclientrc ]; then
- defaultclientargs=$sysclientrc
+if [ -f "$userclientrc" ]; then
+ defaultclientargs="\"$userclientrc\""
+elif [ -f "$sysclientrc" ]; then
+ defaultclientargs="\"$sysclientrc\""
fi
#ifdef SCO
fi
#endif
-if [ -f $userserverrc ]; then
- defaultserverargs=$userserverrc
-elif [ -f $sysserverrc ]; then
- defaultserverargs=$sysserverrc
+if [ -f "$userserverrc" ]; then
+ defaultserverargs="\"$userserverrc\""
+elif [ -f "$sysserverrc" ]; then
+ defaultserverargs="\"$sysserverrc\""
fi
whoseargs="client"
@@ -86,15 +87,15 @@ while [ x"$1" != x ]; do
/''*|\./''*)
if [ "$whoseargs" = "client" ]; then
if [ x"$clientargs" = x ]; then
- client="$1"
+ client="\"$1\""
else
- clientargs="$clientargs $1"
+ clientargs="$clientargs \"$1\""
fi
else
if [ x"$serverargs" = x ]; then
- server="$1"
+ server="\"$1\""
else
- serverargs="$serverargs $1"
+ serverargs="$serverargs \"$1\""
fi
fi
;;
@@ -103,14 +104,14 @@ while [ x"$1" != x ]; do
;;
*)
if [ "$whoseargs" = "client" ]; then
- clientargs="$clientargs $1"
+ clientargs="$clientargs \"$1\""
else
XCOMM display must be the FIRST server argument
if [ x"$serverargs" = x ] && @@
expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
- display="$1"
+ display="\"$1\""
else
- serverargs="$serverargs $1"
+ serverargs="$serverargs \"$1\""
fi
fi
;;
@@ -124,7 +125,7 @@ if [ x"$client" = x ]; then
if [ x"$clientargs" = x ]; then
client="$defaultclientargs"
else
- client=$defaultclient
+ client="$defaultclient"
fi
fi
@@ -134,12 +135,12 @@ if [ x"$server" = x ]; then
if [ x"$serverargs" = x -a x"$display" = x ]; then
server="$defaultserverargs"
else
- server=$defaultserver
+ server="$defaultserver"
fi
fi
if [ x"$XAUTHORITY" = x ]; then
- XAUTHORITY=$HOME/.Xauthority
+ XAUTHORITY="$HOME/.Xauthority"
export XAUTHORITY
fi
@@ -172,9 +173,13 @@ EOF
done
#endif
-xinit $client $clientargs -- $server $display $serverargs
+XCOMM correctly process quotes, etc
+eval "set -- $client $clientargs -- $server $display $serverargs"
+
+xinit "$@"
if [ x"$removelist" != x ]; then
+ XCOMM Note: this is still not space-friendly!
xauth remove $removelist
fi