14 int main(int argc, char *argv[])
16 char *sUsername, *sPassword;
21 printf("\x1B[?25h"); // Re-enable the cursor
22 // printf("\x1B[2J"); // Clear Screen
29 sUsername = GetUsername();
30 sPassword = GetPassword();
31 if( (uid = ValidateUser(sUsername, sPassword)) == -1 )
33 printf("\nInvalid username or password\n");
42 uinfo = GetUserInfo(uid);
43 struct s_sys_spawninfo spawninfo;
45 spawninfo.gid = uinfo->GID;
46 spawninfo.uid = uinfo->UID;
47 const char *child_argv[2] = {"-", 0};
48 const char **child_envp = NULL;
49 int fds[] = {0, 1, 2};
50 pid = _SysSpawn(uinfo->Shell, child_argv, child_envp, 3, fds, &spawninfo);
53 fprintf(stderr, "Unable to fork the login process!\n");
57 // Wait for child to terminate
58 _SysWaitTID(pid, &status);
65 * \fn char *GetUsername()
69 char ret[BUFLEN] = {0};
78 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
81 if( pos <= 0 ) continue;
88 // Echo out to the screen
92 if(pos == BUFLEN-1) break;
103 * \fn char *GetPassword()
112 printf("Password: ");
116 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
119 if( pos <= 0 ) continue;
126 // Don't echo out to the screen
129 if(pos == BUFLEN-1) break;