Переглянути джерело

use G_getl2(), i18n (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39380 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 15 роки тому
батько
коміт
a927cf1428
4 змінених файлів з 15 додано та 18 видалено
  1. 4 2
      lib/imagery/group.c
  2. 2 2
      lib/imagery/ls_groups.c
  3. 8 13
      lib/imagery/points.c
  4. 1 1
      lib/imagery/title.c

+ 4 - 2
lib/imagery/group.c

@@ -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 @@ static int get_ref(const char *group, const char *subgroup, struct Ref *ref)
     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)

+ 2 - 2
lib/imagery/ls_groups.c

@@ -44,7 +44,7 @@ int I_list_groups(int full)
 	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 @@ int I_list_subgroups(const char *group, int full)
 	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) {

+ 8 - 13
lib/imagery/points.c

@@ -1,4 +1,5 @@
 #include <grass/imagery.h>
+#include <grass/glocale.h>
 
 #define POINT_FILE "POINTS"
 
@@ -19,7 +20,7 @@ static int I_read_control_points(FILE * fd, struct Control_Points *cp)
     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 @@ static int I_write_control_points(FILE * fd, const struct Control_Points *cp)
 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_get_control_points(const char *group, struct Control_Points *cp)
 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;
     }
 

+ 1 - 1
lib/imagery/title.c

@@ -11,7 +11,7 @@ int I_get_group_title(const char *group, char *title, int n)
     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);
     }