[GRASS-SVN] r39380 - grass/trunk/lib/imagery

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 3 00:27:04 EDT 2009


Author: hamish
Date: 2009-10-03 00:27:04 -0400 (Sat, 03 Oct 2009)
New Revision: 39380

Modified:
   grass/trunk/lib/imagery/group.c
   grass/trunk/lib/imagery/ls_groups.c
   grass/trunk/lib/imagery/points.c
   grass/trunk/lib/imagery/title.c
Log:
use G_getl2(), i18n (merge from devbr6)

Modified: grass/trunk/lib/imagery/group.c
===================================================================
--- grass/trunk/lib/imagery/group.c	2009-10-03 04:23:47 UTC (rev 39379)
+++ grass/trunk/lib/imagery/group.c	2009-10-03 04:27:04 UTC (rev 39380)
@@ -25,9 +25,11 @@
 * I_init_group_ref (&Ref);
 * I_free_group_ref (&Ref);
 **********************************************************/
+
 #include <string.h>
 #include <stdlib.h>
 #include <grass/imagery.h>
+
 static int get_ref(const char *, const char *, struct Ref *);
 static int set_color(const char *, const char *, const char *, struct Ref *);
 static int put_ref(const char *, const char *, const struct Ref *);
@@ -154,8 +156,8 @@
     if (!fd)
 	return 0;
 
-    while (fgets(buf, sizeof buf, fd)) {
-	n = sscanf(buf, "%255s %255s %15s", name, mapset, color);	/* better use INAME_LEN */
+    while (G_getl2(buf, sizeof buf, fd)) {
+	n = sscanf(buf, "%255s %255s %15s", name, mapset, color);  /* better use INAME_LEN */
 	if (n == 2 || n == 3) {
 	    I_add_file_to_group_ref(name, mapset, ref);
 	    if (n == 3)

Modified: grass/trunk/lib/imagery/ls_groups.c
===================================================================
--- grass/trunk/lib/imagery/ls_groups.c	2009-10-03 04:23:47 UTC (rev 39379)
+++ grass/trunk/lib/imagery/ls_groups.c	2009-10-03 04:27:04 UTC (rev 39380)
@@ -44,7 +44,7 @@
 	strcat(buf, " -C");
     /* FIXME: use G__ls() */
     if ((ls = popen(buf, "r"))) {
-	while (G_getl(buf, sizeof(buf), ls)) {
+	while (G_getl2(buf, sizeof(buf), ls)) {
 	    any = 1;
 	    fprintf(temp, "%s", buf);
 	    if (full) {
@@ -105,7 +105,7 @@
 	strcat(buf, " -C");
     /* FIXME: use G__ls() */
     if ((ls = popen(buf, "r"))) {
-	while (G_getl(buf, sizeof(buf), ls)) {
+	while (G_getl2(buf, sizeof(buf), ls)) {
 	    any = 1;
 	    fprintf(temp, "%s\n", buf);
 	    if (full) {

Modified: grass/trunk/lib/imagery/points.c
===================================================================
--- grass/trunk/lib/imagery/points.c	2009-10-03 04:23:47 UTC (rev 39379)
+++ grass/trunk/lib/imagery/points.c	2009-10-03 04:27:04 UTC (rev 39380)
@@ -1,4 +1,5 @@
 #include <grass/imagery.h>
+#include <grass/glocale.h>
 
 #define POINT_FILE "POINTS"
 
@@ -19,7 +20,7 @@
     cp->n2 = NULL;
     cp->status = NULL;
 
-    while (G_getl(buf, sizeof buf, fd)) {
+    while (G_getl2(buf, sizeof buf, fd)) {
 	G_strip(buf);
 	if (*buf == '#' || *buf == 0)
 	    continue;
@@ -116,23 +117,20 @@
 int I_get_control_points(const char *group, struct Control_Points *cp)
 {
     FILE *fd;
-    char msg[100];
     int stat;
 
     fd = I_fopen_group_file_old(group, POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg, "unable to open control point file for group [%s in %s]",
-		group, G_mapset());
-	G_warning(msg);
+	G_warning(_("Unable to open control point file for group [%s in %s]"),
+		  group, G_mapset());
 	return 0;
     }
 
     stat = I_read_control_points(fd, cp);
     fclose(fd);
     if (stat < 0) {
-	sprintf(msg, "bad format in control point file for group [%s in %s]",
-		group, G_mapset());
-	G_warning(msg);
+	G_warning(_("Bad format in control point file for group [%s in %s]"),
+		  group, G_mapset());
 	return 0;
     }
     return 1;
@@ -155,14 +153,11 @@
 int I_put_control_points(const char *group, const struct Control_Points *cp)
 {
     FILE *fd;
-    char msg[100];
 
     fd = I_fopen_group_file_new(group, POINT_FILE);
     if (fd == NULL) {
-	sprintf(msg,
-		"unable to create control point file for group [%s in %s]",
-		group, G_mapset());
-	G_warning(msg);
+	G_warning(_("Unable to create control point file for group [%s in %s]"),
+		  group, G_mapset());
 	return 0;
     }
 

Modified: grass/trunk/lib/imagery/title.c
===================================================================
--- grass/trunk/lib/imagery/title.c	2009-10-03 04:23:47 UTC (rev 39379)
+++ grass/trunk/lib/imagery/title.c	2009-10-03 04:27:04 UTC (rev 39380)
@@ -11,7 +11,7 @@
     fd = I_fopen_group_file_old(group, "TITLE");
     G_suppress_warnings(0);
     if (fd != NULL) {
-	G_getl(title, n, fd);
+	G_getl2(title, n, fd);
 	fclose(fd);
     }
 



More information about the grass-commit mailing list