[GRASS-SVN] r39381 - grass/branches/releasebranch_6_4/lib/imagery
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Oct 3 00:29:03 EDT 2009
Author: hamish
Date: 2009-10-03 00:29:03 -0400 (Sat, 03 Oct 2009)
New Revision: 39381
Modified:
grass/branches/releasebranch_6_4/lib/imagery/group.c
grass/branches/releasebranch_6_4/lib/imagery/ls_groups.c
grass/branches/releasebranch_6_4/lib/imagery/points.c
grass/branches/releasebranch_6_4/lib/imagery/title.c
Log:
use G_getl2(), i18n (merge from devbr6)
Modified: grass/branches/releasebranch_6_4/lib/imagery/group.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/imagery/group.c 2009-10-03 04:27:04 UTC (rev 39380)
+++ grass/branches/releasebranch_6_4/lib/imagery/group.c 2009-10-03 04:29:03 UTC (rev 39381)
@@ -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/branches/releasebranch_6_4/lib/imagery/ls_groups.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/imagery/ls_groups.c 2009-10-03 04:27:04 UTC (rev 39380)
+++ grass/branches/releasebranch_6_4/lib/imagery/ls_groups.c 2009-10-03 04:29:03 UTC (rev 39381)
@@ -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) {
@@ -108,7 +108,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/branches/releasebranch_6_4/lib/imagery/points.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/imagery/points.c 2009-10-03 04:27:04 UTC (rev 39380)
+++ grass/branches/releasebranch_6_4/lib/imagery/points.c 2009-10-03 04:29:03 UTC (rev 39381)
@@ -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/branches/releasebranch_6_4/lib/imagery/title.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/imagery/title.c 2009-10-03 04:27:04 UTC (rev 39380)
+++ grass/branches/releasebranch_6_4/lib/imagery/title.c 2009-10-03 04:29:03 UTC (rev 39381)
@@ -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