aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-11-04 17:25:25 +0100
committerBruce Hill <bruce@bruce-hill.com>2019-11-04 17:25:25 +0100
commit8027d815afa79af63c492bde2ad8adaa9e40e4c6 (patch)
treedf5a0c1b60fcd7c5d420d51a12a01aaa6fc98e6c /bb.c
parentad6e61be16f7a0548929eb863655840c6cedc68b (diff)
Fixed issue with deselecting deleted files not working because
realpath() depends on the file existing. Also added more detail to error messages to make tracking down issues easier.
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bb.c b/bb.c
index 193c064..bd086be 100644
--- a/bb.c
+++ b/bb.c
@@ -390,7 +390,7 @@ void normalize_path(const char *root, const char *path, char *normalized)
}
strcat(pbuf, path);
if (realpath(pbuf, normalized) == NULL)
- err("Could not find: \"%s\"", pbuf);
+ strcpy(normalized, pbuf); // TODO: normalize better?
}
/*
@@ -637,7 +637,7 @@ void run_bbcmd(bb_t *bb, const char *cmd)
} else if (matches_cmd(cmd, "goto:")) { // +goto:
entry_t *e = load_entry(bb, value, 1);
if (!e) {
- warn("Could not find file: \"%s\".", value);
+ warn("Could not find file to go to: \"%s\".", value);
return;
}
if (IS_VIEWED(e)) {
@@ -724,7 +724,7 @@ void run_bbcmd(bb_t *bb, const char *cmd)
if (!value) value = bb->files[bb->cursor]->fullname;
entry_t *e = load_entry(bb, value, 1);
if (!e) {
- warn("Could not find file: \"%s\".", value);
+ warn("Could not find file to toggle: \"%s\".", value);
return;
}
set_selected(bb, e, !IS_SELECTED(e));
@@ -996,6 +996,8 @@ int run_script(bb_t *bb, const char *cmd)
LL_PREPEND(running_procs, proc, running);
int status = wait_for_process(&proc);
+ if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
+ run_script(bb, "trap true INT; pause; true");
dirty = 1;
return status;
}
@@ -1234,7 +1236,7 @@ int main(int argc, char *argv[])
normalize_path(full_initial_path, initial_path, full_initial_path);
struct stat path_stat;
if (stat(full_initial_path, &path_stat) != 0)
- err("Could not find: \"%s\"", initial_path);
+ err("Could not find initial path: \"%s\"", initial_path);
if (S_ISDIR(path_stat.st_mode)) {
if (strcmp(full_initial_path, "/") != 0) strcat(full_initial_path, "/");
} else {
@@ -1264,7 +1266,7 @@ int main(int argc, char *argv[])
strcpy(bb->columns, "*smpn");
strcpy(bb->sort, "+n");
if (populate_files(bb, full_initial_path))
- err("Could not find: \"%s\"", initial_path);
+ err("Could not find initial path: \"%s\"", initial_path);
run_script(bb, runstartup);
write(cmdfd, "\0", 1);