]> sjero.net Git - wget/blobdiff - src/netrc.c
[svn] Move extern declarations to .h files.
[wget] / src / netrc.c
index 4d97ff19c1f3a55bdafe437f37daa8ce361bbdb6..6e9611de3be9e6d0bed32219fca7ce68d3cc8164 100644 (file)
@@ -36,12 +36,7 @@ so, delete this exception statement from your version.  */
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-#include <sys/types.h>
+#include <string.h>
 #include <errno.h>
 
 #include "wget.h"
@@ -49,15 +44,11 @@ so, delete this exception statement from your version.  */
 #include "netrc.h"
 #include "init.h"
 
-#ifndef errno
-extern int errno;
-#endif
-
 #define NETRC_FILE_NAME ".netrc"
 
-acc_t *netrc_list;
+static acc_t *netrc_list;
 
-static acc_t *parse_netrc PARAMS ((const char *));
+static acc_t *parse_netrc (const char *);
 
 /* Return the correct user and password, given the host, user (as
    given in the URL), and password (as given in the URL).  May return
@@ -84,7 +75,7 @@ search_netrc (const char *host, const char **acc, const char **passwd,
       if (home)
        {
          int err;
-         struct stat buf;
+         struct_stat buf;
          char *path = (char *)alloca (strlen (home) + 1
                                       + strlen (NETRC_FILE_NAME) + 1);
          sprintf (path, "%s/%s", home, NETRC_FILE_NAME);
@@ -173,7 +164,7 @@ read_whole_line (FILE *fp)
 {
   int length = 0;
   int bufsize = 81;
-  char *line = (char *)xmalloc (bufsize);
+  char *line = xmalloc (bufsize);
 
   while (fgets (line + length, bufsize - length, fp))
     {
@@ -229,7 +220,7 @@ maybe_add_to_list (acc_t **newentry, acc_t **list)
        }
 
       /* Allocate a new acc_t structure.  */
-      a = (acc_t *)xmalloc (sizeof (acc_t));
+      a = xmalloc (sizeof (acc_t));
     }
 
   /* Zero the structure, so that it is ready to use.  */
@@ -284,7 +275,7 @@ parse_netrc (const char *path)
   premature_token = NULL;
 
   /* While there are lines in the file...  */
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       ln ++;
 
@@ -471,7 +462,7 @@ free_netrc(acc_t *l)
 int
 main (int argc, char **argv)
 {
-  struct stat sb;
+  struct_stat sb;
   char *program_name, *file, *target;
   acc_t *head, *a;