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

This commit is contained in:
cinap_lenrek 2017-05-05 21:04:31 +02:00
parent 7ade57b678
commit 74b6d9bda3
2 changed files with 11 additions and 4 deletions

View file

@ -17,6 +17,8 @@ ssh - secure shell remote login client
.B -u .B -u
.I user .I user
] [ ] [
.B -h
] [
.IR user @] host .IR user @] host
[ [
.I cmd .I cmd

View file

@ -1129,7 +1129,7 @@ kfmt(Fmt *f)
void void
usage(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"); exits("usage");
} }
@ -1159,6 +1159,9 @@ main(int argc, char *argv[])
case 'u': case 'u':
user = EARGF(usage()); user = EARGF(usage());
break; break;
case 'h':
host = EARGF(usage());
break;
case 't': case 't':
thumbfile = EARGF(usage()); thumbfile = EARGF(usage());
break; break;
@ -1168,10 +1171,12 @@ main(int argc, char *argv[])
break; break;
} ARGEND; } ARGEND;
if(host == nil){
if(argc == 0) if(argc == 0)
usage(); usage();
host = *argv++; host = *argv++;
}
if(user == nil){ if(user == nil){
s = strchr(host, '@'); s = strchr(host, '@');
if(s != nil){ if(s != nil){