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
.I user
] [
.B -h
] [
.IR user @] host
[
.I cmd

View file

@ -1129,7 +1129,7 @@ kfmt(Fmt *f)
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 @@ main(int argc, char *argv[])
case 'u':
user = EARGF(usage());
break;
case 'h':
host = EARGF(usage());
break;
case 't':
thumbfile = EARGF(usage());
break;
@ -1168,10 +1171,12 @@ main(int argc, char *argv[])
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){