Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!ames!oliveb!sun!gorodish!guy
From: guy%gorodish@Sun.COM (Guy Harris)
Newsgroups: comp.bugs.4bsd
Subject: "rlogin" doesn't accept the normal UNIX command syntax
Message-ID: <11388@sun.uucp>
Date: Wed, 14-Jan-87 00:54:09 EST
Article-I.D.: sun.11388
Posted: Wed Jan 14 00:54:09 1987
Date-Received: Wed, 14-Jan-87 19:49:31 EST
Sender: news@sun.uucp
Lines: 80

Index:	ucb/rlogin.c 4.3BSD

Description:
	"rlogin" does NOT permit you to say "rlogin -l  ";
	it REQUIRES you to put the  immediately after the command.
	name.  This is presumably a consequence of the code that causes
	"rlogin" to act as "rlogin host" when invoked as "host"; this
	is not, however, an excuse for this kind of behavior on its part.
Repeat-By:
	Try assuming that "rlogin" is a normal UNIX command with the normal
	UNIX command syntax, and get unpleasantly surprised.
Fix:
	Here's some changes to make it accept the 
	"rlogin -l  " syntax as well as the
	"rlogin  -l " and the " -l " syntax:

*** /arch/4.3/usr/src/ucb/rlogin.c	Sun Mar 30 16:39:06 1986
--- rlogin.c	Tue Jan 13 21:47:28 1987
***************
*** 82,89 ****
  	else
  		host = argv[0];
  	argv++, --argc;
! 	if (!strcmp(host, "rlogin"))
! 		host = *argv++, --argc;
  another:
  	if (argc > 0 && !strcmp(*argv, "-d")) {
  		argv++, argc--;
--- 82,93 ----
  	else
  		host = argv[0];
  	argv++, --argc;
! 	if (strcmp(host, "rlogin") == 0) {
! 		if (*argv[0] != '-')
! 			host = *argv++, --argc;
! 		else
! 			host = 0;
! 	}
  another:
  	if (argc > 0 && !strcmp(*argv, "-d")) {
  		argv++, argc--;
***************
*** 112,119 ****
  		argv++, argc--;
  		goto another;
  	}
! 	if (host == 0)
! 		goto usage;
  	if (argc > 0)
  		goto usage;
  	pwd = getpwuid(getuid());
--- 116,126 ----
  		argv++, argc--;
  		goto another;
  	}
! 	if (host == 0) {
! 		if (argc == 0)
! 			goto usage;
!  		host = *argv++, --argc;
! 	}
  	if (argc > 0)
  		goto usage;
  	pwd = getpwuid(getuid());
***************
*** 157,163 ****
  	/*NOTREACHED*/
  usage:
  	fprintf(stderr,
! 	    "usage: rlogin host [ -ex ] [ -l username ] [ -8 ] [ -L ]\n");
  	exit(1);
  }
  
--- 164,170 ----
  	/*NOTREACHED*/
  usage:
  	fprintf(stderr,
! 	    "usage: rlogin [ -ex ] [ -l username ] [ -8 ] [ -L ] host\n");
  	exit(1);
  }