(main): add fallback to rlogin

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6209 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1999-05-11 19:01:39 +00:00
parent 6e29c62c4f
commit 0b971e1c5d

View File

@@ -672,7 +672,7 @@ usage (int ret)
arg_printusage (args, arg_printusage (args,
sizeof(args) / sizeof(args[0]), sizeof(args) / sizeof(args[0]),
NULL, NULL,
"host command"); "host [command]");
exit (ret); exit (ret);
} }
@@ -736,14 +736,17 @@ main(int argc, char **argv)
} }
if (host == NULL) { if (host == NULL) {
if (argc - optind < 2) if (argc - optind < 1)
usage (1); usage (1);
else else
host = argv[host_index = optind++]; host = argv[host_index = optind++];
} }
if (optind == argc) if (optind == argc) {
errx (1, "no command given. Try rlogin if that's what you wanted."); argv[0] = "rlogin";
execvp ("rlogin", argv);
err (1, "execvp rlogin");
}
if (port_str) { if (port_str) {
struct servent *s = roken_getservbyname (port_str, "tcp"); struct servent *s = roken_getservbyname (port_str, "tcp");