|
|
1.1 root 1: /* login.c - login */
2:
3: #include <conf.h>
4: #include <kernel.h>
5: #include <shell.h>
6: #include <tty.h>
7:
8: /*------------------------------------------------------------------------
9: * login - log user onto system
10: *------------------------------------------------------------------------
11: */
12: login(dev)
13: int dev;
14: {
15: int len;
16:
17: Shl.shused = FALSE;
18: Shl.shuser[0] = NULLCH;
19: for (getname(Shl.shmach) ; TRUE ; ) {
20: fprintf(dev,"\n\n%s - The magic of Xinu\n\nlogin: ",
21: Shl.shmach);
22: while ( (len=read(dev, Shl.shbuf, 128)) == 0 || len == 1 ||
23: Shl.shbuf[0] < BLANK)
24: fprintf(dev, "login: ");
25: if (len == EOF) {
26: read(dev, Shl.shbuf, 0);
27: Shl.shused = FALSE;
28: continue;
29: }
30: Shl.shbuf[len-1] = NULLCH;
31: strncpy(Shl.shuser, Shl.shbuf, SHNAMLEN-1);
32: Shl.shused = TRUE;
33: getutim(&Shl.shlogon);
34: mark(Shl.shmark);
35: fprintf(dev,"\n%s\n\n",
36: " Welcome to Xinu (type ? for help)" );
37: getutim(&Shl.shlast);
38: return(OK);
39: }
40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.