]> sjero.net Git - wget/blobdiff - src/netrc.c
[svn] Merge of fix for bugs 20341 and 20410.
[wget] / src / netrc.c
index bb4dc8c534d22fa7c0ceb861902c601a076f69bb..ba9fc3099d7d9d93564bcc0bab4937e954f4ef50 100644 (file)
@@ -5,7 +5,7 @@ This file is part of GNU Wget.
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 
 GNU Wget is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
 (at your option) any later version.
 
 GNU Wget is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget.  If not, see <http://www.gnu.org/licenses/>.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -36,12 +35,7 @@ so, delete this exception statement from your version.  */
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #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"
 #include <errno.h>
 
 #include "wget.h"
@@ -49,15 +43,11 @@ so, delete this exception statement from your version.  */
 #include "netrc.h"
 #include "init.h"
 
 #include "netrc.h"
 #include "init.h"
 
-#ifndef errno
-extern int errno;
-#endif
-
 #define NETRC_FILE_NAME ".netrc"
 
 acc_t *netrc_list;
 
 #define NETRC_FILE_NAME ".netrc"
 
 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
 
 /* Return the correct user and password, given the host, user (as
    given in the URL), and password (as given in the URL).  May return
@@ -173,7 +163,7 @@ read_whole_line (FILE *fp)
 {
   int length = 0;
   int bufsize = 81;
 {
   int length = 0;
   int bufsize = 81;
-  char *line = (char *)xmalloc (bufsize);
+  char *line = xmalloc (bufsize);
 
   while (fgets (line + length, bufsize - length, fp))
     {
 
   while (fgets (line + length, bufsize - length, fp))
     {
@@ -229,7 +219,7 @@ maybe_add_to_list (acc_t **newentry, acc_t **list)
        }
 
       /* Allocate a new acc_t structure.  */
        }
 
       /* 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.  */
     }
 
   /* Zero the structure, so that it is ready to use.  */
@@ -284,7 +274,7 @@ parse_netrc (const char *path)
   premature_token = NULL;
 
   /* While there are lines in the file...  */
   premature_token = NULL;
 
   /* While there are lines in the file...  */
-  while ((line = read_whole_line (fp)))
+  while ((line = read_whole_line (fp)) != NULL)
     {
       ln ++;
 
     {
       ln ++;