[GRASS-SVN] r60084 - grass-addons/grass6/display/d.zoom.keys

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 4 16:31:09 PDT 2014


Author: hamish
Date: 2014-05-04 16:31:09 -0700 (Sun, 04 May 2014)
New Revision: 60084

Modified:
   grass-addons/grass6/display/d.zoom.keys/d.zoom.keys
Log:
quoting fixes; only read region, don't alter WIND file (#2230)

Modified: grass-addons/grass6/display/d.zoom.keys/d.zoom.keys
===================================================================
--- grass-addons/grass6/display/d.zoom.keys/d.zoom.keys	2014-05-04 23:18:30 UTC (rev 60083)
+++ grass-addons/grass6/display/d.zoom.keys/d.zoom.keys	2014-05-04 23:31:09 UTC (rev 60084)
@@ -65,12 +65,14 @@
 
 ## set environment so that awk works properly in all languages ##
 unset LC_ALL
-export LC_NUMERIC=C
+LC_NUMERIC=C
+export LC_NUMERIC
 
 
 ############################################################
 cleanup()
 { 
+    # FIXME: quoted "*" is literal
     rm -f "$TMP*"
     if [ "$GIS_FLAG_T" -eq 1 ]; then
 	stty "$tty_save"
@@ -129,27 +131,27 @@
     exit 1
 fi
 
-if [ "$GIS_FLAG_X" -eq 0 ] && [ "$GIS_FLAG_T" -eq 0 ]; then
+if [ "$GIS_FLAG_X" -eq 0 ] && [ "$GIS_FLAG_T" -eq 0 ] ; then
     g.message -e "Please select method of navigation: flag \"-t\" from terminal or flag \"-x\" from X-monitor"
     exit 1
 fi 
 
-if [ "$GIS_FLAG_X" -eq 1 ] && [ "$GIS_FLAG_T" -eq 1 ]; then
+if [ "$GIS_FLAG_X" -eq 1 ] && [ "$GIS_FLAG_T" -eq 1 ] ; then
     g.message -e "Please select one method of navigation: flag \"-t\" from terminal or flag \"-x\" from X-monitor"
     exit 1
 fi 
 
 MAGN_NEGAT=$(echo "$GIS_OPT_MAGN" | grep "-")
-if [ "$MAGN_NEGAT" ]; then
-    g.message -e "Magnification should be a positive number: default is "1" (1/10 of current region). "magn" > 1 gives positive magnification, "magn" < 1 gives negative one."
+if [ "$MAGN_NEGAT" ] ; then
+    g.message -e "Magnification should be a positive number: default is \"1\" (1/10 of current region). \"magn\" > 1 gives positive magnification, \"magn\" < 1 gives negative one."
     exit 1
 fi  
 
 
 ## region stuff 
 
-if [ "$GIS_FLAG_R" -eq 1 ]; then
-    eval $(g.region -g)
+if [ "$GIS_FLAG_R" -eq 1 ] ; then
+    eval `g.region -gu`
     OLD_NSRES="$nsres"
     OLD_EWRES="$ewres"
     
@@ -159,11 +161,11 @@
     g.region res="$tmp_res"
 fi
 
-eval $(g.region -eg)
+eval `g.region -egu`
 ns_extent_round=$(printf "%.0f\n" $ns_extent)
 ew_extent_round=$(printf "%.0f\n" $ew_extent)
 
-if [ -z "$GIS_OPT_MAGN" ]; then
+if [ -z "$GIS_OPT_MAGN" ] ; then
     MAGN=1
 else
     MAGN="$GIS_OPT_MAGN"
@@ -186,45 +188,45 @@
 if [ -z "$NOT_RUN" ]; then
     d.mon select="$MON"
 else
-    g.message -e "Monitor <"$MON"> is not running. Please run or select it first"
+    g.message -e "Monitor <$MON> is not running. Please run or select it first"
     exit 1
 fi     
 
 
 ####  navigation in X-monitor
 
-if [ "$GIS_FLAG_X" -eq 1 ]; then
+if [ "$GIS_FLAG_X" -eq 1 ] ; then
     
 ### make actions scripts for AWK
     
     for ACTIONS in up down left right closer futher; do
-	SCRIPT="${TMP}_"$ACTIONS".sh"
-	echo '#!/bin/sh' > $SCRIPT
+	SCRIPT="${TMP}_$ACTIONS.sh"
+	echo '#!/bin/sh' > "$SCRIPT"
 	
 	case "$ACTIONS" in
 	    up)
-		echo "g.region n=n-"$north_step" s=s-"$north_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region n=n-$north_step s=s-$north_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	    down)
-		echo "g.region n=n+"$north_step" s=s+"$north_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region n=n+$north_step s=s+$north_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	    left)
-		echo "g.region w=w+"$east_step" e=e+"$east_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region w=w+$east_step e=e+$east_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	    right)
-		echo "g.region w=w-"$east_step" e=e-"$east_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region w=w-$east_step e=e-$east_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	    closer)
-		echo "g.region w=w+"$east_step" e=e-"$east_step" n=n-"$north_step" s=s+"$north_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region w=w+$east_step e=e-$east_step n=n-$north_step s=s+$north_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	    futher)
-		echo "g.region w=w-"$east_step" e=e+"$east_step" n=n+"$north_step" s=s-"$north_step"" >> $SCRIPT
-		echo "d.redraw --q" >> $SCRIPT
+		echo "g.region w=w-$east_step e=e+$east_step n=n+$north_step s=s-$north_step" >> "$SCRIPT"
+		echo "d.redraw --q" >> "$SCRIPT"
 		;;
 	esac
 	
@@ -235,12 +237,12 @@
     
     GRASS_version=$(g.version -g | grep "version" | cut -d'=' -f2)
     
-    window_search="GRASS "${GRASS_version}" - Monitor: "${MON}" - Location: "${LOCATION_NAME}""
-    GRASS_wid=$(xdotool search --title "${window_search}")
+    window_search="GRASS $GRASS_version - Monitor: $MON - Location: $LOCATION_NAME"
+    GRASS_wid=$(xdotool search --title "$window_search")
 
-    xdotool windowactivate "${GRASS_wid}"
+    xdotool windowactivate "$GRASS_wid"
     
-    xev -id "${GRASS_wid}" | awk '/keycode/ {print $4; fflush()}' | while read -r xev_code; do
+    xev -id "$GRASS_wid" | awk '/keycode/ {print $4; fflush()}' | while read -r xev_code; do
 	awk -v TMP="$TMP" -v xev="${xev_code}" 'NR % 2 { next } 
     {
           if ($0 == 111)
@@ -263,7 +265,7 @@
 
 #### navigation in terminal
 
-if [ "$GIS_FLAG_T" -eq 1 ]; then
+if [ "$GIS_FLAG_T" -eq 1 ] ; then
     
     tty_save=$(stty -g)
     
@@ -285,7 +287,7 @@
     tty_kcuf1=$(tput kcud1 2>&1 | get_odx)
 
 # Some terminals send the wrong code for certain arrow keys
-    if [ "$tty_cuu1" = "033 133 101" -o "$tty_kcuu1" = "033 133 101" ]; then
+    if [ "$tty_cuu1" = "033 133 101" -o "$tty_kcuu1" = "033 133 101" ] ; then
 	tty_cudx="033 133 102"
 	tty_cufx="033 133 103"
 	tty_cubx="033 133 104"
@@ -337,7 +339,3 @@
 
 exit 0
 
-
-
-
-



More information about the grass-commit mailing list