aboutsummaryrefslogtreecommitdiffstats
path: root/bib-ls
diff options
context:
space:
mode:
Diffstat (limited to 'bib-ls')
-rwxr-xr-xbib-ls30
1 files changed, 30 insertions, 0 deletions
diff --git a/bib-ls b/bib-ls
new file mode 100755
index 0000000..0ed7236
--- /dev/null
+++ b/bib-ls
@@ -0,0 +1,30 @@
+#!/bin/sh
+# bib-ls - list the entries in a bibtex database
+#
+# usage: bib-ls [-l] [file ...] (stdin if no file given)
+# -l long format: key, type, author, year, title (tab-separated)
+
+usage() {
+ printf 'usage: bib-ls [-l] [file ...]\n' >&2
+ exit 2
+}
+
+if [ -n "$BIBUTILS_LIB" ]; then
+ LIB=$BIBUTILS_LIB
+elif [ -d "$(dirname "$0")/lib" ]; then
+ LIB=$(dirname "$0")/lib
+else
+ LIB=/usr/local/share/bibutils
+fi
+
+long=0
+while getopts l opt; do
+ case $opt in
+ l) long=1 ;;
+ *) usage ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+exec awk -f "$LIB/bib-parse.awk" -f "$LIB/bib-canon.awk" \
+ -f "$LIB/bib-ls.awk" -v long="$long" "$@"