login.c,v

来自「关于SHELL方面的」· C,V 代码 · 共 71 行

C,V
71
字号
head	1.1;access;symbols;locks	dls:1.1; strict;comment	@ * @;1.1date	97.09.21.19.29.03;	author dls;	state Dist;branches;next	;desc@@1.1log@pre-3e code@text@/* login.c - login */#include <conf.h>#include <kernel.h>#include <shell.h>#include <network.h>#include <tty.h>/*------------------------------------------------------------------------ *  login  -  log user onto system *------------------------------------------------------------------------ */login(dev)int	dev;{	int	i, len, uid;	Shl.shused = FALSE;	Shl.shuser[0] = NULLCH;	getname(Shl.shmach);	while (TRUE) {		fprintf(dev,"\n\n%s - The magic of Xinu\n\nlogin: ",			Shl.shmach);		while ( (len=read(dev,Shl.shbuf,SHBUFLEN))==0 || len==1)			fprintf(dev, "login: ");		if (len == EOF) {			read(dev, Shl.shbuf, 0);			Shl.shused = FALSE;			continue;		}		Shl.shbuf[len-1] = NULLCH;		uid = getuid(Shl.shbuf);		if (uid < 0)			continue;		control(dev, TTC_SUSER, uid);		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);	}}@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?