Question / Suggestion for wget

2006-10-13 Thread Mitch Silverstein

If -O output file and -N are both specified, it seems like there should be some 
mode where
the tests for noclobber apply to the output file, not the filename that exists 
on the remote machine.

So, if I run
# wget -N http://www.gnu.org/graphics/gnu-head-banner.png -O foo
and then
# wget -N http://www.gnu.org/graphics/gnu-head-banner.png -O foo
the second wget would not clobber and re-get the file.

Similarly, it seems odd that
# wget http://www.gnu.org/graphics/gnu-head-banner.png
and then
# wget -N http://www.gnu.org/graphics/gnu-head-banner.png -O foo
refuses to write the file named foo.

I realize there are already lots of options and the interactions can be pretty 
confusing, but I think
what I'm asking for would be of general usefulness. Maybe I'm sadistic, but -NO 
amuses me as a why to
turn on this behavior. Perhaps just --no-clobber-output-document would be saner.

Thanks for your consideration,
Mitch





Weird behavour of wget on Win32 while outputting file to stdout

2006-10-13 Thread Fi Dot

Hi, many-respected all!

Recently, playing with wget on win32 (version 1.10.2, downloaded from
http://users.ugent.be/~bpuype/wget/ ), I have encountered a problem
which I'd like to share with ya.

When I do

wget -O - http://foo/bar

the stream I get on STDOUT is corrupt.

Let's say, I do

wget -O - http://foo/bar  bar.downloaded

'bar.downloaded' is slightly bigger than original 'bar'.

Closer examination unveils:

$ od -t x1 bar.downloaded

000 89 50 4e 47 0d 0d 0a 1a 0d 0a 00 00 00 0d 49 48
020 44 52 00 00 01 8e 00 00 02 58 08 02 00 00 00 fa
040 e9 96 84 00 00 00 09 70 48 59 73 00 00 00 64 00
060 00 00 64 00 0f 96 c5 dd 00 00 00 46 74 45 58 74

$ od  -t x1 bar

000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52
020 00 00 01 8e 00 00 02 58 08 02 00 00 00 fa e9 96
040 84 00 00 00 09 70 48 59 73 00 00 00 64 00 00 00
060 64 00 0f 96 c5 dd 00 00 00 46 74 45 58 74 52 61

that all 0x0As get preceded with 0x0Ds.

I think that's a bug in the code (I have not found a command line
option that does that) - it's not binmoding STDOUT. That's my guess.

I will appreciate any comments :)

Thx!

Fidot.


Re: Question / Suggestion for wget

2006-10-13 Thread Steven M. Schweda
From: Mitch Silverstein

 If -O output file and -N are both specified [...]

   When -O foo is specified, it's not a suggestion for a file name to
be used later if needed.  Instead, wget opens the output file (foo)
before it does anything else.  Thus, it's always a newly created file,
and hence tends to be newer than any any file existing on any server
(whose date-time is set correctly).

   -O has its uses, but it makes no sense to combine it with -N. 
Remember, too, that wget allows more than one URL to be specified on a
command line, so multiple URLs may be associated with a single -O
output file.  What sense does -N make then?

   It might make some sense to create some positional option which would
allow a URL-specific output file, like, say, -OO, to be used so:

  wget http://a.b.c/d.e -OO not_dd.e http://g.h.i/j.k -OO not_j.k

but I don't know if the existing command-line parser could handle that. 
Alternatively, some other notation could be adopted, like, say,
file=URL, to be used so:

  wget not_dd.e=http://a.b.c/d.e not_j.k=http://g.h.i/j.k

   But that's not what -O does, and that's why you're (or your
expectations are) doomed.



   Steven M. Schweda   [EMAIL PROTECTED]
   382 South Warwick Street(+1) 651-699-9818
   Saint Paul  MN  55105-2547