]> sjero.net Git - wget/commitdiff
[svn] Move extern declarations to .h files.
authorhniksic <devnull@localhost>
Mon, 27 Jun 2005 18:19:22 +0000 (11:19 -0700)
committerhniksic <devnull@localhost>
Mon, 27 Jun 2005 18:19:22 +0000 (11:19 -0700)
19 files changed:
src/ChangeLog
src/convert.h
src/cookies.c
src/ftp-ls.c
src/ftp.c
src/ftp.h
src/html-url.c
src/http.c
src/http.h [new file with mode: 0644]
src/init.c
src/log.c
src/main.c
src/netrc.c
src/openssl.c
src/recur.c
src/retr.c
src/retr.h
src/utils.c
src/wget.h

index 34de466505e19e9efdda72c75a0eb4b6371594c4..1758f6d9e6afeb3f3a95a765897e17d402c12373 100644 (file)
@@ -1,3 +1,16 @@
+2005-06-27  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * wget.h (PTR_FORMAT): Cast the result of sizeof to int before
+       passing it to printf's %*.
+
+       * retr.h: Declare output_stream and output_stream_regular.
+
+       * ftp.h: Declare ftp_last_respline.
+
+       * convert.h: Declare dl_url_file_map.
+
+       * http.h: New file.
+
 2005-06-27  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * cookies.c: Make cookies_now static.
index 7dddc0244132b0b1dc1070bc36cee94c47a013aa..2615da4a44342e104ce65fc04015dec6e9012e83 100644 (file)
@@ -31,6 +31,7 @@ so, delete this exception statement from your version.  */
 #define CONVERT_H
 
 struct hash_table;             /* forward decl */
+extern struct hash_table *dl_url_file_map;
 extern struct hash_table *downloaded_html_set;
 
 enum convert_options {
index 3a28f900dbfdb9bc8d9424563519d77ea0a40a3f..10710eb618f2d079b05c3c13da026897b7314a40 100644 (file)
@@ -55,9 +55,7 @@ so, delete this exception statement from your version.  */
 #include "utils.h"
 #include "hash.h"
 #include "cookies.h"
-
-/* This should *really* be in a .h file!  */
-time_t http_atotm (const char *);
+#include "http.h"              /* for http_atotm */
 \f
 /* Declarations of `struct cookie' and the most basic functions. */
 
index 7e448295e64f82d9bb5631185d2b0afe26a0c459..6613d7d1b7eaeafe9d77bbd9bd33bace8be00e39 100644 (file)
@@ -44,8 +44,7 @@ so, delete this exception statement from your version.  */
 #include "ftp.h"
 #include "url.h"
 #include "convert.h"           /* for html_quote_string prototype */
-
-extern FILE *output_stream;
+#include "retr.h"              /* for output_stream */
 
 /* Converts symbolic permissions to number-style ones, e.g. string
    rwxr-xr-x to 755.  For now, it knows nothing of
index 46a520ed25897f3c94721c4f224f095437ae633f..0d903d35fcf41ce6c0ba920f92a6b957f4bafe90 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -53,11 +53,6 @@ so, delete this exception statement from your version.  */
 /* File where the "ls -al" listing will be saved.  */
 #define LIST_FILENAME ".listing"
 
-extern char ftp_last_respline[];
-
-extern FILE *output_stream;
-extern bool output_stream_regular;
-
 typedef struct
 {
   int st;                      /* connection status */
@@ -1308,7 +1303,7 @@ Removing file due to --delete-after in ftp_loop_internal():\n"));
 
 /* Return the directory listing in a reusable format.  The directory
    is specifed in u->dir.  */
-uerr_t
+static uerr_t
 ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f)
 {
   uerr_t err;
index 8391cfaa77b0d78a998a60766d1787d00bf1d15e..0d4aec52cbd8b94fbc60f0d453dcf4a1c17c79d6 100644 (file)
--- a/src/ftp.h
+++ b/src/ftp.h
@@ -42,7 +42,9 @@ enum stype
   ST_OS400,
   ST_OTHER
 };
-  
+
+extern char ftp_last_respline[];
+
 uerr_t ftp_response (int, char **);
 uerr_t ftp_login (int, const char *, const char *);
 uerr_t ftp_port (int, int *);
index 47b52e694ba332800dc41399d45979cea5ec36d8..2ce9172140fb774f46154906575d572c127f0818 100644 (file)
@@ -170,8 +170,8 @@ static const char *additional_attributes[] = {
   "action"                     /* used by tag_handle_form */
 };
 
-struct hash_table *interesting_tags;
-struct hash_table *interesting_attributes;
+static struct hash_table *interesting_tags;
+static struct hash_table *interesting_attributes;
 
 static void
 init_interesting (void)
index b62a9821dc3af13bed5b705399d4b50e486ec8e9..a5f5673c5f0cb935ec4570d916cd8f938004fa19 100644 (file)
@@ -41,6 +41,7 @@ so, delete this exception statement from your version.  */
 #include <locale.h>
 
 #include "wget.h"
+#include "http.h"
 #include "utils.h"
 #include "url.h"
 #include "host.h"
@@ -61,9 +62,6 @@ so, delete this exception statement from your version.  */
 
 extern char *version_string;
 
-extern FILE *output_stream;
-extern bool output_stream_regular;
-
 #ifndef MIN
 # define MIN(x, y) ((x) > (y) ? (y) : (x))
 #endif
@@ -1089,8 +1087,6 @@ static char *create_authorization_line (const char *, const char *,
 static char *basic_authentication_encode (const char *, const char *);
 static bool known_authentication_scheme_p (const char *, const char *);
 
-time_t http_atotm (const char *);
-
 #define BEGINS_WITH(line, string_constant)                             \
   (!strncasecmp (line, string_constant, sizeof (string_constant) - 1)  \
    && (ISSPACE (line[sizeof (string_constant) - 1])                    \
@@ -2683,7 +2679,7 @@ extract_header_attr (const char *au, const char *attr_name, char **ret)
    buffer of 33 writable characters (32 for hex digits plus one for
    zero termination).  */
 static void
-dump_hash (unsigned char *buf, const unsigned char *hash)
+dump_hash (char *buf, const unsigned char *hash)
 {
   int i;
 
@@ -2772,8 +2768,8 @@ digest_authentication_encode (const char *au, const char *user,
   {
     ALLOCA_MD5_CONTEXT (ctx);
     unsigned char hash[MD5_HASHLEN];
-    unsigned char a1buf[MD5_HASHLEN * 2 + 1], a2buf[MD5_HASHLEN * 2 + 1];
-    unsigned char response_digest[MD5_HASHLEN * 2 + 1];
+    char a1buf[MD5_HASHLEN * 2 + 1], a2buf[MD5_HASHLEN * 2 + 1];
+    char response_digest[MD5_HASHLEN * 2 + 1];
 
     /* A1BUF = H(user ":" realm ":" password) */
     gen_md5_init (ctx);
@@ -2795,11 +2791,11 @@ digest_authentication_encode (const char *au, const char *user,
 
     /* RESPONSE_DIGEST = H(A1BUF ":" nonce ":" A2BUF) */
     gen_md5_init (ctx);
-    gen_md5_update (a1buf, MD5_HASHLEN * 2, ctx);
+    gen_md5_update ((unsigned char *)a1buf, MD5_HASHLEN * 2, ctx);
     gen_md5_update ((unsigned char *)":", 1, ctx);
     gen_md5_update ((unsigned char *)nonce, strlen (nonce), ctx);
     gen_md5_update ((unsigned char *)":", 1, ctx);
-    gen_md5_update (a2buf, MD5_HASHLEN * 2, ctx);
+    gen_md5_update ((unsigned char *)a2buf, MD5_HASHLEN * 2, ctx);
     gen_md5_finish (ctx, hash);
     dump_hash (response_digest, hash);
 
diff --git a/src/http.h b/src/http.h
new file mode 100644 (file)
index 0000000..023566f
--- /dev/null
@@ -0,0 +1,41 @@
+/* Declarations for HTTP.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+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
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GNU Wget is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+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
+along with Wget; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+In addition, as a special exception, the Free Software Foundation
+gives permission to link the code of its release of Wget with the
+OpenSSL project's "OpenSSL" library (or with modified versions of it
+that use the same license as the "OpenSSL" library), and distribute
+the linked executables.  You must obey the GNU General Public License
+in all respects for all of the code used other than "OpenSSL".  If you
+modify this file, you may extend this exception to your version of the
+file, but you are not obligated to do so.  If you do not wish to do
+so, delete this exception statement from your version.  */
+
+#ifndef HTTP_H
+#define HTTP_H
+
+struct url;
+
+uerr_t http_loop (struct url *, char **, char **, const char *, int *,
+                 struct url *);
+void save_cookies (void);
+void http_cleanup (void);
+time_t http_atotm (const char *);
+
+#endif /* HTTP_H */
index a86006b4071ed6e8e72eb766b441b9afe5ec4334..db2d274233d9bb639c83ece523ecdc38091ab2c2 100644 (file)
@@ -51,6 +51,8 @@ so, delete this exception statement from your version.  */
 #include "recur.h"             /* for INFINITE_RECURSION */
 #include "convert.h"           /* for convert_cleanup */
 #include "res.h"               /* for res_cleanup */
+#include "http.h"              /* for http_cleanup */
+#include "retr.h"              /* for output_stream */
 
 /* We want tilde expansion enabled only when reading `.wgetrc' lines;
    otherwise, it will be performed by the shell.  This variable will
@@ -1415,7 +1417,6 @@ decode_string (const char *val, const struct decode_item *items, int itemcount,
 
 \f
 void cleanup_html_url (void);
-void http_cleanup (void);
 
 
 /* Free the memory allocated by global variables.  */
@@ -1424,13 +1425,10 @@ cleanup (void)
 {
   /* Free external resources, close files, etc. */
 
-  {
-    extern FILE *output_stream;
-    if (output_stream)
-      fclose (output_stream);
-    /* No need to check for error because Wget flushes its output (and
-       checks for errors) after any data arrives.  */
-  }
+  if (output_stream)
+    fclose (output_stream);
+  /* No need to check for error because Wget flushes its output (and
+     checks for errors) after any data arrives.  */
 
   /* We're exiting anyway so there's no real need to call free()
      hundreds of times.  Skipping the frees will make Wget exit
index 8285c7ef2ef0a1cbc0a1add8a72fbec81e1e15df..55e98842cfe9fdd64528a8eb63e524c12d89bb17 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -769,7 +769,7 @@ log_cleanup (void)
 \f
 /* When SIGHUP or SIGUSR1 are received, the output is redirected
    elsewhere.  Such redirection is only allowed once. */
-enum { RR_NONE, RR_REQUESTED, RR_DONE } redirect_request = RR_NONE;
+static enum { RR_NONE, RR_REQUESTED, RR_DONE } redirect_request = RR_NONE;
 static const char *redirect_request_signal_name;
 
 /* Redirect output to `wget-log'.  */
index a6dfbd65593e9bb73fb84679830014327f129317..9bf80465dc3b75274d16f296c5e9968e8f220cb6 100644 (file)
@@ -51,6 +51,7 @@ so, delete this exception statement from your version.  */
 #include "url.h"
 #include "progress.h"          /* for progress_handle_sigwinch */
 #include "convert.h"
+#include "http.h"              /* for save_cookies */
 
 /* On GNU system this will include system-wide getopt.h. */
 #include "getopt.h"
@@ -63,8 +64,6 @@ struct options opt;
 
 extern char *version_string;
 
-extern struct cookie_jar *wget_cookie_jar;
-
 static void redirect_output_signal (int);
 
 const char *exec_name;
@@ -123,7 +122,7 @@ struct cmdline_option {
   int argtype;                 /* for non-standard options */
 };
 
-struct cmdline_option option_data[] =
+static struct cmdline_option option_data[] =
   {
     { "accept", 'A', OPT_VALUE, "accept", -1 },
     { "append-output", 'a', OPT__APPEND_OUTPUT, NULL, required_argument },
@@ -896,9 +895,6 @@ Can't timestamp and not clobber old files at the same time.\n"));
   /* Open the output filename if necessary.  */
   if (opt.output_document)
     {
-      extern FILE *output_stream;
-      extern bool output_stream_regular;
-
       if (HYPHENP (opt.output_document))
        output_stream = stdout;
       else
index 158ef39f34ab9eb15c8a7669f801c8bd2d17f2e8..6e9611de3be9e6d0bed32219fca7ce68d3cc8164 100644 (file)
@@ -46,7 +46,7 @@ so, delete this exception statement from your version.  */
 
 #define NETRC_FILE_NAME ".netrc"
 
-acc_t *netrc_list;
+static acc_t *netrc_list;
 
 static acc_t *parse_netrc (const char *);
 
index 24652946f508070cd4ab2d772a712fe0ba70824c..75011af7ccc988888c37849664c095453426a977 100644 (file)
@@ -50,7 +50,7 @@ so, delete this exception statement from your version.  */
 
 /* Application-wide SSL context.  This is common to all SSL
    connections.  */
-SSL_CTX *ssl_ctx;
+static SSL_CTX *ssl_ctx;
 
 /* Initialize the SSL's PRNG using various methods. */
 
index 75ed6f9d13599ba30fb5aea942d343a60552076d..47f96a10a5b818d096453889507465c39939bbff 100644 (file)
@@ -48,12 +48,6 @@ so, delete this exception statement from your version.  */
 #include "hash.h"
 #include "res.h"
 #include "convert.h"
-
-extern char *version_string;
-extern SUM_SIZE_INT total_downloaded_bytes;
-
-extern struct hash_table *dl_url_file_map;
-extern struct hash_table *downloaded_html_set;
 \f
 /* Functions for maintaining the URL queue.  */
 
index 3838c8d69d0c680b4ceaa1c8d16430a3dc3a5b5d..450619360b639bdac49a4353a7c8a52ee32e01e0 100644 (file)
@@ -45,6 +45,7 @@ so, delete this exception statement from your version.  */
 #include "url.h"
 #include "recur.h"
 #include "ftp.h"
+#include "http.h"
 #include "host.h"
 #include "connect.h"
 #include "hash.h"
index 0cc9ebd1acf0f55fabc67e3065fa8c1d1e40ee79..305ced4f94bee212d871a750144e2eb26dae48e0 100644 (file)
@@ -30,8 +30,12 @@ so, delete this exception statement from your version.  */
 #ifndef RETR_H
 #define RETR_H
 
+/* These global vars should be made static to retr.c and exported via
+   functions! */
 extern SUM_SIZE_INT total_downloaded_bytes;
 extern double total_download_time;
+extern FILE *output_stream;
+extern bool output_stream_regular;
 
 /* Flags for fd_read_body. */
 enum {
@@ -57,13 +61,4 @@ void sleep_between_retrievals (int);
 
 void rotate_backups (const char *);
 
-/* Because there's no http.h. */
-
-struct url;
-
-uerr_t http_loop (struct url *, char **, char **, const char *, int *,
-                 struct url *);
-void save_cookies (void);
-
-
 #endif /* RETR_H */
index c027097fd3ca09605fcf67a7a2a1e9114ccf275e..fbf9b47f7ff26f04daa28048a7e0847314467871 100644 (file)
@@ -1477,6 +1477,7 @@ number_to_string (char *buffer, wgint number)
 
 #undef PR
 #undef W
+#undef SPRINTF_WGINT
 #undef DIGITS_1
 #undef DIGITS_2
 #undef DIGITS_3
index d598cccb7578aa118c0e267ab9a11960e746838a..6a0756b0acdda251c883b57e009cc2ff2ba7810e 100644 (file)
@@ -247,7 +247,7 @@ typedef double SUM_SIZE_INT;
    using printf ("%0*lx", PTR_FORMAT (p)).  (%p is too unpredictable;
    some implementations prepend 0x, while some don't, and most don't
    0-pad the address.)  */
-#define PTR_FORMAT(p) 2 * sizeof (void *), (unsigned long) (p)
+#define PTR_FORMAT(p) (int) (2 * sizeof (void *)), (unsigned long) (p)
 
 extern const char *exec_name;
 \f