Switched /etc/xdg/bp -> /etc/bp

This commit is contained in:
Bruce Hill 2021-07-03 21:43:56 -07:00
parent 2439a87833
commit 416484a636
3 changed files with 7 additions and 7 deletions

View File

@ -59,14 +59,14 @@ splint:
# $(CFILES) bp.c # $(CFILES) bp.c
install: $(NAME) bp.1 install: $(NAME) bp.1
mkdir -p -m 755 "$(PREFIX)/man/man1" "$(PREFIX)/bin" "$(SYSCONFDIR)/xdg/$(NAME)" mkdir -p -m 755 "$(PREFIX)/man/man1" "$(PREFIX)/bin" "$(SYSCONFDIR)/$(NAME)"
cp -r grammars/* "$(SYSCONFDIR)/xdg/$(NAME)/" cp -r grammars/* "$(SYSCONFDIR)/$(NAME)/"
cp bp.1 "$(PREFIX)/man/man1/$(NAME).1" cp bp.1 "$(PREFIX)/man/man1/$(NAME).1"
rm -f "$(PREFIX)/bin/$(NAME)" rm -f "$(PREFIX)/bin/$(NAME)"
cp $(NAME) "$(PREFIX)/bin/" cp $(NAME) "$(PREFIX)/bin/"
uninstall: uninstall:
rm -rf "$(PREFIX)/bin/$(NAME)" "$(PREFIX)/man/man1/$(NAME).1" "$(SYSCONFDIR)/xdg/$(NAME)" rm -rf "$(PREFIX)/bin/$(NAME)" "$(PREFIX)/man/man1/$(NAME).1" "$(SYSCONFDIR)/$(NAME)"
@if [ -d ~/.config/$(NAME) ]; then \ @if [ -d ~/.config/$(NAME) ]; then \
printf 'Config files exist in ~/.config/$(NAME) Do you want to delete them? [Y/n] '; \ printf 'Config files exist in ~/.config/$(NAME) Do you want to delete them? [Y/n] '; \
read confirm; \ read confirm; \

View File

@ -123,7 +123,7 @@ grammar file, use `bp -g <path-to-file>` or `bp --grammar=<path-to-file>`. Once
BP is installed, however, you can use `bp -g <grammar-name>` directly, and BP BP is installed, however, you can use `bp -g <grammar-name>` directly, and BP
will figure out which grammar you mean (e.g. `bp -g lua ...`). BP first will figure out which grammar you mean (e.g. `bp -g lua ...`). BP first
searches `~/.config/bp/` for any grammar files you keep locally, then searches searches `~/.config/bp/` for any grammar files you keep locally, then searches
`/etc/xdg/bp/` for system-wide grammar files. `/etc/bp/` for system-wide grammar files.
Testing for these grammar files (other than `builtins`) is iffy at this point, Testing for these grammar files (other than `builtins`) is iffy at this point,
so use at your own risk! These grammar files are only approximations of syntax. so use at your own risk! These grammar files are only approximations of syntax.

6
bp.c
View File

@ -498,8 +498,8 @@ int main(int argc, char *argv[])
pat_t *pattern = NULL; pat_t *pattern = NULL;
// Load builtins: // Load builtins:
file_t *xdg_file = load_filef(&loaded_files, "/etc/xdg/"BP_NAME"/builtins.bp"); file_t *builtins_file = load_filef(&loaded_files, "/etc/"BP_NAME"/builtins.bp");
if (xdg_file) defs = load_grammar(defs, xdg_file); if (builtins_file) defs = load_grammar(defs, builtins_file);
file_t *local_file = load_filef(&loaded_files, "%s/.config/"BP_NAME"/builtins.bp", getenv("HOME")); file_t *local_file = load_filef(&loaded_files, "%s/.config/"BP_NAME"/builtins.bp", getenv("HOME"));
if (local_file) defs = load_grammar(defs, local_file); if (local_file) defs = load_grammar(defs, local_file);
@ -543,7 +543,7 @@ int main(int argc, char *argv[])
if (f == NULL) if (f == NULL)
f = load_filef(&loaded_files, "%s/.config/"BP_NAME"/%s.bp", getenv("HOME"), flag); f = load_filef(&loaded_files, "%s/.config/"BP_NAME"/%s.bp", getenv("HOME"), flag);
if (f == NULL) if (f == NULL)
f = load_filef(&loaded_files, "/etc/xdg/"BP_NAME"/%s.bp", flag); f = load_filef(&loaded_files, "/etc/"BP_NAME"/%s.bp", flag);
if (f == NULL) if (f == NULL)
errx(EXIT_FAILURE, "Couldn't find grammar: %s", flag); errx(EXIT_FAILURE, "Couldn't find grammar: %s", flag);
defs = load_grammar(defs, f); // Keep in memory for debug output defs = load_grammar(defs, f); // Keep in memory for debug output