shithub: x

Download patch

ref: 4e4d42527e53302bc897d299d0efa40b91b6a7ce
parent: 267ce690411b7d536cef42ccdc96220ea800ad06
author: kvik <kvik@a-b.xyz>
date: Sun Jun 23 06:22:39 EDT 2019

x/mnt: mount the system suggested by path if given no args 


--- a/mnt
+++ b/mnt
@@ -3,14 +3,14 @@
 rfork e
 
 fn usage {
-	echo usage: x/mnt [user@]host >[1=2]
+	echo usage: x/mnt [[user@]host] >[1=2]
 	exit usage
 }
 
 users=(root $user)
-if(! ~ $#* 1)
-	usage
 host=$1
+if(~ $host '')
+	host=`{x/path -l}
 if(~ $host *@*){
 	x=`'@'{echo -n $host}
 	users=$x(1)
--- a/x.man
+++ b/x.man
@@ -4,7 +4,11 @@
 .SH SYNOPSIS
 .PP
 .B x/mnt
-.I [user@]host
+[ [
+.I user@
+]
+.I host
+]
 .PP
 .B x/run
 .RB [ -l ]
@@ -66,6 +70,12 @@
 .B x/mnt
 tries the mount as both the invoking user and as
 .I root.
+If both the
+.I user
+and
+.I host
+are missing, it attempts to mount the system suggested by the
+current working directory.
 
 .PP
 .B x/run