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};
77 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
80 if( pos <= 0 ) continue;
87 // Echo out to the screen
90 if(pos == BUFLEN-1) break;
101 * \fn char *GetPassword()
110 printf("Password: ");
113 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
116 if( pos <= 0 ) continue;
123 // Don't echo out to the screen
126 if(pos == BUFLEN-1) break;