File:  [XINU] / xinu / sys / shell / login.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:39:04 2018 UTC (8 years, 2 months ago) by root
Branches: xinu, MAIN
CVS tags: xinu-19870308, HEAD
Xinu for VAX

/* login.c - login */

#include <conf.h>
#include <kernel.h>
#include <shell.h>
#include <tty.h>

/*------------------------------------------------------------------------
 *  login  -  log user onto system
 *------------------------------------------------------------------------
 */
login(dev)
int	dev;
{
	int	len;

	Shl.shused = FALSE;
	Shl.shuser[0] = NULLCH;
	for (getname(Shl.shmach) ; TRUE ; ) {
		fprintf(dev,"\n\n%s - The magic of Xinu\n\nlogin: ",
			Shl.shmach);
		while ( (len=read(dev, Shl.shbuf, 128)) == 0 || len == 1 ||
			 Shl.shbuf[0] < BLANK)
				fprintf(dev, "login: ");
		if (len == EOF) {
			read(dev, Shl.shbuf, 0);
			Shl.shused = FALSE;
			continue;
		}
		Shl.shbuf[len-1] = NULLCH;
		strncpy(Shl.shuser, Shl.shbuf, SHNAMLEN-1);
		Shl.shused = TRUE;
		getutim(&Shl.shlogon);
		mark(Shl.shmark);
		fprintf(dev,"\n%s\n\n",
		"      Welcome to Xinu (type ? for help)" );
		getutim(&Shl.shlast);
		return(OK);
	}
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.