aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-07-03 21:41:08 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-07-03 21:41:08 -0700
commita78619a402f3a63faa386403c068d1079780c57a (patch)
treec7749cb004281367005a177d9168edb694791f6c /bb.c
parent1d54d6a29269d89248f65d9f2874b88c34e63691 (diff)
Switch from /etc/xdg/bb to /etc/bb
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bb.c b/bb.c
index 185c70e..a3a696c 100644
--- a/bb.c
+++ b/bb.c
@@ -117,6 +117,10 @@ void bb_browse(bb_t *bb, const char *initial_path)
{
if (populate_files(bb, initial_path))
clean_err("Could not find initial path: \"%s\"", initial_path);
+ // Emergency fallback:
+ bindings[0].key = KEY_CTRL_C;
+ bindings[0].script = strdup("kill -INT $PPID");
+ bindings[0].description = strdup("Kill the bb process");
run_script(bb, "bbstartup");
check_cmdfile(bb);
while (!bb->should_quit) {
@@ -664,8 +668,8 @@ static void run_bbcmd(bb_t *bb, const char *cmd)
}
binding_t binding = {keyval, script2, memcheck(strdup(description))};
if (bindings[i].key == keyval) {
- free(bindings[i].description);
- free(bindings[i].script);
+ free((char*)bindings[i].description);
+ free((char*)bindings[i].script);
for (; i + 1 < sizeof(bindings)/sizeof(bindings[0]) && bindings[i+1].key; i++)
bindings[i] = bindings[i+1];
}
@@ -1159,7 +1163,7 @@ int main(int argc, char *argv[])
getenv("XDG_CONFIG_HOME"), getenv("BBPATH"), getenv("PATH")) < 0)
clean_err("Could not allocate memory for PATH");
} else {
- if (asprintf(&newpath, "%s/"BB_NAME":%s/xdg/"BB_NAME":%s",
+ if (asprintf(&newpath, "%s/"BB_NAME":%s/"BB_NAME":%s",
getenv("XDG_CONFIG_HOME"), getenv("sysconfdir"), getenv("PATH")) < 0)
clean_err("Could not allocate memory for PATH");
}