X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Flogin_src%2Fmain.c;h=5ece35754a8f286c042882ce0fa6627a68644ebd;hb=cb908a64349e1e4623cbfe2a160788332eb0ce80;hp=cf58c1b29bc42aee24f755a6cb06fa2a50c72b15;hpb=cea789b7006552c5365744d4ebaddbdc96387355;p=tpg%2Facess2.git diff --git a/Usermode/Applications/login_src/main.c b/Usermode/Applications/login_src/main.c index cf58c1b2..5ece3575 100644 --- a/Usermode/Applications/login_src/main.c +++ b/Usermode/Applications/login_src/main.c @@ -17,10 +17,12 @@ int main(int argc, char *argv[]) int pid, uid = 0; int status = 0; tUserInfo *uinfo; - + + printf("\x1B[?25h"); // Re-enable the cursor + printf("\x1B[2J"); // Clear Screen + for(;;) { - printf("\x1B[2J"); // Clear Screen // Validate User for(;;) { @@ -28,7 +30,7 @@ int main(int argc, char *argv[]) sPassword = GetPassword(); if( (uid = ValidateUser(sUsername, sPassword)) == -1 ) { - printf("\nInvalid username or password for '%s'\n", sUsername); + printf("\nInvalid username or password\n"); free(sUsername); free(sPassword); } @@ -45,6 +47,8 @@ int main(int argc, char *argv[]) return -1; } + printf("pid = %i\n", pid); + // Spawn shell in a child process if(pid == 0) { @@ -87,7 +91,7 @@ char *GetUsername() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { - if( pos == 0 ) continue; + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; } @@ -123,7 +127,7 @@ char *GetPassword() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { - if( pos == 0 ) continue; + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; }