declare merege() externally, ANSI C fix
[unix-history] / usr / src / sbin / init / init.c
index b57b3b6..8765e27 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)init.c     5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c     5.10 (Berkeley) %G%";
 #endif not lint
 
 #include <signal.h>
 #endif not lint
 
 #include <signal.h>
@@ -63,9 +63,12 @@ long lseek();
 struct sigvec rvec = { reset, sigmask(SIGHUP), 0 };
 
 
 struct sigvec rvec = { reset, sigmask(SIGHUP), 0 };
 
 
-#ifdef vax
+#if defined(vax) || defined(tahoe)
 main()
 {
 main()
 {
+#if defined(tahoe)
+       register int r12;               /* make sure r11 gets bootflags */
+#endif
        register int r11;               /* passed thru from boot */
 #else
 main(argc, argv)
        register int r11;               /* passed thru from boot */
 #else
 main(argc, argv)
@@ -75,7 +78,7 @@ main(argc, argv)
        int howto, oldhowto;
 
        time0 = time(0);
        int howto, oldhowto;
 
        time0 = time(0);
-#ifdef vax
+#if defined(vax) || defined(tahoe)
        howto = r11;
 #else
        if (argc > 1 && argv[1][0] == '-') {
        howto = r11;
 #else
        if (argc > 1 && argv[1][0] == '-') {
@@ -144,7 +147,7 @@ shutdown()
        shutend();
 }
 
        shutend();
 }
 
-char shutfailm[] = "WARNING: Something is hung (wont die); ps axl advised\n";
+char shutfailm[] = "WARNING: Something is hung (won't die); ps axl advised\n";
 
 shutreset()
 {
 
 shutreset()
 {
@@ -198,6 +201,7 @@ single()
                        dup2(0, 1);
                        dup2(0, 2);
                        execl(shell, minus, (char *)0);
                        dup2(0, 1);
                        dup2(0, 2);
                        execl(shell, minus, (char *)0);
+                       perror(shell);
                        exit(0);
                }
                while ((xpid = wait((int *)0)) != pid)
                        exit(0);
                }
                while ((xpid = wait((int *)0)) != pid)
@@ -260,7 +264,7 @@ multiple()
                pid = wait((int *)0);
                if (pid == -1)
                        return;
                pid = wait((int *)0);
                if (pid == -1)
                        return;
-               omask = sigblock(SIGHUP);
+               omask = sigblock(sigmask(SIGHUP));
                for (ALL) {
                        /* must restart window system BEFORE emulator */
                        if (p->wpid == pid || p->wpid == -1)
                for (ALL) {
                        /* must restart window system BEFORE emulator */
                        if (p->wpid == pid || p->wpid == -1)
@@ -306,7 +310,7 @@ merge()
                                p->xflag |= CHANGE;
                                SCPYN(p->comn, t->ty_getty);
                        }
                                p->xflag |= CHANGE;
                                SCPYN(p->comn, t->ty_getty);
                        }
-                       if (SCMPN(p->wcmd, t->ty_window)) {
+                       if (SCMPN(p->wcmd, t->ty_window ? t->ty_window : "")) {
                                p->xflag |= WCHANGE|CHANGE;
                                SCPYN(p->wcmd, t->ty_window);
                        }
                                p->xflag |= WCHANGE|CHANGE;
                                SCPYN(p->wcmd, t->ty_window);
                        }
@@ -335,7 +339,7 @@ merge()
                SCPYN(p->line, t->ty_name);
                p->xflag |= FOUND|CHANGE;
                SCPYN(p->comn, t->ty_getty);
                SCPYN(p->line, t->ty_name);
                p->xflag |= FOUND|CHANGE;
                SCPYN(p->comn, t->ty_getty);
-               if (strcmp(t->ty_window, "") != 0) {
+               if (t->ty_window && strcmp(t->ty_window, "") != 0) {
                        p->xflag |= WCHANGE;
                        SCPYN(p->wcmd, t->ty_window);
                }
                        p->xflag |= WCHANGE;
                        SCPYN(p->wcmd, t->ty_window);
                }
@@ -383,8 +387,6 @@ term(p)
                kill(p->wpid, SIGHUP);
 }
 
                kill(p->wpid, SIGHUP);
 }
 
-#include <sys/ioctl.h>
-
 dfork(p)
        struct tab *p;
 {
 dfork(p)
        struct tab *p;
 {
@@ -448,8 +450,8 @@ rmut(p)
                        nutmp = read(f, utmp, statbf.st_size);
                        nutmp /= sizeof(struct utmp);
                        for (u = utmp ; u < &utmp[nutmp] ; u++) {
                        nutmp = read(f, utmp, statbf.st_size);
                        nutmp /= sizeof(struct utmp);
                        for (u = utmp ; u < &utmp[nutmp] ; u++) {
-                               if (SCMPN(u->ut_line, p->line) ||
-                                   u->ut_name[0]==0)
+                               if (u->ut_name[0] == 0 ||
+                                   SCMPN(u->ut_line, p->line))
                                        continue;
                                lseek(f, ((long)u)-((long)utmp), L_SET);
                                SCPYN(u->ut_name, "");
                                        continue;
                                lseek(f, ((long)u)-((long)utmp), L_SET);
                                SCPYN(u->ut_name, "");