diff --git a/src/ChangeLog b/src/ChangeLog index 82531a83..ca245088 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-04-11 Steven Schubiger + + * init.c (initialize): Run a custom SYSTEM_WGETRC when + provided as an environment variable. + 2009-02-27 Gisle Vanem * main.c (main): "freopen (NULL,.." causes an assertion in MSVC diff --git a/src/init.c b/src/init.c index 06a4d3c8..5bed28f6 100644 --- a/src/init.c +++ b/src/init.c @@ -1,6 +1,6 @@ /* Reading/parsing the initialization file. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Wget. @@ -542,15 +542,20 @@ run_wgetrc (const char *file) void initialize (void) { - char *file; + char *file, *env_sysrc; int ok = true; /* Load the hard-coded defaults. */ defaults (); - - /* If SYSTEM_WGETRC is defined, use it. */ + + /* Run a non-standard system rc file when the according environment + variable has been set. For internal testing purposes only! */ + env_sysrc = getenv ("SYSTEM_WGETRC"); + if (env_sysrc && file_exists_p (env_sysrc)) + ok &= run_wgetrc (env_sysrc); + /* Otherwise, if SYSTEM_WGETRC is defined, use it. */ #ifdef SYSTEM_WGETRC - if (file_exists_p (SYSTEM_WGETRC)) + else if (file_exists_p (SYSTEM_WGETRC)) ok &= run_wgetrc (SYSTEM_WGETRC); #endif /* Override it with your own, if one exists. */ diff --git a/tests/ChangeLog b/tests/ChangeLog index 48d0f971..10fd1550 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2009-04-11 Steven Schubiger + + * run-px: Skip testing with real rc files by setting + SYSTEM_WGETRC and WGETRC to /dev/null. + 2009-02-25 Benjamin Wolsey * Makefile.am (run-px-tests): Ensure run-px is run from srcdir. diff --git a/tests/run-px b/tests/run-px index 6fe0d9fb..0753c8ed 100755 --- a/tests/run-px +++ b/tests/run-px @@ -55,6 +55,10 @@ my @tests = ( 'Test--spider-r.px', ); +foreach my $var (qw(SYSTEM_WGETRC WGETRC)) { + $ENV{$var} = '/dev/null'; +} + my @tested; foreach my $test (@tests) { @@ -63,6 +67,10 @@ foreach my $test (@tests) { push @tested, { name => $test, result => $? }; } +foreach my $var (qw(SYSTEM_WGETRC WGETRC)) { + delete $ENV{$var}; +} + print "\n"; foreach my $test (@tested) { ($test->{result} == 0)