]> git.mdlowis.com Git - proto/albase.git/commitdiff
some minor cleanup for login.c
authorMike Lowis <mike.lowis@gentex.com>
Thu, 28 Apr 2016 15:16:45 +0000 (11:16 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Thu, 28 Apr 2016 15:16:45 +0000 (11:16 -0400)
source/login.c

index 7c5f0b632809a20d2d991bee664eb4b7878d38a9..78a96c6b97531ce90c10bde37e2d3f87291b8ead 100644 (file)
@@ -14,7 +14,6 @@
 char* ARGV0;
 static char* Hostname = NULL;
 static char* Username = NULL;
-static char* Password = NULL;
 static bool  PreserveEnv = false;
 
 static char* get_host(void) {
@@ -86,15 +85,9 @@ static struct passwd* check_pass(const char* user, char* pass) {
 int main(int argc, char** argv) {
     /* Parse command line options */
     OPTBEGIN {
-        case 'p':
-            PreserveEnv = true;
-            break;
-        case 'h':
-            Hostname = EOPTARG(die("no hostname provided"));
-            break;
-        case 'u':
-            Username = EOPTARG(die("no username provided"));
-            break;
+        case 'p': PreserveEnv = true;                              break;
+        case 'h': Hostname = EOPTARG(die("no hostname provided")); break;
+        case 'u': Username = EOPTARG(die("no username provided")); break;
         default:
             fprintf(stderr,"Usage: %s [-p] [-h host] [-u user]", ARGV0);
             exit(EXIT_FAILURE);
@@ -123,8 +116,7 @@ int main(int argc, char** argv) {
         check(chdir(pwentry->pw_dir), "chdir failed");
         execlp(shell, shell, "-l", NULL);
     }
-
-    /* Handle any unexpected errors that occurred */
+    /* Landing pad for check macro failures */
 error:
     return (errno == ENOENT) ? 127 : 126;
 }