ref: 917d5a3afac1decae21d2654d5ffe657c68eaf10
author: Julien Blanchard <[email protected]>
date: Fri Jun 5 14:58:47 EDT 2020
Initial script
--- /dev/null
+++ b/README.md
@@ -1,0 +1,22 @@
+# finge.rc
+
+A very basic finger server for plan9/9front.
+
+
+## Install and run
+
+Copy the script in $user/bin/rc.
+Run `aux/listen1 -tv tcp!*!79 /usr/$user/bin/rc/finge.rc &`
+
+
+## Usage
+
+Edit the script, adapt the values of nouser and scripts.
+nouser is the path of the .plan that will be rendered when your domain is queried.
+
+
+## Scripting
+
+If a rc script with the queried name is available in your scripts directory it will be rendered.
+For example if you add a hello.rc you can finger `hello@domain`.
+Note that usernames have precedence over scripts names.
--- /dev/null
+++ b/finge.rc
@@ -1,0 +1,30 @@
+#!/bin/rc
+
+nouser=/usr/glenda
+scripts=/usr/glenda/finger
+
+u=`{read | sed 's/ //g'}
+
+if(~ $"u ''){
+ p=$"nouser
+}
+if not {
+ p=/usr/^$"u
+}
+
+if(test -d $"p){
+ if(test -r $"p/.plan){
+ cat $"p/.plan
+ }
+ if not {
+ echo No plan.
+ }
+}
+if not {
+ if(test -x $"scripts/$"u.rc){
+ echo `{rc $"scripts/$"u.rc}
+ }
+ if not {
+ echo No such user.
+ }
+}
\ No newline at end of file