ref: 50791b875552b0dc5748aa67c95776736f6ff4b7
parent: e9e55a21f66a3eff114025dcb1fe62570d0fa3e6
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Mar 8 12:31:30 EDT 2020
add usage messages to auth/(enable disable status). print useful message when user invokes these commands incorrectly (thanks henesy)
--- a/sys/src/cmd/auth/disable
+++ b/sys/src/cmd/auth/disable
@@ -1,4 +1,10 @@
#!/bin/rc
+
+if(! ~ $#* 1){
+ echo 'usage: auth/disable user' >[1=2]
+ exit usage
+}
+
if(test -e /mnt/keys/$1)
echo -n disabled > /mnt/keys/$1/status
if(test -e /mnt/netkeys/$1)
--- a/sys/src/cmd/auth/enable
+++ b/sys/src/cmd/auth/enable
@@ -1,4 +1,10 @@
#!/bin/rc
+
+if(! ~ $#* 1){
+ echo 'usage: auth/enable user' >[1=2]
+ exit usage
+}
+
if(test -e /mnt/keys/$1)
echo -n ok > /mnt/keys/$1/status
if(test -e /mnt/netkeys/$1)
--- a/sys/src/cmd/auth/status
+++ b/sys/src/cmd/auth/status
@@ -1,4 +1,10 @@
#!/bin/rc
+
+if(! ~ $#* 1){
+ echo 'usage: auth/status user' >[1=2]
+ exit usage
+}
+
cd /mnt/keys/$1 > /dev/null >[2=1] && {
stat=`{cat status}
exp=`{cat expire}