[GRASS-SVN] r41338 - in grass/branches/develbranch_6/scripts: v.dissolve v.in.mapgen

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 7 16:48:14 EST 2010


Author: glynn
Date: 2010-03-07 16:48:13 -0500 (Sun, 07 Mar 2010)
New Revision: 41338

Modified:
   grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
   grass/branches/develbranch_6/scripts/v.in.mapgen/v.in.mapgen
Log:
Rename $TMP to avoid conflict on Windows


Modified: grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve	2010-03-07 20:18:21 UTC (rev 41337)
+++ grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve	2010-03-07 21:48:13 UTC (rev 41338)
@@ -67,11 +67,11 @@
 fi
 
 #### setup temporary file
-TMP=$$
+TMPMAP="${GIS_OPT_OUTPUT}_$$"
 
 cleanup()
 {
-   g.remove vect="$GIS_OPT_OUTPUT"_${TMP} --quiet
+   g.remove vect="$TMPMAP" --quiet
 }
 
 # what to do in case of user break:
@@ -107,9 +107,9 @@
       g.message -e "Database connection not defined for layer $GIS_OPT_LAYER"
       exit 1
    fi
-   v.reclass input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT"_${TMP} layer="$GIS_OPT_LAYER" \
+   v.reclass input="$GIS_OPT_INPUT" output="$TMPMAP" layer="$GIS_OPT_LAYER" \
              column="$GIS_OPT_COLUMN"
-   v.extract -d input="$GIS_OPT_OUTPUT"_${TMP} output="$GIS_OPT_OUTPUT" type=area \
+   v.extract -d input="$TMPMAP" output="$GIS_OPT_OUTPUT" type=area \
              layer="$GIS_OPT_LAYER"
    cleanup
 fi

Modified: grass/branches/develbranch_6/scripts/v.in.mapgen/v.in.mapgen
===================================================================
--- grass/branches/develbranch_6/scripts/v.in.mapgen/v.in.mapgen	2010-03-07 20:18:21 UTC (rev 41337)
+++ grass/branches/develbranch_6/scripts/v.in.mapgen/v.in.mapgen	2010-03-07 21:48:13 UTC (rev 41338)
@@ -104,14 +104,14 @@
 fi
 
 #### setup temporary file
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
+TMPFILE="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMPFILE" ] ; then
     g.message -e "unable to create temporary files"
     exit 1
 fi
 
 #### trap ctrl-c so that we can clean up tmp
-trap 'rm -f "$TMP"' 2 3 15
+trap 'rm -f "$TMPFILE"' 2 3 15
 
 #### create ascii vector file
 if [ $GIS_FLAG_F -eq 1 ] ; then
@@ -122,7 +122,7 @@
   #  tac $FILE | $AWK 'BEGIN { FS="," ; R=0 }
   #    $1~/\d*/   { printf("L %d\n", R) }
   #    $1~/   .*/ { printf(" %lf %lf\n", $2, $1) ; ++R }
-  #    $1~/END/   { }' | tac > "$TMP"
+  #    $1~/END/   { }' | tac > "$TMPFILE"
 
   ## matlab format. Cleanse with NaN->nan and spaces to tabs
   tac "$FILE" | awk '{print $1 "\t" $2 "\t" $3}
@@ -133,7 +133,7 @@
     $1~/nan.*/ { printf("L %d\n", R) ; R=0 }
     $1~/\d*\.\d*/ { printf(" %.8f %.8f %.8f\n", $1, $2, $3) ; ++R }
     END {;}' | \
-   grep -v "^L 0$" | tac > "$TMP"
+   grep -v "^L 0$" | tac > "$TMPFILE"
 
 else
   ## mapgen format.
@@ -141,11 +141,11 @@
     BEGIN { FS="\t" ; R=0 }
     $1~/#.*/ { printf("L %d\n", R) ; R=0 }
     $1~/\d*\.\d*/ { printf(" %.8f %.8f\n", $1, $2) ; ++R }
-    END {;}' | tac > "$TMP"
+    END {;}' | tac > "$TMPFILE"
 fi
 
 #### create digit header
-cat << EOF > "${TMP}.dig"
+cat << EOF > "${TMPFILE}.dig"
 ORGANIZATION: GRASSroots organization
 DIGIT DATE:   `date +%D`
 DIGIT NAME:   `echo $USER@$HOSTNAME`
@@ -159,16 +159,16 @@
 EOF
 
 #### process points list to ascii vector file (merge in vertices)
-cat "${TMP}" >> "${TMP}.dig"
+cat "${TMPFILE}" >> "${TMPFILE}.dig"
 
 #### if no name for vector file given, cat to stdout
 if [ "$NAME" = "" ] ; then
     g.message "Output to stdout" 
-    cat "${TMP}.dig" 2>/dev/null
+    cat "${TMPFILE}.dig" 2>/dev/null
 else
     #### import to binary vector file
     g.message "Importing with v.in.ascii ..." 
-    v.in.ascii $do3D input="${TMP}.dig" output="$NAME" format=standard
+    v.in.ascii $do3D input="${TMPFILE}.dig" output="$NAME" format=standard
 
     #### check success/failure
     if [ $? -eq 0 ] ; then
@@ -179,7 +179,7 @@
 fi
 
 #### clean up the mess
-rm -f "$TMP" "${TMP}.dig"
+rm -f "$TMPFILE" "${TMPFILE}.dig"
 
 #### end
 exit 0



More information about the grass-commit mailing list