shithub: riscv

Download patch

ref: 74b6d9bda30b112c7d51bee2f549385de43bb930
parent: 7ade57b678f0799ab0598632403da11fd7271b05
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 5 17:04:31 EDT 2017

ssh: add -h flag to pass host (for compatibility)

--- a/sys/man/1/ssh
+++ b/sys/man/1/ssh
@@ -17,6 +17,8 @@
 .B -u
 .I user
 ] [
+.B -h
+] [
 .IR user @] host
 [
 .I cmd
--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -1129,7 +1129,7 @@
 void
 usage(void)
 {
-	fprint(2, "usage: %s [-dR] [-t thumbfile] [-T tries] [-u user] [user@]host [cmd args...]\n", argv0);
+	fprint(2, "usage: %s [-dR] [-t thumbfile] [-T tries] [-u user] [-h] [user@]host [cmd args...]\n", argv0);
 	exits("usage");
 }
 
@@ -1159,6 +1159,9 @@
 	case 'u':
 		user = EARGF(usage());
 		break;
+	case 'h':
+		host = EARGF(usage());
+		break;
 	case 't':
 		thumbfile = EARGF(usage());
 		break;
@@ -1168,10 +1171,12 @@
 		break;
 	} ARGEND;
 
-	if(argc == 0)
-		usage();
+	if(host == nil){
+		if(argc == 0)
+			usage();
+		host = *argv++;
+	}
 
-	host = *argv++;
 	if(user == nil){
 		s = strchr(host, '@');
 		if(s != nil){