summaryrefslogtreecommitdiff
path: root/bin/hlp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-01-06 21:25:11 +0100
committerJohn Ankarström <john@ankarstrom.se>2021-01-06 21:25:48 +0100
commit914a3d9eb768bce9a978d6e9a7f833288c3dea0e (patch)
tree6c1c96d3d4b97d72f1a21256a59a80915e1b72b7 /bin/hlp
parentc01c37b8fc619346edcf885498e1083177d61ff0 (diff)
downloadef-914a3d9eb768bce9a978d6e9a7f833288c3dea0e.tar.gz
Add `r' (line range) selector, `absln' (absolute line) helper
Diffstat (limited to 'bin/hlp')
-rwxr-xr-xbin/hlp/absln17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/hlp/absln b/bin/hlp/absln
new file mode 100755
index 0000000..be195a9
--- /dev/null
+++ b/bin/hlp/absln
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# absln -- convert to absolute line
+
+test $# -ne 1 && { echo "usage: $0 line" 1>&2; exit 1; }
+case "$1" in
+'+'*)
+ test -z "${1#+}" && term=1 || term=${1#+}
+ expr `cat $EFP/line` + $term ;;
+'-'*)
+ test -z "${1#-}" && term=1 || term=${1#-}
+ expr `cat $EFP/line` - $term ;;
+.)
+ cat $EFP/line ;;
+*)
+ echo "$1" ;;
+esac