[GRASS-SVN] r41012 - grass/branches/develbranch_6/imagery/i.ortho.photo/libes

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 15 02:24:03 EST 2010


Author: hamish
Date: 2010-02-15 02:24:03 -0500 (Mon, 15 Feb 2010)
New Revision: 41012

Modified:
   grass/branches/develbranch_6/imagery/i.ortho.photo/libes/elev.c
Log:
cleanup: reorder includes, i18n, explain return codes, add warning (merge from trunk)

Modified: grass/branches/develbranch_6/imagery/i.ortho.photo/libes/elev.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.ortho.photo/libes/elev.c	2010-02-15 07:22:44 UTC (rev 41011)
+++ grass/branches/develbranch_6/imagery/i.ortho.photo/libes/elev.c	2010-02-15 07:24:03 UTC (rev 41012)
@@ -5,17 +5,18 @@
 **********************************************************/
 #include <stdio.h>
 #include <unistd.h>
+#include <grass/gis.h>
+#include <grass/ortholib.h>
+#include <grass/glocale.h>
 #include "orthophoto.h"
-#include <grass/ortholib.h>
-#include <grass/gis.h>
 
+
 #define IN_BUF 200
 
 
 /* Put the "elev" name into the block file "ELEV" */
-int
-I_put_group_elev(char *group, char *elev, char *mapset_elev, char *tl,
-		 char *math_exp, char *units, char *nd)
+int I_put_group_elev(char *group, char *elev, char *mapset_elev, char *tl,
+		     char *math_exp, char *units, char *nd)
 {
     FILE *fd;
 
@@ -36,24 +37,29 @@
 }
 
 
-/* Return the elev name from the block file ELEV */
-int
-I_get_group_elev(char *group, char *elev, char *mapset_elev, char *tl,
-		 char *math_exp, char *units, char *nd)
+/* Return the elev name from the block file ELEV
+    returns 0 on fail,  1 on success */
+int I_get_group_elev(char *group, char *elev, char *mapset_elev, char *tl,
+		     char *math_exp, char *units, char *nd)
 {
     char buf[IN_BUF];
     FILE *fd;
 
-    if (!I_find_group_elev_file(group))
+    if (!I_find_group_elev_file(group)) {
+	G_warning(
+	    _("Unable to find elevation file for group [%s] in mapset [%s]"),
+	      group, G_mapset());
 	return 0;
+    }
 
     G_suppress_warnings(1);
     fd = I_fopen_group_elev_old(group);
     G_suppress_warnings(0);
+
     if (!fd) {
-	G_warning
-	    ("unable to open elevation file for group [%s] in mapset [%s]",
-	     group, G_mapset());
+	G_warning(
+	    _("Unable to open elevation file for group [%s] in mapset [%s]"),
+	      group, G_mapset());
 	G_sleep(3);
 
 	return 0;
@@ -73,5 +79,5 @@
     sscanf(buf, "no data values  :%s\n", nd);
     fclose(fd);
 
-    return (1);
+    return 1;
 }



More information about the grass-commit mailing list