static char *sccsid
= "@(#)init.c 4.3 (Berkeley) %G%";
#define LINSIZ sizeof(wtmp.ut_line)
#define ALL p = &itab[0]; p < &itab[TABSIZ]; p++
#define SCPYN(a, b) strncpy(a, b, sizeof(a))
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
char shell
[] = "/bin/sh";
char getty
[] = "/etc/getty";
char ifile
[] = "/etc/ttys";
char utmp
[] = "/etc/utmp";
char wtmpf
[] = "/usr/adm/wtmp";
char ctty
[] = "/dev/console";
char *strcpy(), *strcat();
register int r11
; /* passed thru from boot */
signal(SIGSTOP
, SIG_IGN
);
signal(SIGTSTP
, SIG_IGN
);
signal(SIGTTIN
, SIG_IGN
);
signal(SIGTTOU
, SIG_IGN
);
if (setjmp(shutpass
) == 0)
if (oldhowto
& RB_SINGLE
)
if (runcom(oldhowto
) == 0)
close(creat(utmp
, 0644));
signal(SIGALRM
, shutreset
);
while(wait((int *)0) != -1)
char shutfailm
[] = "WARNING: Something is hung (wont die); ps axl advised\n";
write(ct
, shutfailm
, sizeof (shutfailm
));
signal(SIGALRM
, SIG_DFL
);
signal(SIGTERM
, SIG_DFL
);
signal(SIGALRM
, SIG_DFL
);
execl(shell
, minus
, (char *)0);
while(wait((int *)0) != pid
)
if (oldhowto
& RB_SINGLE
)
execl(shell
, shell
, runc
, (char *)0);
execl(shell
, shell
, runc
, "autoboot", (char *)0);
while(wait(&status
) != pid
)
SCPYN(wtmp
.ut_line
, "~");
SCPYN(wtmp
.ut_name
, "reboot");
write(f
, (char *)&wtmp
, sizeof(wtmp
));
signal(SIGHUP
, setmerge
);
signal(SIGHUP
, setmerge
);
if(p
->pid
== pid
|| p
->pid
== -1) {
for (i
=0; i
<LINSIZ
; i
++) {
strncat(tty
, line
.line
, LINSIZ
);
if (SCMPN(p
->line
, line
.line
))
if(line
.comn
!= p
->comn
) {
SCPYN(p
->line
, line
.line
);
p
->xflag
|= FOUND
|CHANGE
;
if((p
->xflag
&FOUND
) == 0) {
if((p
->xflag
&CHANGE
) != 0) {
signal(SIGTERM
, SIG_DFL
);
strncat(tty
, p
->line
, LINSIZ
);
execl(getty
, minus
, tty
, (char *)0);
while(read(f
, (char *)&wtmp
, sizeof(wtmp
)) == sizeof(wtmp
)) {
if (SCMPN(wtmp
.ut_line
, p
->line
))
lseek(f
, -(long)sizeof(wtmp
), 1);
write(f
, (char *)&wtmp
, sizeof(wtmp
));
SCPYN(wtmp
.ut_line
, p
->line
);
write(f
, (char *)&wtmp
, sizeof(wtmp
));