On Sep 2, 2012, at 22:04 PM, William Harrington wrote:
use gnu awk:
BEGIN {
NetService = "/inet/tcp/0/mirror.anl.gov/80"
print "GET /pub/gnu/wget/wget-1.14.tar.xz" |& NetService
while ((NetService |& getline) > 0)
print $0
close(NetService)
}
Then run gawk -f http.gawk > binaryfilename (this seems to have
an issue with corrupting the binary data somehow.
Looked further into it. Of course a newline 0x0A was being added to
the end of the binary file.
=======
| GAWK |
=======
#!/bin/bash
gawk 'BEGIN {
NetService = "/inet/tcp/0/mirror.anl.gov/80"
print "GET /pub/gnu/wget/wget-1.14.tar.xz" |& NetService
while ((NetService |& getline) > 0)
print $0
close(NetService)
}' > binary
gawk '{q=p;p=$0}NR>1{print q}END{ORS = ""; print p}' binary >
wget-1.14.tar.xz
rm binary
======
| PERL |
======
perl -MHTTP::Tiny -E 'say HTTP::Tiny->new->get(shift)->{content}'
"http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz" > binary
perl -e 'local $/; $_ = <>; s/\n$//; print' binary > wget-1.14.tar.xz
rm binary
Pft, who needs download utilities when ya can use perl or gawk!
Sincerely,
William Harrington
_______________________________________________
Clfs-dev mailing list
Clfs-dev@lists.cross-lfs.org
http://lists.cross-lfs.org/listinfo.cgi/clfs-dev-cross-lfs.org