date and time created 83/02/11 15:45:06 by rrh
[unix-history] / usr / src / usr.bin / rsh / rsh.c
index f650cdf..4e45f15 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)rsh.c      4.4 83/01/13";
+static char sccsid[] = "@(#)rsh.c      4.6 83/02/09";
 #endif
 
 #include <sys/types.h>
 #endif
 
 #include <sys/types.h>
@@ -53,23 +53,31 @@ main(argc, argv0)
                asrsh = 1;
        }
 another:
                asrsh = 1;
        }
 another:
-       if (!strcmp(*argv, "-l")) {
+       if (argc > 0 && !strcmp(*argv, "-l")) {
                argv++, argc--;
                if (argc > 0)
                        user = *argv++, argc--;
                goto another;
        }
                argv++, argc--;
                if (argc > 0)
                        user = *argv++, argc--;
                goto another;
        }
-       if (!strcmp(*argv, "-n")) {
+       if (argc > 0 && !strcmp(*argv, "-n")) {
                argv++, argc--;
                (void) close(0);
                (void) open("/dev/null", 0);
                goto another;
        }
                argv++, argc--;
                (void) close(0);
                (void) open("/dev/null", 0);
                goto another;
        }
-       if (!strcmp(*argv, "-d")) {
+       if (argc > 0 && !strcmp(*argv, "-d")) {
                argv++, argc--;
                options |= SO_DEBUG;
                goto another;
        }
                argv++, argc--;
                options |= SO_DEBUG;
                goto another;
        }
+       /*
+        * Ignore the -e flag to allow aliases with rlogin
+        * to work
+        */
+       if (argc > 0 && !strncmp(*argv, "-e", 2)) {
+               argv++, argc--;
+               goto another;
+       }
        if (host == 0)
                goto usage;
        if (argv[0] == 0) {
        if (host == 0)
                goto usage;
        if (argv[0] == 0) {