memset((char *)&request, 0, sizeof(request));
memset((void *)&request, 0, sizeof(request));
startslave(host, autologin, autoname)	char *host;	int autologin;	char *autoname;{	register int i;#ifdef	NEWINIT	extern char *ptyip;	struct init_request request;	void nologinproc();	register int n;#endif	/* NEWINIT */#if	defined(AUTHENTICATION)	if (!autoname || !autoname[0])		autologin = 0;	if (autologin < auth_level) {		fatal(net, "Authorization failed");		exit(1);	}#endif#ifndef	NEWINIT# ifdef	PARENT_DOES_UTMP	utmp_sig_init();# endif	/* PARENT_DOES_UTMP */	if ((i = fork()) < 0)		fatalperror(net, "fork");	if (i) {# ifdef PARENT_DOES_UTMP		/*		 * Cray parent will create utmp entry for child and send		 * signal to child to tell when done.  Child waits for signal		 * before doing anything important.		 */		register int pid = i;		void sigjob P((int));		setpgrp();		utmp_sig_reset();		/* reset handler to default */		/*		 * Create utmp entry for child		 */		(void) time(&wtmp.ut_time);		wtmp.ut_type = LOGIN_PROCESS;		wtmp.ut_pid = pid;		SCPYN(wtmp.ut_user, "LOGIN");		SCPYN(wtmp.ut_host, host);		SCPYN(wtmp.ut_line, line + sizeof("/dev/") - 1);#ifndef	__hpux		SCPYN(wtmp.ut_id, wtmp.ut_line+3);#else		SCPYN(wtmp.ut_id, wtmp.ut_line+7);#endif		pututline(&wtmp);		endutent();		if ((i = open(wtmpf, O_WRONLY|O_APPEND)) >= 0) {			(void) write(i, (char *)&wtmp, sizeof(struct utmp));			(void) close(i);		}#ifdef	CRAY		(void) signal(WJSIGNAL, sigjob);#endif		utmp_sig_notify(pid);# endif	/* PARENT_DOES_UTMP */	} else {		getptyslave(autologin);		start_login(host, autologin, autoname);		/*NOTREACHED*/	}#else	/* NEWINIT */	/*	 * Init will start up login process if we ask nicely.  We only wait	 * for it to start up and begin normal telnet operation.	 */	if ((i = open(INIT_FIFO, O_WRONLY)) < 0) {		char tbuf[128];		(void) sprintf(tbuf, "Can't open %s\n", INIT_FIFO);		fatalperror(net, tbuf);	}	memset((char *)&request, 0, sizeof(request));	request.magic = INIT_MAGIC;	SCPYN(request.gen_id, gen_id);	SCPYN(request.tty_id, &line[8]);	SCPYN(request.host, host);	SCPYN(request.term_type, terminaltype ? terminaltype : "network");#if	!defined(UNICOS5)	request.signal = SIGCLD;	request.pid = getpid();#endif#ifdef BFTPDAEMON	/*	 * Are we working as the bftp daemon?	 */	if (bftpd) {		SCPYN(request.exec_name, BFTPPATH);	}#endif /* BFTPDAEMON */	if (write(i, (char *)&request, sizeof(request)) < 0) {		char tbuf[128];		(void) sprintf(tbuf, "Can't write to %s\n", INIT_FIFO);		fatalperror(net, tbuf);	}	(void) close(i);	(void) signal(SIGALRM, nologinproc);	for (i = 0; ; i++) {		char tbuf[128];		alarm(15);		n = read(pty, ptyip, BUFSIZ);		if (i == 3 || n >= 0 || !gotalarm)			break;		gotalarm = 0;		sprintf(tbuf, "telnetd: waiting for /etc/init to start login process on %s\r\n", line);		(void) write(net, tbuf, strlen(tbuf));	}	if (n < 0 && gotalarm)		fatal(net, "/etc/init didn't start login process");	pcc += n;	alarm(0);	(void) signal(SIGALRM, SIG_DFL);	return;#endif	/* NEWINIT */}