commit c4df8288b292117372541cfdd872097f45d134b5
parent 9d3cbdb7911f7dd9e156e34f95c09509ee53c66c
Author: amrfti <andrew@kloet.net>
Date: Mon, 19 Jan 2026 13:27:04 -0500
helpful errors
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/vidir.c b/vidir.c
@@ -188,8 +188,8 @@ int main(int argc, char *argv[]) {
}
if (rename(old, p) != 0) {
- fprintf(stderr, "failed to rename %s -> %s: %s\n", old, p,
- strerror(errno));
+ fprintf(stderr, "%s -> %s: ", old, newname);
+ perror("");
error_flag = 1;
} else {
if (verbose)
@@ -204,8 +204,13 @@ int main(int argc, char *argv[]) {
/* Delete files that were not in the edited file */
for (int i = 0; i < n_items; i++) {
if (!seen[i]) {
- if (rm_path(items[i].path) == 0 && verbose)
- printf("Removed: %s\n", items[i].path);
+ if (rm_path(items[i].path) != 0) {
+ fprintf(stderr, "%s: ", items[i].path);
+ perror("cannot remove");
+ error_flag = 1;
+ } else if (verbose) {
+ printf("removed '%s'\n", items[i].path);
+ }
}
free(items[i].path);
}