#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 "netrc.h"
#include "init.h"
-#ifndef errno
-extern int errno;
-#endif
-
#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
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);
if (a && ! a->acc)
{
/* Free any allocated space. */
- xfree (a->host);
- xfree (a->acc);
- xfree (a->passwd);
+ xfree_null (a->host);
+ xfree_null (a->acc);
+ xfree_null (a->passwd);
}
else
{
premature_token = NULL;
/* While there are lines in the file... */
- while ((line = read_whole_line (fp)))
+ while ((line = read_whole_line (fp)) != NULL)
{
ln ++;
int
main (int argc, char **argv)
{
- struct stat sb;
+ struct_stat sb;
char *program_name, *file, *target;
acc_t *head, *a;