summaryrefslogtreecommitdiff
path: root/urnresolve
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2021-04-29 21:31:38 +0000
committerepoch <epoch@enzo.thebackupbox.net>2021-04-29 21:31:38 +0000
commit53e28c310e9612dcb6e745f74f3ead44a8ade457 (patch)
tree622bbebc3eb1414b5a0ed9e4275cf18703e78a18 /urnresolve
parent6cbe81286312453a49d242189654274cfebbcef5 (diff)
downloaduritools-53e28c310e9612dcb6e745f74f3ead44a8ade457.tar.gz
uritools-53e28c310e9612dcb6e745f74f3ead44a8ade457.zip
added QR code option to copy_start_nevermind.sh, Makefile now includes urnresolve.
Diffstat (limited to 'urnresolve')
-rwxr-xr-xurnresolve35
1 files changed, 35 insertions, 0 deletions
diff --git a/urnresolve b/urnresolve
new file mode 100755
index 0000000..864859b
--- /dev/null
+++ b/urnresolve
@@ -0,0 +1,35 @@
+#!/bin/sh
+echo "urnstart: working on:" "$1" >&2
+urn="$(printf '%s\n' "$1" | cut -d: -f1)"
+if [ "$urn" != "urn" ];then
+ echo "this isn't a urn. wtf are you waking me up for? I'm going back to bed. fuck this shit." >&2
+ exit 1
+fi
+
+nid="$(printf '%s\n' "$1" | cut -d: -f2)"
+nss="$(printf '%s\n' "$1" | cut -d: -f3)"
+nss2="$(printf '%s\n' "$1" | cut -d: -f4-)"
+
+if [ "$nid" = "anonet" ];then
+ if [ "$nss" = "asn" ];then
+ echo "whois://whois.ano/AS${nss2}"
+ elif [ "$nss" = "ip4" -o "$nss" = "ip6" -o "$nss" = "dom" ];then
+ echo "whois://whois.ano/${nss2}"
+ fi
+fi
+
+if [ "$nid" = "ietf" ];then
+ if [ "$nss" = "rfc" ];then
+ echo gopher://thebackupbox.net:70/0/rfc/rfc${nss2}.txt
+ fi
+fi
+
+if [ "$nid" = "xkcd" ];then
+ echo "https://xkcd.com/${nss}"
+fi
+
+if [ "$nid" = "fcc" ];then
+ if [ "$nss" = "frs" ];then
+ grep "^$nss2\s" $PREFIX/share/urn/fcc:frs | cut -f2
+ fi
+fi