diff --git a/login.c b/login.c index dbc4974..7f235a9 100644 --- a/login.c +++ b/login.c @@ -121,6 +121,7 @@ int func_login(int argc, char *argv[], int mode) uint8 uname[200]; uint8 upasswd[200]; SEARCH_VECTOR save_drives; + int password_given = 0; if (argc > 1) { if (argv[1][0] == '-') { @@ -134,23 +135,26 @@ int func_login(int argc, char *argv[], int mode) remove_nwpathes(); if (argc > 1) strmaxcpy(uname, argv[1], sizeof(uname) -1); else uname[0]='\0'; - if (argc > 2) strmaxcpy(upasswd, argv[2], sizeof(upasswd) -1); - else upasswd[0]='\0'; + if (argc > 2) { + strmaxcpy(upasswd, argv[2], sizeof(upasswd) -1); + password_given = 1; + } else upasswd[0]='\0'; while (result) { if (!uname[0]) getstr("Login", uname, sizeof(uname)-1, 1); if (uname[0]) { upstr(uname); - upstr(upasswd); - if ((result = do_object_login(uname, 0x1, upasswd, option)) < 0 && !*upasswd) { + if (!password_given) { getstr("Password", upasswd, sizeof(upasswd)-1, 0); upstr(upasswd); - result = do_object_login(uname, 0x1, upasswd, option); - } + password_given = 1; + } else upstr(upasswd); + result = do_object_login(uname, 0x1, upasswd, option); if (result < 0) { fprintf(stdout, "Login incorrect\n\n"); uname[0] = '\0'; upasswd[0] = '\0'; + password_given = 0; } } else break; } @@ -391,17 +395,9 @@ int func_exec(int argc, char *argv[], int mode) xfree(buff); if (nargv != NULL) { if (!mode) -#ifdef __WATCOMC__ - spawnvp(P_WAIT, buf, (const char * const *)nargv); -#else spawnvp(P_WAIT, buf, nargv); -#endif else -#ifdef __WATCOMC__ - execvp(buf, (const char * const *)nargv); -#else execvp(buf, nargv); -#endif } xfree(buf); }