[GRASS-SVN] r66959 - grass/branches/releasebranch_7_0/general/g.remove
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 28 01:50:52 PST 2015
Author: martinl
Date: 2015-11-28 01:50:52 -0800 (Sat, 28 Nov 2015)
New Revision: 66959
Modified:
grass/branches/releasebranch_7_0/general/g.remove/main.c
Log:
g.remove: print warning when no files found
turn important message to warning
(merge r66958 from trunk)
Modified: grass/branches/releasebranch_7_0/general/g.remove/main.c
===================================================================
--- grass/branches/releasebranch_7_0/general/g.remove/main.c 2015-11-28 09:47:18 UTC (rev 66958)
+++ grass/branches/releasebranch_7_0/general/g.remove/main.c 2015-11-28 09:50:52 UTC (rev 66959)
@@ -58,7 +58,7 @@
char *pattern, *exclude;
const char *mapset;
int result;
- int i, all, num_types, nlist;
+ int i, all, num_types, nlist, num_removed;
void *filter, *exclude_filter;
G_gisinit(argv[0]);
@@ -222,6 +222,7 @@
num_types = i;
}
+ num_removed = 0;
for (i = 0; i < num_types; i++) {
int n, rast, num_files, j;
const struct list *elem;
@@ -241,6 +242,7 @@
for (j = 0; j < num_files; j++) {
if (!flag.force->answer) {
fprintf(stdout, "%s/%s@%s\n", elem->alias, files[j], mapset);
+ num_removed++;
continue;
}
@@ -249,17 +251,21 @@
if (M_do_remove(n, (char *)files[j]) == 1)
result = EXIT_FAILURE;
+ num_removed++;
}
}
+ if (num_removed < 1)
+ G_warning(_("No data base element files found"));
+
G_free_ls_filter(filter);
if (exclude_filter)
G_free_ls_filter(exclude_filter);
- if (!flag.force->answer)
- G_important_message(_("You must use the force flag (-%c) to actually "
- "remove them. Exiting."), flag.force->key);
+ if (!flag.force->answer && num_removed > 0)
+ G_warning(_("Nothing removed. You must use the force flag (-%c) to actually "
+ "remove them. Exiting."), flag.force->key);
exit(result);
}
More information about the grass-commit
mailing list