from sun
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 10 Feb 1983 09:06:06 +0000 (01:06 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 10 Feb 1983 09:06:06 +0000 (01:06 -0800)
SCCS-vsn: usr.bin/netstat/main.c 4.5
SCCS-vsn: usr.bin/rlogin/rlogin.c 4.9
SCCS-vsn: usr.bin/rsh/rsh.c 4.6

usr/src/usr.bin/netstat/main.c
usr/src/usr.bin/rlogin/rlogin.c
usr/src/usr.bin/rsh/rsh.c

index 731ab6d..89ccb30 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)main.c     4.4 82/12/24";
+static char sccsid[] = "@(#)main.c     4.5 83/02/09";
 #endif
 
 #include <sys/param.h>
 #endif
 
 #include <sys/param.h>
@@ -226,8 +226,10 @@ klseek(fd, base, off)
 
        if (kflag) {
                /* get kernel pte */
 
        if (kflag) {
                /* get kernel pte */
+#ifdef vax
                base &= 0x7fffffff;
                base &= 0x7fffffff;
-               base = Sysmap[base >> 9].pg_pfnum * 512 + (base & 0x1ff);
+#endif
+               base = ctob(Sysmap[btoc(base)].pg_pfnum) + (base & (NBPG-1));
        }
        lseek(fd, base, off);
 }
        }
        lseek(fd, base, off);
 }
index f951bf6..588527a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)rlogin.c   4.8 83/01/18";
+static char sccsid[] = "@(#)rlogin.c   4.9 83/02/09";
 #endif
 
 #include <sys/types.h>
 #endif
 
 #include <sys/types.h>
@@ -49,24 +49,24 @@ main(argc, argv)
        if (!strcmp(host, "rlogin"))
                host = *argv++, --argc;
 another:
        if (!strcmp(host, "rlogin"))
                host = *argv++, --argc;
 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;
        }
-       if (!strcmp(*argv, "-l")) {
+       if (argc > 0 && !strcmp(*argv, "-l")) {
                argv++, argc--;
                if (argc == 0)
                        goto usage;
                name = *argv++; argc--;
                goto another;
        }
                argv++, argc--;
                if (argc == 0)
                        goto usage;
                name = *argv++; argc--;
                goto another;
        }
-       if (!strncmp(*argv, "-e", 2)) {
+       if (argc > 0 && !strncmp(*argv, "-e", 2)) {
                cmdchar = argv[0][2];
                argv++, argc--;
                goto another;
        }
                cmdchar = argv[0][2];
                argv++, argc--;
                goto another;
        }
-       if (!strcmp(*argv, "-8")) {
+       if (argc > 0 && !strcmp(*argv, "-8")) {
                eight = 1;
                argv++, argc--;
                goto another;
                eight = 1;
                argv++, argc--;
                goto another;
@@ -243,17 +243,17 @@ top:
 
 oob()
 {
 
 oob()
 {
-       int out = 1+1;
+       int out = 1+1, atmark;
        char waste[BUFSIZ], mark;
 
        signal(SIGURG, oob);
        ioctl(1, TIOCFLUSH, (char *)&out);
        for (;;) {
        char waste[BUFSIZ], mark;
 
        signal(SIGURG, oob);
        ioctl(1, TIOCFLUSH, (char *)&out);
        for (;;) {
-               if (ioctl(rem, SIOCATMARK, &mark) < 0) {
+               if (ioctl(rem, SIOCATMARK, &atmark) < 0) {
                        perror("ioctl");
                        break;
                }
                        perror("ioctl");
                        break;
                }
-               if (mark)
+               if (atmark)
                        break;
                (void) read(rem, waste, sizeof (waste));
        }
                        break;
                (void) read(rem, waste, sizeof (waste));
        }
index dfe1981..4e45f15 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)rsh.c      4.5 83/01/30";
+static char sccsid[] = "@(#)rsh.c      4.6 83/02/09";
 #endif
 
 #include <sys/types.h>
 #endif
 
 #include <sys/types.h>
@@ -53,19 +53,19 @@ 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;
@@ -74,7 +74,7 @@ another:
         * Ignore the -e flag to allow aliases with rlogin
         * to work
         */
         * Ignore the -e flag to allow aliases with rlogin
         * to work
         */
-       if (!strncmp(*argv, "-e", 2)) {
+       if (argc > 0 && !strncmp(*argv, "-e", 2)) {
                argv++, argc--;
                goto another;
        }
                argv++, argc--;
                goto another;
        }