[svn] Move extern declarations to .h files.

This commit is contained in:
hniksic 2005-06-27 11:19:22 -07:00
parent 40fc711db6
commit 2447fb9a9b
19 changed files with 87 additions and 57 deletions

View 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.

View 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 {

View 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 */
/* Declarations of `struct cookie' and the most basic functions. */

View 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

View File

@ -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;

View File

@ -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 *);

View 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)

View 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);

41
src/http.h Normal file
View File

@ -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 */

View 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,
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

View File

@ -769,7 +769,7 @@ log_cleanup (void)
/* 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'. */

View 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

View 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 *);

View 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. */

View 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;
/* Functions for maintaining the URL queue. */

View 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"

View 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 */

View 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

View 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;