From 489626c62efbcd016b949217159d92f4104a1479 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sun, 9 May 1999 11:43:44 +0000 Subject: [PATCH] (main): detect the case of no command given. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6176 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/rsh/rsh.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/appl/rsh/rsh.c b/appl/rsh/rsh.c index 84e614e0f..8223c22bd 100644 --- a/appl/rsh/rsh.c +++ b/appl/rsh/rsh.c @@ -416,6 +416,11 @@ proto (int s, int errsock, return loop (s, errsock2); } +/* + * Return in `res' a copy of the concatenation of `argc, argv' into + * malloced space. + */ + static size_t construct_command (char **res, int argc, char **argv) { @@ -625,7 +630,7 @@ usage (int ret) } /* - * main + * */ int @@ -690,6 +695,9 @@ main(int argc, char **argv) host = argv[host_index = optind++]; } + if (optind == argc) + errx (1, "no command given. Try rlogin if that's what you wanted."); + if (port_str) { struct servent *s = roken_getservbyname (port_str, "tcp");