diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-12-03 05:45:04 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-12-03 05:45:04 +0100 |
commit | b6d863a4fd9e39d57ad3e8bf4e977c9b0997c355 (patch) | |
tree | e128bd974a54ebc11d69d429f9a4eccb6c6580b7 | |
parent | whitespace (diff) | |
download | librarian-b6d863a4fd9e39d57ad3e8bf4e977c9b0997c355.tar.gz librarian-b6d863a4fd9e39d57ad3e8bf4e977c9b0997c355.tar.bz2 librarian-b6d863a4fd9e39d57ad3e8bf4e977c9b0997c355.tar.xz |
get LIBRARIAN_PATH
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | src/librarian.c | 15 |
2 files changed, 19 insertions, 1 deletions
@@ -17,6 +17,9 @@ LICENSEDIR = $(DATADIR)/licenses PKGNAME = librarian COMMAND = librarian +# Default value for the environment variable LIBRARIAN_PATH. +LIBRARIAN_PATH = /usr/local/share/librarian:/usr/share/librarian + OPTIMISE = -Og -g WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \ @@ -30,7 +33,7 @@ WARN = -Wall -Wextra -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include -Wsuggest-attribute=pure -Wsuggest-attribute=format -Wnormalized=nfkc -pedantic #OPTIMISE = -O2 #WARN = -Wall -Wextra -pedantic -FLAGS = -std=c99 $(WARN) $(OPTIMISE) +FLAGS = -std=c99 $(WARN) $(OPTIMISE) -D'DEFAULT_PATH="$(LIBRARIAN_PATH)"' diff --git a/src/librarian.c b/src/librarian.c index f0441fb..99142a3 100644 --- a/src/librarian.c +++ b/src/librarian.c @@ -32,6 +32,15 @@ /** + * Default value for the environment variable LIBRARIAN_PATH. + */ +#ifndef DEFAULT_PATH +# define DEFAULT_PATH "/usr/local/share/librarian:/usr/share/librarian" +#endif + + + +/** * The name of the process. */ static const char *argv0; @@ -272,6 +281,7 @@ int main(int argc, char *argv[]) char **variables_last = argv; struct library *libraries = NULL; struct library *libraries_last; + const char *path; /* Parse arguments. */ argv0 = argv ? (argc--, *argv++) : "pp"; @@ -312,6 +322,11 @@ int main(int argc, char *argv[]) goto usage; } + /* Get LIBRARIAN_PATH. */ + path = getenv("LIBRARIAN_PATH"); + if (!path || !*path) + path = DEFAULT_PATH + CLEANUP; return 0; |