#define ALL p = &itab[0]; p < &itab[TABSIZ]; p++
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";
while(wait((int *)0) != -1)
signal(SIGALRM
, SIG_DFL
);
signal(SIGALRM
, SIG_DFL
);
execl(shell
, minus
, (char *)0);
while(wait((int *)0) != pid
)
execl(shell
, shell
, runc
, (char *)0);
while(wait((int *)0) != pid
)
if(p
->pid
== pid
|| p
->pid
== -1) {
register struct tab
*p
, *q
;
close(creat(utmp
, 0644));
if(p
->line
[i
] != line
.line
[i
])
q
->line
[i
] = line
.line
[i
];
for(; q
< &itab
[TABSIZ
]; q
++)
if(p
->line
[0] != 0 && p
->pid
== 0)
execl(getty
, minus
, tty
, (char *)0);
while(read(f
, (char *)&wtmp
, sizeof(wtmp
)) == sizeof(wtmp
)) {
if(wtmp
.ut_line
[i
] != p
->line
[i
])
lseek(f
, (long)-sizeof(wtmp
), 1);
write(f
, (char *)&wtmp
, sizeof(wtmp
));
wtmp
.ut_line
[i
] = p
->line
[i
];
write(f
, (char *)&wtmp
, sizeof(wtmp
));