[GRASS-SVN] r57037 - grass/branches/develbranch_6/scripts/m.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 7 07:12:47 PDT 2013


Author: hamish
Date: 2013-07-07 07:12:47 -0700 (Sun, 07 Jul 2013)
New Revision: 57037

Modified:
   grass/branches/develbranch_6/scripts/m.proj/m.proj
Log:
another attempt at trying to make cs2cs, msys, bash, and Windows to play nicely together

Modified: grass/branches/develbranch_6/scripts/m.proj/m.proj
===================================================================
--- grass/branches/develbranch_6/scripts/m.proj/m.proj	2013-07-07 13:15:46 UTC (rev 57036)
+++ grass/branches/develbranch_6/scripts/m.proj/m.proj	2013-07-07 14:12:47 UTC (rev 57037)
@@ -113,6 +113,25 @@
 LC_NUMERIC=C
 export LC_NUMERIC
 
+# Get the system name
+SYSTEM=`uname -s`
+case $SYSTEM in
+MINGW* | MSYS*)
+        MINGW=1
+        ;;
+CYGWIN*)
+        CYGWIN=1
+        ;;
+Darwin*)
+        MACOSX=1
+        ;;
+esac
+
+dos2unix_path()
+{
+   echo "$1" | sed -e 's|\("[A-Za-z]\):[\\/]|/\1/|' -e 's|\\|/|g'
+}
+
 # turn verbose mode on if requested either way
 if [ "$GIS_FLAG_V" -eq 1 ] ; then
    g.message -w "The verbosity option is superseded. Use --verbose instead"
@@ -173,10 +192,14 @@
            if [ $(echo "$line" | grep -c '+nadgrids=') -gt 0 ] ; then
                line=$(echo "$line" | sed -e 's/=/="/' -e 's/$/"/')
            fi
-           IN_PROJ="$IN_PROJ '$line'"
+           IN_PROJ="$IN_PROJ $line"
        done
        echo "$IN_PROJ"
    )`
+   # cs2cs gives an error for "C:/" not "C:\", but "/c/" seems ok
+   if [ "$MINGW" ] ; then
+      IN_PROJ=`dos2unix_path "$IN_PROJ"`
+   fi
 fi
 if [ -n "$GIS_OPT_PROJ_IN" ] ; then
    IN_PROJ="$GIS_OPT_PROJ_IN"
@@ -198,10 +221,14 @@
            if [ $(echo "$line" | grep -c '+nadgrids=') -gt 0 ] ; then
                line=$(echo "$line" | sed -e 's/=/="/' -e 's/$/"/')
            fi
-           OUT_PROJ="$OUT_PROJ '$line'"
+           OUT_PROJ="$OUT_PROJ $line"
        done
        echo "$OUT_PROJ"
    )`
+   # cs2cs gives an error for "C:/" not "C:\", but "/c/" seems ok
+   if [ "$MINGW" ] ; then
+      OUT_PROJ=`dos2unix_path "$OUT_PROJ"`
+   fi
 fi
 if [ -n "$GIS_OPT_PROJ_OUT" ] ; then
    OUT_PROJ="$GIS_OPT_PROJ_OUT"
@@ -280,12 +307,12 @@
 if [ "$GIS_FLAG_G" -eq 1 ] ; then
    if [ -z "$outfile" ] ; then
       cat "$infile" | tr "$fs" ' ' | \
-	 eval cs2cs $COPYINP $OUTFMT `echo $IN_PROJ` +to `echo $OUT_PROJ` | \
+	 eval cs2cs $COPYINP $OUTFMT $IN_PROJ +to $OUT_PROJ | \
 	 tr -s "\t" "$GIS_OPT_FS" | tr -s " " "$GIS_OPT_FS"
       EXITCODE=$?
    else
       cat "$infile" | tr "$fs" ' ' | \
-	 eval cs2cs $COPYINP $OUTFMT `echo $IN_PROJ` +to `echo $OUT_PROJ` | \
+	 eval cs2cs $COPYINP $OUTFMT $IN_PROJ +to $OUT_PROJ | \
 	 tr -s "\t" "$GIS_OPT_FS" | tr -s " " "$GIS_OPT_FS" \
          > "$outfile"
       EXITCODE=$?
@@ -299,11 +326,11 @@
    # write cs2cs output as is
    if [ -z "$outfile" ] ; then
       cat "$infile" | tr "$fs" ' ' | \
-	 eval cs2cs $COPYINP $OUTFMT `echo $IN_PROJ` +to `echo $OUT_PROJ`
+	 eval cs2cs $COPYINP $OUTFMT $IN_PROJ +to $OUT_PROJ
       EXITCODE=$?
    else
       cat "$infile" | tr "$fs" ' ' | \
-	 eval cs2cs $COPYINP $OUTFMT `echo $IN_PROJ` +to `echo $OUT_PROJ` \
+	 eval cs2cs $COPYINP $OUTFMT $IN_PROJ +to $OUT_PROJ \
          > "$outfile"
       EXITCODE=$?
 



More information about the grass-commit mailing list