From ca4449cf8c20628a4cb2c9e1d5f5e11666e51838 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Thu, 27 May 1999 12:58:41 +0000 Subject: [PATCH] Fixed usage message to almost match the man page. The old -d option and the new -i option were missing. Fixed style bugs in previous commit: (1) initialisation of a local variable in its declaration. (2) inconsistency of (1) with style of nearby code. (3) disorder of declaration for (1). (4) a line longer than 80 characters. (5) bitrot in the printf() -> err() cleanups to help bloat the line in (4). --- usr.bin/rlogin/rlogin.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index 1af423dd4f95..fd8793b41263 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -40,7 +40,7 @@ static const char copyright[] = #ifndef lint static const char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93"; static const char rcsid[] = - "$Id: rlogin.c,v 1.18 1998/10/09 06:45:28 markm Exp $"; + "$Id: rlogin.c,v 1.19 1999/05/25 11:14:33 peter Exp $"; #endif /* not lint */ /* @@ -150,15 +150,14 @@ main(argc, argv) struct sgttyb ttyb; long omask; int argoff, ch, dflag, Dflag, one, uid; - char *host, *p, *user, term[1024]; + char *host, *localname, *p, *user, term[1024]; #ifdef KERBEROS char *k; #endif - char *localname = NULL; argoff = dflag = Dflag = 0; one = 1; - host = user = NULL; + host = localname = user = NULL; if ((p = rindex(argv[0], '/'))) ++p; @@ -206,10 +205,8 @@ main(argc, argv) escapechar = getescape(optarg); break; case 'i': - if (getuid() != 0) { - fprintf(stderr, "rlogin: -i user: permission denied\n"); - exit(1); - } + if (getuid() != 0) + errx(1, "-i user: permission denied"); localname = optarg; break; #ifdef KERBEROS @@ -869,15 +866,15 @@ void usage() { (void)fprintf(stderr, - "usage: rlogin [ -%s]%s[-e char] [ -l username ] host\n", + "usage: rlogin [-%s]%s[-e char] [-i localname] [-l username] host\n", #ifdef KERBEROS #ifdef CRYPT - "8DEKLx", " [-k realm] "); + "8DEKLdx", " [-k realm] "); #else - "8DEKL", " [-k realm] "); + "8DEKLd", " [-k realm] "); #endif #else - "8DEL", " "); + "8DELd", " "); #endif exit(1); }