Release bumped to "gts4".
[tac_plus.git] / generate_passwd.c
index 509e48a..a21098d 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    Copyright (c) 1995-1998 by Cisco systems, Inc.
 
    Permission to use, copy, modify, and distribute this software for
    FITNESS FOR A PARTICULAR PURPOSE.
 */
 
-/* Program to des encrypt a password like Unix 
-   It prompts for the password to encrypt. 
+/* Program to des encrypt a password like Unix
+   It prompts for the password to encrypt.
    You can optionally supply a salt to verify a password.
    Usage: a.out [salt]
 */
 
-#define NULL 0
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+/* Stolen from pbmplus.h of netpbm: */
+
+#if __STDC__
+#define TAC_ARGS(alist) alist
+#else /*__STDC__*/
+#define TAC_ARGS(alist) ()
+#endif /*__STDC__*/
+
+
+int main TAC_ARGS((int argc, char **argv));
+
+int
 main(argc, argv)
+int argc;
 char **argv;
 {
-    char *crypt();
     char pass[25], *salt, buf[24];
     char *result;
     int n;
@@ -42,10 +71,10 @@ char **argv;
 
     write(1, prompt, strlen(prompt));
     n = read(0, pass, sizeof(pass));
-    pass[n-1] = NULL;
+    pass[n-1] = 0;
 
     if (!salt) {
-       int i, r, r1, r2;
+       int i, r, r1 = 0 /* GCC paranoia */, r2 = 0 /* GCC paranoia */;
 
        srand(time(0));
 
@@ -61,7 +90,7 @@ char **argv;
            if (r > 57 && r < 65)
                r += 7;
 
-           if (r > 90 && r < 97) 
+           if (r > 90 && r < 97)
                r += 6;
 
            if (r > 122)
@@ -82,9 +111,6 @@ char **argv;
 
     write(1, result, strlen(result));
     write(1, "\n", 1);
-}
-
-
-
-
 
+    return (EXIT_SUCCESS);
+}