Fix some compile-time warnings.
authorShantonu Sen <ssen@mit.edu>
Tue, 9 May 2000 06:09:05 +0000 (06:09 +0000)
committerShantonu Sen <ssen@mit.edu>
Tue, 9 May 2000 06:09:05 +0000 (06:09 +0000)
sbr/getpass.c
sbr/ruserpass.c

index 6a53b72..cca32f6 100644 (file)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $ID$
+ * $Id$
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
-#include <unistd.h>
 #include <termios.h>
 
 #define PASSWORD_LEN 128
 #include <termios.h>
 
 #define PASSWORD_LEN 128
 #define TCSANOW 0
 #endif
 
 #define TCSANOW 0
 #endif
 
-char *getpass(const char *prompt)
+char *
+getpass(char *prompt)
 {
   struct termios oterm, term;
 {
   struct termios oterm, term;
-  int ch;
-  char *p, *ttystring, buf[PASSWORD_LEN+1];
+  char ch;
+  char *p, *ttystring, *buf;
   FILE *fout, *fin;
 
   FILE *fout, *fin;
 
+  if(!(buf = (char *)calloc((size_t)(PASSWORD_LEN+1), sizeof(char))))
+    adios(NULL, "unable to allocate string storage");
+
   /* Find if stdin is connect to a terminal. If so, read directly from
    * the terminal, and turn off echo. Otherwise read from stdin.
    */
 
   /* Find if stdin is connect to a terminal. If so, read directly from
    * the terminal, and turn off echo. Otherwise read from stdin.
    */
 
-  if((ttystring = ttyname(fileno(stdin))) == NULL) {
+  if((ttystring = (char *)ttyname(fileno(stdin))) == NULL) {
     fout = stderr;
     fin = stdin;
   }
     fout = stderr;
     fin = stdin;
   }
@@ -80,5 +83,5 @@ char *getpass(const char *prompt)
     (void)fputc('\n', fout);
     (void)fclose(fin);
   }
     (void)fputc('\n', fout);
     (void)fclose(fin);
   }
-  return(buf);
+  return((char *)buf);
 }
 }
index 68809df..085d493 100644 (file)
@@ -162,7 +162,7 @@ done:
        char *mypass;
 
        snprintf(prompt, sizeof(prompt), "Password (%s:%s): ", host, *aname);
        char *mypass;
 
        snprintf(prompt, sizeof(prompt), "Password (%s:%s): ", host, *aname);
-       mypass = getpass (prompt);
+       mypass = (char *)getpass (prompt);
        
        if (*mypass == '\0') {
            mypass = *aname;
        
        if (*mypass == '\0') {
            mypass = *aname;