/*
- * Copyright (c) 1980 Regents of the University of California.
+ * Copyright (c) 1980,1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef lint
-static char sccsid[] = "@(#)init.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.10 (Berkeley) %G%";
#endif not lint
#include <signal.h>
#include <errno.h>
#include <sys/file.h>
#include <ttyent.h>
-#include <syslog.h>
+#include <sys/syslog.h>
#include <sys/stat.h>
#define LINSIZ sizeof(wtmp.ut_line)
-#define CMDSIZ 70 /* max string length for getty or window command*/
+#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
#define SCPYN(a, b) strncpy(a, b, sizeof(a))
struct sigvec rvec = { reset, sigmask(SIGHUP), 0 };
-#ifdef vax
+#if defined(vax) || defined(tahoe)
main()
{
+#if defined(tahoe)
+ register int r12; /* make sure r11 gets bootflags */
+#endif
register int r11; /* passed thru from boot */
#else
main(argc, argv)
int howto, oldhowto;
time0 = time(0);
-#ifdef vax
+#if defined(vax) || defined(tahoe)
howto = r11;
#else
if (argc > 1 && argv[1][0] == '-') {
howto = RB_SINGLE;
}
#endif
- openlog("init", LOG_CONS|LOG_ODELAY, 0);
+ openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH);
sigvec(SIGTERM, &rvec, (struct sigvec *)0);
signal(SIGTSTP, idle);
signal(SIGSTOP, SIG_IGN);
}
itab = (struct tab *)0;
signal(SIGALRM, shutreset);
+ (void) kill(-1, SIGTERM); /* one chance to catch it */
+ sleep(5);
alarm(30);
for (i = 0; i < 5; i++)
kill(-1, SIGKILL);
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()
{
dup2(0, 1);
dup2(0, 2);
execl(shell, minus, (char *)0);
+ perror(shell);
exit(0);
}
while ((xpid = wait((int *)0)) != pid)
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)
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);
}
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);
}
kill(p->wpid, SIGHUP);
}
-#include <sys/ioctl.h>
-
dfork(p)
struct tab *p;
{
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, "");