|
@@ -337,9 +337,7 @@ int main(int argc, char *argv[])
|
|
|
/* Get database window parameters */
|
|
|
|
|
|
if (G_get_window(&window) < 0) {
|
|
|
- sprintf(buf, "can't read current window parameters");
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error("can't read current window parameters");
|
|
|
}
|
|
|
|
|
|
/* find number of rows and columns in window */
|
|
@@ -359,90 +357,30 @@ int main(int argc, char *argv[])
|
|
|
/* Check if input layers exists in data base */
|
|
|
|
|
|
if (G_find_cell2(max_layer, "") == NULL) {
|
|
|
- sprintf(buf, "Raster map <%s> not found", max_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error("Raster map <%s> not found", max_layer);
|
|
|
}
|
|
|
|
|
|
if (G_find_cell2(dir_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), dir_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), dir_layer);
|
|
|
}
|
|
|
|
|
|
if (G_find_cell2(base_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), base_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), base_layer);
|
|
|
}
|
|
|
|
|
|
if (G_find_cell2(start_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), start_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), start_layer);
|
|
|
}
|
|
|
|
|
|
if (spotting) {
|
|
|
if (G_find_cell2(spotdist_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), spotdist_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), spotdist_layer);
|
|
|
}
|
|
|
if (G_find_cell2(velocity_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), velocity_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), velocity_layer);
|
|
|
}
|
|
|
if (G_find_cell2(mois_layer, "") == NULL) {
|
|
|
- sprintf(buf, _("Raster map <%s> not found"), mois_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /* Check if specified output layer names ARE LEGAL or EXISTS */
|
|
|
-
|
|
|
- if (G_legal_filename(out_layer) < 0) {
|
|
|
- sprintf(buf, _("<%s> is an illegal file name"), out_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
- if (G_find_cell2(out_layer, G_mapset())) {
|
|
|
- sprintf(buf,
|
|
|
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
|
|
|
- out_layer, G_mapset());
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
-
|
|
|
- if (x_out) {
|
|
|
- if (G_legal_filename(x_out_layer) < 0) {
|
|
|
- sprintf(buf, _("<%s> is an illegal file name"), x_out_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
- if (G_find_cell2(x_out_layer, G_mapset())) {
|
|
|
- sprintf(buf,
|
|
|
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
|
|
|
- x_out_layer, G_mapset());
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (y_out) {
|
|
|
- if (G_legal_filename(y_out_layer) < 0) {
|
|
|
- sprintf(buf, _("<%s> is an illegal file name"), y_out_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
- }
|
|
|
- if (G_find_cell2(y_out_layer, G_mapset())) {
|
|
|
- sprintf(buf,
|
|
|
- _("Raster map <%s> already exists in mapset <%s>, select another name"),
|
|
|
- y_out_layer, G_mapset());
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Raster map <%s> not found"), mois_layer);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -450,45 +388,33 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
max_fd = G_open_cell_old(max_layer, G_find_cell2(max_layer, ""));
|
|
|
if (max_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), max_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), max_layer);
|
|
|
}
|
|
|
|
|
|
dir_fd = G_open_cell_old(dir_layer, G_find_cell2(dir_layer, ""));
|
|
|
if (dir_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), dir_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), dir_layer);
|
|
|
}
|
|
|
|
|
|
base_fd = G_open_cell_old(base_layer, G_find_cell2(base_layer, ""));
|
|
|
if (base_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), base_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), base_layer);
|
|
|
}
|
|
|
|
|
|
if (spotting) {
|
|
|
spotdist_fd =
|
|
|
G_open_cell_old(spotdist_layer, G_find_cell2(spotdist_layer, ""));
|
|
|
if (spotdist_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), spotdist_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), spotdist_layer);
|
|
|
}
|
|
|
velocity_fd =
|
|
|
G_open_cell_old(velocity_layer, G_find_cell2(velocity_layer, ""));
|
|
|
if (velocity_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), velocity_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), velocity_layer);
|
|
|
}
|
|
|
mois_fd = G_open_cell_old(mois_layer, G_find_cell2(mois_layer, ""));
|
|
|
if (mois_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), mois_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), mois_layer);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -558,9 +484,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
start_fd = G_open_cell_old(start_layer, G_find_cell2(start_layer, ""));
|
|
|
if (start_fd < 0) {
|
|
|
- sprintf(buf, _("Unable to open raster map <%s>"), start_layer);
|
|
|
- G_fatal_error(buf);
|
|
|
- exit(EXIT_FAILURE);
|
|
|
+ G_fatal_error(_("Unable to open raster map <%s>"), start_layer);
|
|
|
}
|
|
|
|
|
|
G_read_range(start_layer, G_find_file("cell", start_layer, ""), &range);
|