aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>1999-12-29 14:20:26 +0000
committerDaniel Stenberg <daniel@haxx.se>1999-12-29 14:20:26 +0000
commitae1912cb0d494b48d514d937826c9fe83ec96c4d (patch)
tree3b027d577182fc74bade646227f729eac461d0d2
Initial revision
-rw-r--r--CHANGES1656
-rw-r--r--CONTRIBUTE68
-rw-r--r--FAQ31
-rw-r--r--FEATURES72
-rw-r--r--FILES47
-rw-r--r--INSTALL195
-rw-r--r--LEGAL21
-rw-r--r--MPL-1.0.txt360
-rw-r--r--Makefile426
-rw-r--r--Makefile.am13
-rw-r--r--Makefile.dist78
-rw-r--r--Makefile.in426
-rw-r--r--README28
-rw-r--r--README.curl611
-rw-r--r--README.libcurl108
-rw-r--r--RESOURCES62
-rw-r--r--TODO87
-rw-r--r--acconfig.h12
-rw-r--r--aclocal.m4127
-rw-r--r--config-win32.h168
-rw-r--r--config.cache86
-rwxr-xr-xconfig.guess997
-rwxr-xr-xconfig.guess-991124900
-rw-r--r--config.h220
-rw-r--r--config.h.in219
-rw-r--r--config.log90
-rwxr-xr-xconfig.status492
-rwxr-xr-xconfig.sub979
-rwxr-xr-xconfig.sub-991124952
-rwxr-xr-xconfigure3091
-rw-r--r--configure.in210
-rw-r--r--curl-6.3.1.tar.gzbin0 -> 242680 bytes
-rw-r--r--curl-ssl.spec52
-rw-r--r--curl.1402
-rw-r--r--curl.beos-patch695
-rw-r--r--curl.spec52
-rw-r--r--curl_631_general.patch1265
-rw-r--r--curl_63_form.patch92
-rw-r--r--curl_63_partialdl.patch106
-rw-r--r--head7
-rw-r--r--include/README15
-rw-r--r--include/curl/curl.beos-patch46
-rw-r--r--include/curl/curl.h434
-rw-r--r--include/curl/getdate.h0
-rw-r--r--include/curl/mprintf.h93
-rw-r--r--include/curl/stdcheaders.h53
-rwxr-xr-xinstall-sh250
-rw-r--r--lib/Makefile282
-rw-r--r--lib/Makefile.am31
-rw-r--r--lib/Makefile.in282
-rw-r--r--lib/Makefile.m3267
-rw-r--r--lib/Makefile.vc6315
-rw-r--r--lib/arpa_telnet.h319
-rw-r--r--lib/base64.c94
-rw-r--r--lib/base64.h44
-rw-r--r--lib/cookie.c457
-rw-r--r--lib/cookie.h45
-rw-r--r--lib/dict.c245
-rw-r--r--lib/dict.h45
-rw-r--r--lib/download.c484
-rw-r--r--lib/download.h50
-rw-r--r--lib/escape.c111
-rw-r--r--lib/escape.h49
-rw-r--r--lib/file.c175
-rw-r--r--lib/file.h45
-rwxr-xr-xlib/formdatabin0 -> 23808 bytes
-rw-r--r--lib/formdata.c617
-rw-r--r--lib/formdata.h103
-rw-r--r--lib/ftp.c1046
-rw-r--r--lib/ftp.h52
-rw-r--r--lib/getdate.c2101
-rw-r--r--lib/getdate.h46
-rw-r--r--lib/getdate.y1051
-rw-r--r--lib/getenv.c95
-rw-r--r--lib/getenv.h71
-rw-r--r--lib/getpass.c185
-rw-r--r--lib/getpass.h1
-rw-r--r--lib/hostip.c111
-rw-r--r--lib/hostip.h46
-rw-r--r--lib/http.c381
-rw-r--r--lib/http.h45
-rw-r--r--lib/if2ip.c110
-rw-r--r--lib/if2ip.h50
-rw-r--r--lib/ldap.c226
-rw-r--r--lib/ldap.h45
-rw-r--r--lib/mprintf.c1253
-rw-r--r--lib/netrc.c182
-rw-r--r--lib/netrc.h70
-rw-r--r--lib/progress.c221
-rw-r--r--lib/progress.h54
-rw-r--r--lib/sendf.c115
-rw-r--r--lib/sendf.h47
-rw-r--r--lib/setup.h169
-rw-r--r--lib/speedcheck.c81
-rw-r--r--lib/speedcheck.h50
-rw-r--r--lib/ssluse.c265
-rw-r--r--lib/ssluse.h46
-rw-r--r--lib/sta01005bin0 -> 1024 bytes
-rw-r--r--lib/sta18057bin0 -> 461824 bytes
-rw-r--r--lib/telnet.c937
-rw-r--r--lib/telnet.h45
-rw-r--r--lib/timeval.c93
-rw-r--r--lib/timeval.h64
-rw-r--r--lib/upload.c178
-rw-r--r--lib/upload.h46
-rw-r--r--lib/url.c1181
-rw-r--r--lib/url.h0
-rw-r--r--lib/urldata.h212
-rw-r--r--lib/version.c86
-rwxr-xr-xmaketgz152
-rwxr-xr-xmissing188
-rwxr-xr-xmkinstalldirs40
-rw-r--r--perl/README33
-rw-r--r--perl/checklinks.pl336
-rwxr-xr-xperl/checklinks.pl.in336
-rw-r--r--perl/formfind.pl273
-rwxr-xr-xperl/formfind.pl.in273
-rw-r--r--perl/getlinks.pl261
-rwxr-xr-xperl/getlinks.pl.in261
-rw-r--r--perl/recursiveftpget.pl67
-rwxr-xr-xperl/recursiveftpget.pl.in67
-rwxr-xr-xreconf16
-rw-r--r--src/Makefile334
-rw-r--r--src/Makefile.am27
-rw-r--r--src/Makefile.in334
-rw-r--r--src/Makefile.m3265
-rw-r--r--src/Makefile.vc668
-rw-r--r--src/config-win32.h12
-rw-r--r--src/config.h13
-rw-r--r--src/config.h.in12
-rwxr-xr-xsrc/curlbin0 -> 1830293 bytes
-rw-r--r--src/hugehelp.c1049
-rw-r--r--src/main.c1154
-rw-r--r--src/mkhelp.pl85
-rw-r--r--src/setup.h91
-rw-r--r--src/stamp-h21
-rw-r--r--src/stamp-h2.in1
-rw-r--r--src/urlglob.c332
-rw-r--r--src/urlglob.h74
-rw-r--r--src/version.h3
-rw-r--r--stamp-h1
-rw-r--r--stamp-h.in1
-rw-r--r--stamp-h11
-rw-r--r--stamp-h1.in1
144 files changed, 37273 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
new file mode 100644
index 000000000..34cc7bf83
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,1656 @@
+ _ _ ____ _
+ ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+ History of Changes
+
+
+Version 6.4
+
+Daniel (28 December 1999):
+ - Tim Verhoeven <dj@walhalla.sin.khk.be> correctly identified that curl
+ doesn't support URL formatted file names when getting ftp. Now, there's a
+ problem with getting very weird file names off FTP servers. RFC 959 defines
+ that the file name syntax to use should be the same as in the native OS of
+ the server. Since we don't know the peer server system we currently just
+ translate the URL syntax into plain letters. It is still better and with
+ the solaris 2.6-supplied ftp server it works with spaces in the file names.
+
+Daniel (27 December 1999):
+ - When curl parsed cookies straight off a remote site, it corrupted the input
+ data, which, if the downloaded headers were stored made very odd characters
+ in the saved data. Correctfully identified and reported by Paul Harrington
+ <paul@pizza.org>.
+
+Daniel (13 December 1999):
+ - General cleanups in the library interface. There had been some bad kludges
+ added during times of stress and I did my best to clean them off. It was
+ both regarding the lib API as well as include file confusions.
+
+Daniel (3 December 1999):
+ - A small --stderr bug was reported by Eetu Ojanen <esojanen@jyu.fi>...
+
+ - who also brought the suggestion of extending the -X flag to ftp list as
+ well. So, now it is and the long option is now --request instead. It is
+ only for ftp list for now (and the former http stuff too of course).
+
+Lars J. Aas <larsa@sim.no> (24 November 1999):
+ - Patched curl to compile and build under BeOS. Doesn't work yet though!
+
+ - Corrected the Makefile.am files to allow putting object files in
+ different directories than the sources.
+
+Version 6.3.1
+
+Daniel (23 November 1999):
+ - I've had this major disk crash. My good old trust-worthy source disk died
+ along with the machine that hosted it. Thank goodness most of all the
+ things I've done are either backed up elsewhere or stored in this CVS
+ server!
+
+ - Michael S. Steuer <michael@steuer.com> pointed out a bug in the -F handling
+ that made curl hang if you posted an empty variable such as '-F name='. It
+ was one of those old bugs that never have worked properly...
+
+ - Jason Baietto <jason@durians.com> pointed out a general flaw in the HTTP
+ download. Curl didn't complain if it was prematurely aborted before the
+ entire download was completed. It does now.
+
+Daniel (19 November 1999):
+ - Chris Maltby <chris@aurema.com> very accurately criticized the lack of
+ return code checks on the fwrite() calls. I did a thorough check for all
+ occurrences and corrected this.
+
+Daniel (17 November 1999):
+ - Paul Harrington <paul@pizza.org> pointed out that the -m/--max-time option
+ doesn't work for the slow system calls like gethostbyname()... I don't have
+ any good fix yet, just a slightly less bad one that makes curl exit hard
+ when the timeout is reached.
+
+ - Bjorn Reese helped me point out a possible problem that might be the reason
+ why Thomas Hurst experience problems in his Amiga version.
+
+ Daniel (12 November 1999):
+ - I found a crash in the new cookie file parser. It crashed when you gave
+ a plain http header file as input...
+
+Version 6.3
+
+ Daniel (10 November 1999):
+ - I kind of found out that the HTTP time-conditional GETs (-z) aren't always
+ respected by the web server and the document is therefore sent in whole
+ again, even though it doesn't match the requested condition. After reading
+ section 13.3.4 of RFC 2616, I think I'm doing the right thing now when I do
+ my own check as well. If curl thinks the condition isn't met, the transfer
+ is aborted prematurely (after all the headers have been received).
+
+ - After comments from Robert Linden <robert.linden@postcom.deutschepost.de> I
+ also rewrote some parts of the man page to better describe how the -F
+ works.
+
+ - Michael Anti <anti@pshowing.com> put up a new curl download mirror in
+ China: http://www.pshowing.com/curl/
+
+ - I added the list of download mirrors to the README file
+
+ - I did add more explanations to the man page
+
+ Daniel (8 November 1999):
+ - I made the -b/--cookie option capable of reading netscape formatted cookie
+ files as well as normal http-header files. It should be able to
+ transparantly figure out what kind of file it got as input.
+
+ Daniel (29 October 1999):
+ - Another one of Sebastiaan van Erk's ideas (that has been requested before
+ but I seem to have forgotten who it was), is to add support for ranges in
+ FTP downloads. As usual, one request is just a request, when they're two
+ it is a demand. I've added simple support for X-Y style fetches. X has to
+ be the lower number, though you may omit one of the numbers. Use the -r/
+ --range switch (previously HTTP-only).
+
+ - Sebastiaan van Erk <sebster@sebster.com> suggested that curl should be
+ able to show the file size of a specified file. I think this is a splendid
+ idea and the -I flag is now working for FTP. It displays the file size in
+ this manner:
+ Content-Length: XXXX
+ As it resembles normal headers, and leaves us the opportunity to add more
+ info in that display if we can come up with more in the future! It also
+ makes sense since if you access ftp through a HTTP proxy, you'd get the
+ file size the same way.
+
+ I changed the order of the QUOTE command execusions. They're now executed
+ just after the login and before any other command. I made this to enable
+ quote commands to run before the -I stuff is done too.
+
+ - I found out that -D/--dump-header and -V/--version weren't documented in
+ the man page.
+
+ - Many HTTP/1.1 servers do not support ranges. Don't ask me why. I did add
+ some text about this in the man page for the range option. The thread in
+ the mailing list that started this was initiated by Michael Anti
+ <anti@pshowing.com>.
+
+ - I get reports about nroff crashes on solaris 2.6+ when displaying the curl
+ man page. Switch to gnroff instead, it is reported to work(!). Adam Barclay
+ <adam@oz.org> reported and brought the suggestion.
+
+ - In a dialogue with Johannes G. Kristinsson <d98is@dtek.chalmers.se> we came
+ up with the idea to let -H/--header specified headers replace the
+ internally generated headers, if you happened to select to add a header
+ that curl normally uses by itself. The advantage with this is not entirely
+ obvious, but in Johannes' case it means that he can use another Host: than
+ the one curl would set.
+
+ Daniel (27 October 1999):
+ - Jongki Suwandi <Jongki.Suwandi@eng.sun.com> brought a nice patch for
+ (yet another) crash when following a location:. This time you had to
+ follow a https:// server's redirect to get the core.
+
+Version 6.2
+
+ Daniel (21 October 1999):
+ - I think I managed to remove the suspicious (nil) that has been seen just
+ before the "Host:" in HTTP requests when -v was used.
+ - I found out that if you followed a location: when using a proxy, without
+ having specified http:// in the URL, the protocol part was added once again
+ when moving to the next URL! (The protocol part has to be added to the
+ URL when going through a proxy since it has no protocol-guessing system
+ such as curl has.)
+ - Benjamin Ritcey <ritcey@tfn.com> reported a core dump under solaris 2.6
+ with OpenSSL 0.9.4. It turned out this was due to a bad free() in main.c
+ that occurred after the download was done and completed.
+ - Benjamin found ftp downloads to show the first line of the download meter
+ to get written twice, and I removed that problem. It was introduced with
+ the multiple URL support.
+ - Dan Zitter <dzitter@zitter.net> correctly pointed out that curl 6.1 and
+ earlier versions didn't honor RFC 2616 chapter 4 section 2, "Message
+ Headers": "...Field names are case-insensitive..."
+ HTTP header parsing assumed a certain casing. Dan also provided me with
+ a patch that corrected this, which I took the liberty of editing slightly.
+ - Dan Zitter also provided a nice patch for config.guess to better recognize
+ the Mac OS X
+ - Dan also corrected a minor problem in the lib/Makefile that caused linking
+ to fail on OS X.
+
+ Daniel (19 October 1999):
+ - Len Marinaccio <len@goodnet.com> came up with some problems with curl.
+ Since Windows has a crippled shell, it can't redirect stderr and that
+ causes trouble. I added --stderr today which allows the user to redirect
+ the stderr stream to a file or stdout.
+
+ Daniel (18 October 1999):
+ - The configure script now understands the '--without-ssl' flag, which now
+ totally disable SSL/https support. Previously it wasn't possible to force
+ the configure script to leave SSL alone. The previous functionality has
+ been retained. Troy Engel helped test this new one.
+
+Version 6.1
+
+ Daniel (17 October 1999):
+ - I ifdef'ed or commented all the zlib stuff in the sources and configure
+ script. It turned out we needed to mock more with zlib than I initially
+ thought, to make it capable of downloading compressed HTTP documents and
+ uncompress them on the fly. I didn't mean the zlib parts of curl to become
+ more than minor so this means I halt the zlib expedition for now and wait
+ until someone either writes the code or zlib gets updated and better
+ adjusted for this kind of usage. I won't get into details here, but a
+ short a summary is suitable:
+ - zlib can't automatically detect whether to use zlib or gzip
+ decompression methods.
+ - zlib is very neat for reading gzipped files from a file descriptor,
+ although not as nice for reading buffer-based data such as we would
+ want it.
+ - there are still some problems with the win32 version when reading from
+ a file descriptor if that is a socket
+
+ Daniel (14 October 1999):
+ - Moved the (external) include files for libcurl into a subdirectory named
+ curl and adjusted all #include lines to use <curl/XXXX> to maintain a
+ better name space and control of the headers. This has been requested.
+
+ Daniel (12 October 1999):
+ - I modified the 'maketgz' script to perform a 'make' too before a release
+ archive is put together in an attempt to make the time stamps better and
+ hopefully avoid the double configure-running that use to occur.
+
+ Daniel (11 October 1999):
+ - Applied Jörn's patches that fixes zlib for mingw32 compiles as well as
+ some other missing zlib #ifdef and more text on the multiple URL docs in
+ the man page.
+
+Version 6.1beta
+
+ Daniel (6 October 1999):
+ - Douglas E. Wegscheid <wegscd@whirlpool.com> sent me a patch that made the
+ exact same thing as I just made: the -d switch is now capable of reading
+ post data from a named file or stdin. Use it similarly to the -F. To read
+ the post data from a given file:
+
+ curl -d @path/to/filename www.postsite.com
+
+ or let curl read it out from stdin:
+
+ curl -d @- www.postit.com
+
+ Jörn Hartroth (3 October 1999):
+ - Brought some more patches for multiple URL functionality. The MIME
+ separation ideas are almost scrapped now, and a custom separator is being
+ used instead. This is still compile-time "flagged".
+
+ Daniel
+ - Updated curl.1 with multiple URL info.
+
+ Daniel (30 September 1999):
+ - Felix von Leitner <felix@convergence.de> brought openssl-check fixes
+ for configure.in to work out-of-the-box when the openssl files are
+ installed in the system default dirs.
+
+ Daniel (28 September 1999)
+ - Added libz functionality. This should enable decompressing gzip, compress
+ or deflate encoding HTTP documents. It also makes curl send an accept that
+ it accepts that kind of encoding. Compressed contents usually shortens
+ download time. I *need* someone to tell me a site that uses compressed HTTP
+ documents so that I can test this out properly.
+
+ - As a result of the adding of zlib awareness, I changed the version string
+ a little. I plan to add openldap version reporting in there too.
+
+ Daniel (17 September 1999)
+ - Made the -F option allow stdin when specifying files. By using '-' instead
+ of file name, the data will be read from stdin.
+
+Version 6.0
+
+ Daniel (13 September 1999)
+ - Added -X/--http-request <request> to enable any HTTP command to be sent.
+ Do not that your server has to support the exact string you enter. This
+ should possibly a string like DELETE or TRACE.
+
+ - Applied Douglas' mingw32-fixes for the makefiles.
+
+ Daniel (10 September 1999)
+ - Douglas E. Wegscheid <wegscd@whirlpool.com> pointed out a problem. Curl
+ didn't check the FTP servers return code properly after the --quote
+ commands were issued. It took anything non 200 as an error, when all 2XX
+ codes should be accepted as OK.
+
+ - Sending cookies to the same site in multiple lines like curl used to do
+ turned out to be bad and breaking the cookie specs. Curl now sends all
+ cookies on a single Cookie: line. Curl is not yet RFC 2109 compliant, but I
+ doubt that many servers do use that syntax (yet).
+
+ Daniel (8 September 1999)
+ - Jörn helped me make sure it still compiles nicely with mingw32 under win32.
+
+ Daniel (7 September 1999)
+ - FTP upload through proxy is now turned into a HTTP PUT. Requested by
+ Stefan Kanthak <Stefan.Kanthak@mchp.siemens.de>.
+
+ - Added the ldap files to the .m32 makefile.
+
+ Daniel (3 September 1999)
+ - Made cookie matching work while using HTTP proxy.
+
+ Bjorn Reese <breese@mail1.stofanet.dk> (31 August 1999)
+ - Passed his ldap:// patch. Note that this requires the openldap shared
+ library to be installed and that LD_LIBRARY_PATH points to the
+ directory where the lib will be found when curl is run with a
+ ldap:// URL.
+
+ Jörn Hartroth <Joern.Hartroth@telekom.de> (31 August 1999)
+ - Made the Mingw32 makefiles into single files.
+ - Made file:// work for Win32. The same code is now used for unix as well for
+ performance reasons.
+
+ Douglas E. Wegscheid <wegscd@whirlpool.com> (30 August 1999)
+ - Patched the Mingw32 makefiles for SSL builds.
+
+ Matthew Clarke <clamat@van.maves.ca> (30 August 1999)
+ - Made a cool patch for configure.in to allow --with-ssl to specify the
+ root dir of the openssl installation, as in
+
+ ./configure --with-ssl=/usr/ssl_here
+
+ - Corrected the 'reconf' script to work better with some shells.
+
+ Jörn Hartroth <Joern.Hartroth@telekom.de> (26 August 1999)
+ - Fixed the Mingw32 makefiles in lib/ and corrected the file.c for win32
+ compiles.
+
+Version 5.11
+
+ Daniel (25 August 1999)
+ - John Weismiller <johnweis@home.com> pointed out a bug in the header-line
+ realloc() system in download.c.
+
+ - I added lib/file.[ch] to offer a first, simple, file:// support. It
+ probably won't do much good on win32 system at this point, but I see it
+ as a start.
+
+ - Made the release archives get a Makefile in the root dir, which can be
+ used to start the compiling/building process easier. I haven't really
+ changed any INSTALL text yet, I wanted to get some feed-back on this
+ first.
+
+ Daniel (17 August 1999)
+ - Another Location: bug. Curl didn't do proper relative locations if the
+ original URL had cgi-parameters that contained a slash. Nusu's page
+ again.
+
+ - Corrected the NO_PROXY usage. It is a list of substrings that if one of
+ them matches the tail of the host name it should connect to, curl should
+ not use a proxy to connect there. Pointed out to me by Douglas E. Wegscheid
+ <wegscd@whirlpool.com>. I also changed the README text a little regarding
+ this.
+
+ Daniel (16 August 1999)
+ - Fixed a memory bug with http-servers that sent Location: to a Location:
+ page. Nusu's page showed this too.
+
+ - Made cookies work a lot better. Setting the same cookie name several times
+ used to add more cookies instead of replacing the former one which it
+ should've. Nusu <nus@intergorj.ro> brought me an URL that made this
+ painfully visible...
+
+ Troy (15 August 1999)
+ - Brought new .spec files as well as a patch for configure.in that lets the
+ configure script find the openssl files better, even when the include
+ files are in /usr/include/openssl
+
+Version 5.10
+
+ Daniel (13 August 1999)
+ - SSL_CTX_set_default_passwd_cb() has been modified in the 0.9.4 version of
+ OpenSSL. Now why couldn't they simply add a *new* function instead of
+ modifying the parameters of an already existing function? This way, we get
+ a compiler warning if compiling with 0.9.4 but not with earlier. So, I had
+ to come up with a #if contruction that deals with this...
+
+ - Made curl output the SSL version number get displayed properly with 0.9.4.
+
+ Troy (12 August 1999)
+ - Added MingW32 (GCC-2.95) support under Win32. The INSTALL file was also
+ a bit rearranged.
+
+ Daniel (12 August 1999)
+ - I had to copy a good <arpa/telnet.h> include file into the curl source
+ tree to enable the silly win32 systems to compile. The distribution rights
+ allows us to do that as long as the file remains unmodified.
+
+ - I corrected a few minor things that made the compiler complain when
+ -Wall -pedantic was used.
+
+ - I'm moving the official curl web page to http://curl.haxx.nu. I think it
+ will make it easier to remember as it is a lot shorter and less cryptic.
+ The old one still works and shows the same info.
+
+ Daniel (11 August 1999)
+ - Albert Chin-A-Young mailed me another correction for NROFF in the
+ configure.in that is supposed to be better for IRIX users.
+
+ Daniel (10 August 1999)
+ - Albert Chin-A-Young <china@thewrittenword.com> helped me with some stupid
+ Makefile things, as well as some fiddling with the getdate.c
+ stuff that he had problems with under HP-UX v10. getdate.y will now be
+ compiled into getdate.c if the appropriate yacc or bison is found by the
+ configure script. Since this is slightly new, we need to test the output
+ getdate.c with win32 systems to make sure it still compiles there.
+
+ Daniel (5 August 1999)
+ - I've just setup a new mailing list with the intention to keep discussions
+ around libcurl development in it. I mainly expect it to be for thoughts and
+ brainstorming around a "next generation" library, rather than nitpicking
+ about the current implementation or details in the current libcurl.
+
+ To join our happy bunch of future-looking geeks, enter 'subscribe
+ <address>' in the body of a mail and send it to
+ libcurl-request@listserv.fts.frontec.se. Curl bug reports, the usual curl
+ talk and everything else should still be kept in this mailing list. I've
+ started to archive this mailing list and have put the libcurl web page at
+ www.fts.frontec.se/~dast/libcurl/.
+
+ - Stefan Kanthak <Stefan.Kanthak@mchp.siemens.de> contacted me regarding a
+ few problems in the configure script which he discovered when trying to
+ make curl compile and build under Siemens SINIX-Z V5.42B2004!
+
+ - Marcus Klein <m.klein@in-olpe.de> very accurately informed me that
+ src/version.h was not present in the CVS repository. Oh, how silly...
+
+ - Linus Nielsen <Linus.Nielsen@sth.frontec.se> rewrote the telnet:// part and
+ now curl offers limited telnet support. If you run curl like 'curl
+ telnet://host' you'll get all output on the screen and curl will read input
+ from stdin. You'll be able to login and run commands etc, but since the
+ output is buffered, expect to get a little weird output.
+
+ This is still in its infancy and it might get changed. We need your
+ feed-back and input in how this is best done.
+
+ WIN32 NOTE: I bet we'll get problems when trying to compile the current
+ lib/telnet.c on win32, but I think we can sort them out in time.
+
+ - David Sanderson <david@transarc.com> reported that FORCE_ALLOCA_H or
+ HAVE_ALLOCA_H must be defined for getdate.c to compile properly on HP-UX
+ 11.0. I updated the configure script to check for alloca.h which should
+ make it.
+
+ Daniel (4 August 1999)
+ - I finally got to understand Marcus Klein's ftp download resume problem,
+ which turns out to be due to different outputs from different ftp
+ servers. It makes ftp download resuming a little trickier, but I've made
+ some modifications I really believe will work for most ftp servers and I do
+ hope you report if you have problems with this!
+
+ - Added text about file transfer resuming to README.curl.
+
+ Daniel (2 August 1999)
+ - Applied a progress-bar patch from Lars J. Aas <larsa@sim.no>. It offers
+ a new styled progress bar enabled with -#/--progress-bar.
+
+ T. Yamada <tai@imasy.or.jp> (30 July 1999)
+ - It breaks with segfault when 1) curl is using .netrc to obtain
+ username/password (option '-n'), and 2) is auto-matically redirected to
+ another location (option '-L').
+
+ There is a small bug in lib/url.c (block starting from line 641), which
+ tries to take out username/password from user- supplied command-line
+ argument ('-u' option). This block is never executed on first attempt since
+ CONF_USERPWD bit isn't set at first, but curl later turns it on when it
+ checks for CONF_NETRC bit. So when curl tries to redo everything due to
+ redirection, it segfaults trying to access *data->userpwd.
+
+Version 5.9.1
+
+ Daniel (30 July 1999)
+ - Steve Walch <swalch@cisoft.com> pointed out that there is a memory leak in
+ the formdata functions. I added a FormFree() function that is now used and
+ supposed to correct this flaw.
+
+ - Mark Wotton <mwotton@black.ug.cs.usyd.edu.au> reported:
+ 'curl -L https://www.cwa.com.au/' core dumps. I managed to cure this by
+ correcting the cleanup procedure. The bug seems to be gone with my OpenSSL
+ 0.9.2b, although still occurs when I run the ~100 years old SSLeay 0.8.0. I
+ don't know whether it is curl or SSLeay that is to blame for that.
+
+ - Marcus Klein <m.klein@in-olpe.de>:
+ Reported an FTP upload resume bug that I really can't repeat nor understand.
+ I leave it here so that it won't be forgotten.
+
+ Daniel (29 July 1999)
+ - Costya Shulyupin <costya@trivnet.com> suggested support for longer URLs
+ when following Location: and I could only agree and fix it!
+
+ - Leigh Purdie <leighp@defcen.gov.au> found a problem in the upload/POST
+ department. It turned out that http.c accidentaly cleared the pointer
+ instead of the byte counter when supposed to.
+
+ - Costya Shulyupin <costya@trivnet.com> pointed out a problem with port
+ numbers and Location:. If you had a server at a non-standard port that
+ redirected to an URL using a standard port number, curl still used that
+ first port number.
+
+ - Ralph Beckmann <rabe@uni-paderborn.de> pointed out a problem when using both
+ CONF_FOLLOWLOCATION and CONF_FAILONERROR simultaneously. Since the
+ CONF_FAILONERROR exits on the 302-code that the follow location header
+ outputs it will never show any html on location: pages. I have now made it
+ look for >=400 codes if CONF_FOLLOWLOCATION is set.
+
+ - 'struct slist' is now renamed to 'struct curl_slist' (as suggested by Ralph
+ Beckmann).
+
+ - Joshua Swink <jpswink@hotmail.com> and Rick Welykochy <rick@praxis.com.au>
+ were the first to point out to me that the latest OpenSSL package now have
+ moved the standard include path. It is now in
+ /usr/local/ssl/include/openssl and I have now modified the --enable-ssl
+ option for the configure script to use that as the primary path, and I
+ leave the former path too to work with older packages of OpenSSL too.
+
+ Daniel (9 June 1999)
+ - I finally understood the IRIX problem and now it seem to compile on it!
+ I am gonna remove those #define strcasecmp() things once and for all now.
+
+ Daniel (4 June 1999)
+ - I adjusted the FTP reply 227 parser to make the PASV command work better
+ with more ftp servers. Appearantly the Roxen Challanger server replied
+ something curl 5.9 could deal with! :-( Reported by Ashley Reid-Montanaro
+ <ashley@compsoc.man.ac.uk> and Mark Butler <butlerm@xmission.com> brought a
+ solution for it.
+
+ Daniel (26 May 1999)
+ - Rearranged. README is new, the old one is now README.curl and I added a
+ README.libcurl with text I got from Ralph Beckmann <rabe@uni-paderborn.de>.
+
+ - I also updated the INSTALL text.
+
+ Daniel (25 May 1999)
+ - David Jonathan Lowsky <dlowsky@leland.stanford.edu> correctly pointed out
+ that curl didn't properly deal with form posting where the variable
+ shouldn't have any content, as in curl -F "form=" www.site.com. It was
+ now fixed.
+
+Version 5.9
+
+ Daniel (22 May 1999)
+ - I've got a bug report from Aaron Scarisbrick <aaronsca@hotmail.com> in
+ which he states he has some problems with -L under FreeBSD 3.0. I have
+ previously got another bug report from Stefan Grether
+ <stefan.grether@ubs.com> which points at an error with similar sympthoms
+ when using win32. I made the allocation of the new url string a bit faster
+ and different, don't know if it actually improves anything though...
+
+ Daniel (20 May 1999)
+ - Made the cookie parser deal with CRLF newlines too.
+
+ Daniel (19 May 1999)
+ - Download() didn't properly deal with failing return codes from the
+ sread() function. Adam Coyne <adam@gamespy.com> found the problem in the
+ win32 version, and Troy Engel helped me out isolating it.
+
+ Daniel (16 May 1999)
+ - Richard Adams <Richard@Slayford.com> pointed out a bug I introduced in
+ 5.8. --dump-header doesn't work anymore! :-/ I fixed it now.
+
+ - After a suggestion by Joshua Swink <jpswink@hotmail.com> I added -S /
+ --show-error to force curl to display the error message in case of an
+ error, even if -s/--silent was used.
+
+ Daniel (10 May 1999)
+ - I moved the stuff concerning HTTP, DICT and TELNET it their own source
+ files now. It is a beginning on my clean-up of the sources to make them
+ layer all those protocols better to enable more to be added easier in the
+ future!
+
+ - Leon Breedt <ljb@debian.org> sent me some files I've not put into the main
+ curl archive. They're for creating the Debian package thingie. He also sent
+ me a debian package that I've made available for download at the web page
+
+ Daniel (9 May 1999)
+ - Made it compile on cygwin too.
+
+ Troy Engel (7 May 1999)
+ - Brought a series of patches to allow curl to compile smoothly on MSVC++ 6
+ again!
+
+ Daniel (6 May 1999)
+ - I changed the #ifdef HAVE_STRFTIME placement for the -z code so that it
+ will be easier to discover systems that don't have that function and thus
+ can't use -z successfully. Made the strftime() get used if WIN32 is defined
+ too.
+
+Version 5.8
+
+ Daniel (5 May 1999)
+ - I've had it with this autoconf/automake mess. It seems to work allright
+ for most people who don't have automake installed, but for those who have
+ there are problems all over.
+
+ I've got like five different bug reports on this only the last
+ week... Claudio Neves <claudio@nextis.com> and Federico Bianchi
+ <bianchi@pc-arte2.arte.unipi.it> and root <duggerj001@hawaii.rr.com> are
+ some of them reporting this.
+
+ Currently, I have no really good fix since I want to use automake myself to
+ generate the Makefile.in files. I've found out that the @SHELL@-problems
+ can often be fixed by manually invoking 'automake' in the archive root
+ before you run ./configure... I've hacked my maketgz script now to fiddle
+ a bit with this and my tests seem to work better than before at least!
+
+ Daniel (4 May 1999)
+ - mkhelp.pl has been doing badly lately. I corrected a case problem in
+ the regexes.
+
+ - I've now remade the -o option to not touch the file unless it needs to.
+ I had to do this to make -z option really fine, since now you can make a
+ curl fetch and use a local copy's time when downloading to that file, as
+ in:
+
+ curl -z dump -o dump remote.site.com/file.html
+
+ This will only get the file if the remote one is newer than the local.
+ I'm aware that this alters previous behaviour a little. Some scripts out
+ there may depend on that the file is always touched...
+
+ - Corrected a bug in the SSLv2/v3 selection.
+
+ - Felix von Leitner <leitner@math.fu-berlin.de> requested that curl should
+ be able to send "If-Modified-Since" headers, which indeed is a fair idea.
+ I implemented it right away! Try -z <expression> where expression is a full
+ GNU date expression or a file name to get the date from!
+
+ Stephan Lagerholm <stephan@unilog.se> (30 Apr 1999)
+ - Pointed out a problem with the src/Makefile for FreeBSD. The RM variable
+ isn't set and causes the make to fail.
+
+ Daniel (26 April 1999)
+ - Am I silly or what? <Irving_Wolfe@wolfe.net> pointed out to me that the
+ curl version number was not set properly. Hasn't been since 5.6. This was
+ due to a bug in my maketgz script!
+
+ David Eriksson <david@2good.com> (25 Apr 1999)
+ - Found a bug in cookies.c that made it crash at times.
+
+Version 5.7.1
+
+ Doug Kaufman <dkaufman@rahul.net> (23 Apr 1999)
+ - Brought two sunos 4 fixes. One of them being the hostip.c fix mentioned
+ below and the other one a correction in include/stdcheaders.h
+
+ - Added a paragraph about compiling with the US-version of openssl to the
+ INSTALL file.
+
+ Daniel
+ - New mailing list address. Info updated on the web page as well as in the
+ README file
+
+ Greg Onufer <Greg.Onufer@Eng.Sun.COM> (20 Apr 1999)
+ - hostip.c didn't compile properly on SunOS 5.5.1.
+ It needs an #include <sys/types.h>
+
+Version 5.7
+
+ Daniel (Apr 20 1999)
+ - Decided to upload a non-beta version right now!
+
+ - Made curl support any-length HTTP headers. The destination buffer is now
+ simply enlarged every time it turns out to be too small!
+
+ - Added the FAQ file to the archive. Still a bit smallish, but it is a
+ start.
+
+ Eric Thelin <eric@generation-i.com> (15 Apr 1999)
+ - Made -D accept '-' instead of filename to write to stdout.
+
+Version 5.6.3beta
+
+ Daniel (Apr 12 1999)
+
+ - Changed two #ifdef WIN32 to better #ifdef <errorcode> when connect()ing
+ in url.c and ftp.c. Makes cygwin32 deal with them better too. We should
+ try to get some decent win32-replacement there. Anyone?
+
+ - The old -3/--crlf option is now ONLY --crlf!
+
+ - I changed the "SSL fix" to a more lame one, but that doesn't remove as
+ much functionality. Now I've enabled the lib to select what SSL version it
+ should try first. Appearantly some older SSL-servers don't like when you
+ talk v3 with them so you need to be able to force curl to talk v2 from the
+ start. The fix dated April 6 and posted on the mailing list forced curl to
+ use v2 at all times using a modern OpenSSL version, but we don't really
+ want such a crippled solution.
+
+ - Marc Boucher <marc@mbsi.ca> sent me a patch that corrected a math error
+ for the "Curr.Speed" progress meter.
+
+ - Eric Thelin <eric@generation-i.com> sent me a patch that enables '-K -'
+ to read a config file from stdin.
+
+ - I found out we didn't close the file properly before so I added it!
+
+ Daniel (Apr 9 1999)
+ - Yu Xin <is@isee.za.net> pointed out a problem with ftp download resume.
+ It didn't work at all! ;-O
+
+ Daniel (Apr 6 1999)
+ - Corrected the version string part generated for the SSL version.
+
+ - I found a way to make some other SSL page work with openssl 0.9.1+ that
+ previously didn't (ssleay 0.8.0 works with it though!). Trying to get
+ some real info from the OpenSSL guys to see how I should do to behave the
+ best way. SSLeay 0.8.0 shouldn't be that much in use anyway these days!
+
+Version 5.6.2beta
+
+ Daniel (Apr 4 1999)
+ - Finally have curl more cookie "aware". Now read carefully. This is how
+ it works.
+ To make curl read cookies from an already existing file, in plain header-
+ format (like from the headers of a previous fetch) invoke curl with the
+ -b flag like:
+
+ curl -b file http://site/foo.html
+
+ Curl will then use all cookies it finds matching. The old style that sets
+ a single cookie with -b is still supported and is used if the string
+ following -b includes a '=' letter, as in "-b name=daniel".
+
+ To make curl read the cookies sent in combination with a location: (which
+ sites often do) point curl to read a non-existing file at first (i.e
+ to start with no existing cookies), like:
+
+ curl -b nowhere http://site/setcookieandrelocate.html
+
+ - Added a paragraph in the TODO file about the SSL problems recently
+ reported. Evidently, some kind of SSL-problem curl may need to address.
+
+ - Better "Location:" following.
+
+ Douglas E. Wegscheid <wegscd@whirlpool.com> (Tue, 30 Mar 1999)
+ - A subsecond display patch.
+
+ Daniel (Mar 14 1999)
+ - I've separated the version number of libcurl and curl now. To make
+ things a little easier, I decided to start the curl numbering from
+ 5.6 and the former version number known as "curl" is now the one
+ set for libcurl.
+
+ - Removed the 'enable-no-pass' from configure, I doubt anyone wanted
+ that.
+
+ - Made lots of tiny adjustments to compile smoothly with cygwin under
+ win32. It's a killer for porting this to win32, bye bye VC++! ;-)
+ Compiles and builds out-of-the-box now. See the new wordings in
+ INSTALL for details.
+
+ - Beginning experiments with downloading multiple document from a http
+ server while remaining connected.
+
+Version 5.6beta
+
+ Daniel (Mar 13 1999)
+ - Since I've changed so much, I thought I'd just go ahead and implement
+ the suggestion from Douglas E. Wegscheid <wegscd@whirlpool.com>. -D or
+ --dump-header is now storing HTTP headers separately in the specified
+ file.
+
+ - Added new text to INSTALL on what to do to build this on win32 now.
+
+ - Aaargh. I had to take a step back and prefix the shared #include files
+ in the sources with "../include/" to please VC++...
+
+ Daniel (Mar 12 1999)
+ - Split the url.c source into many tiny sources for better readability
+ and smaller size.
+
+ Daniel (Mar 11 1999)
+ - Started to change stuff for a move to make libcurl and a more separate
+ curl application that uses the libcurl. Made the libcurl sources into
+ the new lib directory while the curl application will remain in src as
+ before. New makefiles, adjusted configure script and so.
+
+ libcurl.a built quickly and easily. I better make a better interface to
+ the lib functions though.
+
+ The new root dir include/ is supposed to contain the public information
+ about the new libcurl. It is a little ugly so far :-)
+
+
+ Daniel (Mar 1 1999)
+ - Todd Kaufmann <tkaufmann@adforce.com> sent me a good link to Netscape's
+ cookie spec as well as the info that RFC 2109 specifies how to use them.
+ The link is now in the README and the RFC in the RESOURCES.
+
+ Daniel (Feb 23 1999)
+ - Finally made configure accept --with-ssl to look for SSL libs and includes
+ in the "standard" place /usr/local/ssl...
+
+ Daniel (Feb 22 1999)
+ - Verified that curl linked fine with OpenSSL 0.9.1c which seems to be
+ the most recent.
+
+ Henri Gomez <gomez@slib.fr> (Fri Feb 5 1999)
+ - Sent in an updated curl-ssl.spec. I still miss the script that builds an
+ RPM automatically...
+
+Version 5.5.1
+
+ Mark Butler <butlerm@xmission.com> (27 Jan 1999)
+ - Corrected problems in Download().
+
+ Danitel Stenberg (25 Jan 1999)
+ - Jeremie Petit <Jeremie.Petit@Digital.com> pointed out a few flaws in the
+ source that prevented it from compile warning free with the native
+ compiler under Digital Unix v4.0d.
+
+Version 5.5
+
+ Daniel Stenberg (15 Jan 1999)
+ - Added Bjorns small text to the README about the DICT protocol.
+
+ Daniel Stenberg (11 Jan 1999)
+ - <jswink@softcom.net> reported about the win32-versioin: "Doesn't use
+ ALL_PROXY environment variable". Turned out to be because of the static-
+ buffer nature of the win32 environment variable calls!
+
+ Bjorn Reese <breese@imada.ou.dk> (10 Jan 1999)
+ - I have attached a simple addition for the DICT protocol (RFC 2229).
+ It performs dictionary lookups. The output still needs to be better
+ formatted.
+
+ To test it try (the exact format, and more examples are described in
+ the RFC)
+
+ dict://dict.org/m:hello
+ dict://dict.org/m:hello::soundex
+
+
+ Vicente Garcia <verot@redestb.es> (10 Jan 1999)
+ - Corrected the progress meter for files larger than 20MB.
+
+ Daniel Stenberg (7 Jan 1999)
+ - Corrected the -t and -T help texts. They claimed to be FTP only.
+
+Version 5.4
+
+ Daniel Stenberg
+ (7 Jan 1999)
+ - <Irving_Wolfe@Wolfe.Net> reported that curl -s didn't always supress the
+ progress reporting. It was the form post that autoamtically always switched
+ it on again. This is now corrected!
+
+ (4 Jan 1999)
+ - Andreas Kostyrka <andreas@mtg.co.at> suggested I'd add PUT and he helped me
+ out to test it. If you use -t or -T now on a http or https server, PUT will
+ be used for file upload.
+
+ I removed the former use of -T with HTTP. I doubt anyone ever really used
+ that.
+
+ (4 Jan 1999)
+ - Erik Jacobsen <erik@mint.com> found a width bug in the mprintf() function.
+ I corrected it now.
+
+ (4 Jan 1999)
+ - As John V. Chow <johnchow@brooklinetech.com> pointed out to me, curl
+ accepted very limited URL sizes. It should now accept path parts that are
+ up to at least 4096 bytes.
+
+ - Somehow I screwed up when applying the AIX fix from Gilbert Ramirez, so
+ I redid that now.
+
+Version 5.3a (win32 only)
+
+ Troy Engel
+ - Corrected a win32 bug in the environment variable part.
+
+Version 5.3
+
+ Gilbert Ramirez Jr. (21 Dec 1998)
+ - I have implemented the "quote" function of FTP clients. It allows you to
+ send arbitrary commands to the remote FTP server. I chose the -Q/--quote
+ command-line arguments.
+
+ You can have more than one quoted string, and curl will apply them in
+ order. This is what I use for my MVS upload:
+
+ curl -B --crlf -Q "site lrecl=80" -Q "site blk=8000" -T file ftp://os390/test
+
+ Curl will send the two quoted "site" commands in the proper order.
+
+ - Made it compile smoothly on AIX.
+
+ Gilbert Ramirez Jr. <gram@verdict.uthscsa.edu> (18 Dec 1998)
+ - Brought an MVS patch: -3/--mvs, for ftp upload to the MVS ftp server.
+
+ Troy Engel <tengel@sonic.net> (17 Dec 1998)
+ - Brought a correction that fixes the win32 curl bug.
+
+ Daniel Stenberg
+ - A bug, pointed out to me by Dr H. T. Leung <htl10@cus.cam.ac.uk>, caused
+ curl to crash on the -A flag on certain systems. Actually, all systems
+ should've!
+
+ - Added a few defines to make directories/file names get build nicer (with _
+ instead of . and \ instead of / in win32).
+
+ - steve <fisk@polar.bowdoin.edu> reported a weird bug that occured if the
+ ftp server response line had a parenthesis on the line before the (size)
+ info. I hope it works better now!
+
+Version 5.2.1
+
+ Steven G. Johnson <stevenj@alum.mit.edu> (Dec 14, 1998)
+ - Brought a fix that corrected a crash in 5.2 due to bad treatment of the
+ environment variables.
+
+Version 5.2
+
+ Daniel Stenberg (Dec 14, 1998)
+ - Rewrote the mkhelp script and now, the mkhelp.pl script generates the
+ hugehelp.c file from the README *and* the man page file curl.1. By using
+ both files, I no longer need to have double information in both the man
+ page and the README as well. So, win32-users will only have the hugehelp.c
+ file for all info, but then, they download the plain binary most times
+ anyway.
+
+ - gcc2.8.1 with the -Wall flag complaints a lot on subscript has type `char'
+ if I don't explicitly typecast the argument to isdigit() or isspace() to
+ int. So I did to compile warning free with that too.
+
+ - Added checks for 'long double' and 'long long' in the configure script. I
+ need those for the mprintf.c source to compile well on non long long
+ comforming systems!
+
+Version 5.1 (not publicly released)
+
+ Daniel Stenberg (Dec 10, 1998)
+ - I got a request for a pre-compiled NT Alpha version. Anyone?
+
+ - Added Lynx/CERN www lib proxy environment variable support. That means curl
+ now reads and understands the following environment variables:
+
+ HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY
+
+ They should be set for protocol-specific proxies. General proxy should be
+ set with
+
+ ALL_PROXY
+
+ And a comma-separated list of host names that shouldn't go through any
+ proxy is set in (only an asterisk, '*' matches all hosts).
+
+ NO_PROXY
+
+ The usage of the -x/--proxy flag overrides the environment variables.
+
+ - Proxy can now be specified with a procotol:// prefix.
+
+ - Wrote the curl.1 man page.
+
+ - Introduced a whole new dynamic buffer system for all sprintf()s. It is
+ based on the *printf() package by yours truly and Bjorn Reese. Hopefully,
+ there aren't that many buffer overflow risks left now.
+
+ - Ah, I should mention I've compiled and built curl successfully under
+ solaris 2.6 with gcc now, gcc 2.7.2 won't work but 2.8.1 did ok.
+
+ Oren Tirosh <oren@hishome.net> (Dec 3, 1998)
+ - Brought two .spec files, to use when creating (Linux) Redhat style RPM
+ packages. They're named curl.spec and curl-ssl.spec.
+
+ Troy Engel <tengel@sonic.net>
+ - Supplied the src/Makefile.vc6 for easy compiling with VC++ under Win32.
+
+Version 5.0
+
+ Daniel Stenberg (Dec 1, 1998)
+ - Not a single bug report in ages.
+ - Corrected getpass.c and main.c to compile warning and error free with the
+ Win32 VC++ crap.
+
+Version 5.0 beta 24
+
+ Daniel Stenberg (Nov 20, 1998)
+
+ HOW TO BUILD A RELEASE ARCHIVE:
+
+ * Pre-requisite software:
+ What To build what Reads data from
+ ==== ============= ===============
+ GNU automake Makefile.in, aclocal.m4 configure.in
+ GNU make(1) - " -
+ GNU gcc(1) - " -
+ GNU autoconf configure configure.in
+ GNU autoheader(2) config.h.in configure.in, acconfig.h
+
+ * Make sure all files that should be part of the archive are put in FILES.
+
+ * Run './maketgz' and enter version number of the new to become archive.
+
+ maketgz does:
+
+ - Enters the newly created version number in url.h.
+ - (If you don't have automake, this script will warn about that, but unless
+ you have changed the Makefile.am files, that is nothing to care about.)
+ If you have it, it'll run it.
+ - If you have autoconf, the configure.in will be edited to get the newly
+ created version number and autoconf will be run.
+ - Creates a new directory named curl-<version>. (Actually, it uses the base
+ name of the current directory up to the first '-'.)
+ - Copies all files mentioned in FILES to the new directory. Saving
+ permissions and directory structure.
+ - Uses tar to create an archive of it all, named curl-<version>.tar.gz
+ - gzips the archive
+ - Removes the new directory and all its contents.
+
+ * When done, you have an archive stored in your directory named
+ curl-<version>.tar.gz.
+
+ Done!
+
+ (1) They're required to make automake run properly.
+ (2) It is distributed as a part of the GNU autoconf archive.
+
+ Daniel Stenberg (Nov 18, 1998)
+ - I changed the TAG-system. If you ever used urlget() from this package in
+ another product, you need to recompile with the new headers. I did this
+ new stuff to better deal with different compilers and system with different
+ variable sizes. I think it makes it a little more portable. This proves
+ to compile warning free with the problematic IRIX compiler!
+ - Win32 compiled with a silly error. Corrected now.
+ - Brian Chaplin <bchaplin@capital-mkts.com> reported yet another problem in
+ multiline FTP responses. I've tried to correct it. I mailed him a new
+ version and I hope he gets back soon with positive feedback!
+ - Improved the 'maketgz' to create a temporary directory tree which it makes
+ an archive from instead of the previous renaming of the current one.
+ - Mailing list opened (see README).
+ - Made -v more verbose on the PASV section of ftp transfers. Now it tells
+ host name and IP of the new host (and port number). I also added a section
+ about PORT vs PASV in the README.
+
+Version 5.0 beta 21
+
+ Angus Mackay (Nov 15, 1998)
+ - Introduced automake stuff.
+
+ Daniel Stenberg (Nov 13, 1998)
+ - Just made a successful GET of a document from an SSL-server using my own
+ private certificate for authentication! The certificate has to be in PEM
+ format. You do that the easiest way (although not *that* easy) by
+ downloading the SSLyeay PKCS#12-patch by Dr Stephen N. Henson from his site
+ at: http://www.drh-consultancy.demon.co.uk/. Using his tool, you can
+ convert any modern Netscape or (even) MSIE certificate to PEM-format. Use
+ it with 'curl -E <certificate:password> https://site.com'. If this isn't a
+ cool feature, then I don't know what cool features look like! ;-)
+ - Working slowly on telnet connections. #define TRY_TELNET to try it out.
+ (curl -u user:passwd "telnet://host.com/cat .login" is one example) I do
+ have problem to define how it should work. The prime purpose for this must
+ be to get (8bit clean) files via telnet, and it really isn't that easy to
+ get files this way. Still having problems with \n being converted to \r\n.
+
+ Angus Mackay (Nov 12, 1998)
+ - Corrected another bug in the long parameter name parser.
+ - Modified getpass.c (NOTE: see the special licensing in the top of that
+ source file).
+
+ Daniel Stenberg (Nov 12, 1998)
+ - We may have removed the silly warnings from url.c when compiled under IRIX.
+ Thanks again to Bjorn Reese <breese@imada.ou.dk> and Martin Staael
+ <martin@netgroup.dk>.
+ - Wrote formfind.pl which is a new perl script intended to help you find out
+ how a FORM submission should be done. This needs a little more work to get
+ really good.
+
+ Daniel Stenberg (Nov 11, 1998)
+ - Made the HTTP header-checker accept white spaces before the HTTP/1.? line.
+ Appearantly some proxies/sites add such at times (my test proxy did when I
+ downloaded a gopher page with it)!
+ - Moved the former -h to -M and made -h show the short help text instead. I
+ had to enable a forced help text option. Now an even shorter help text will
+ be presented when an unknown option and similar, is used.
+ - stdcheaders.h didn't work with IRIX 6.4 native cc compiler. I hope my
+ changes don't make other versions go nuts instead.
+
+ Daniel Stenberg (Nov 10, 1998)
+ - Added a weird check in the configure script to check for the silly AIX
+ warnings about my #define strcasecmp() stuff. I do that define to prevent
+ me and other contributors to accidentaly use that function name instead
+ of strequal()...
+ - I bugfixed Angus's getpass.c very little.
+ - Fixed the verbose flag names to getopt-style, i.e 'curl --loc' will be
+ sufficient instead of --location as "loc" is a unique prefix. Also, anything
+ after a '--' is treated as an URL. So if you do have a host with a weeeird
+ name you can do 'curl -- -host.com'.
+ - Another getopt-adjust; curl now accepts flags after the URL on the command
+ line. 'curl www.foo.com -O' is perfectly valid.
+ - Corrected the .curlrc parser so that strtok() is no longer used and I
+ believe it works better. Even URLs can be specified in it now.
+
+ Angus Mackay (Nov 9, 1998)
+ - Replaced getpass.c with a newly written one, not under GPL license
+ - Changed OS to a #define in config.h instead of compiler flag
+ - Makefile now uses -DHAVE_CONFIG_H
+
+ Daniel Stenberg (Nov 9, 1998)
+ - Ok, I expanded the tgz-target to update the version string on each occation
+ I build a release archive!
+ - I reacted on Angus Mackay's initiative and remade the parameter parser to
+ be more getopt compliant. Curl now supports "merged" flags as in
+ curl -lsv ftp.site.com
+ Do note that I had to move three short-names of the options. Parameters
+ that needs an additional string such as -x must be stand-alone or the
+ last in a merged sequence:
+ curl -lsx my-proxy ftp.site.com
+ is ok, but using the flags in a different order like '-lxs' would cause
+ unexpected results (as the 's' option would be skipped).
+ - I've changed the headers in all files that are subject to the MozPL
+ license, as they are supposed to look like when conforming.
+ - Made the configure script make the config.h. The former config.h is now
+ setup.h.
+ - The RESOURCES and TODO files have been added to the archive.
+
+ Angus Mackay <amackay@gus.ml.org> (Nov 5, 1998)
+ - Fixed getpass.c and various configure stuff
+
+ Daniel Stenberg (Nov 3, 1998)
+ - Use -H/--header for custom HTTP-headers. Lets you pass on your own
+ specified headers to the remote server. I wouldn't recommend trying to use
+ a header with a defined usage according to standards. Use this flag once
+ for every custom header you want to add.
+ - Use -B/--ftp-ascii to force ftp to use ASCII mode when transfering files.
+ - Corrected the 'getlinks.pl' script, I accidentally left my silly proxy
+ usage in there! Since the introduction of the .curlrc file, it is easier to
+ write scripts that use curl since proxies and stuff should be in the
+ .curlrc file anyway.
+ - Introducing the new -F flag for HTTP POST. It supports multipart/form-data
+ which means it is gonna be possible to upload files etc through HTTP POST.
+ Shiraz Kanga <skanga@bigfoot.com> asked for the feature and my brother,
+ Björn Stenberg <Bjorn.Stenberg@sth.frontec.se> helped me design the user
+ interface for this beast. This feature requires quite some docs,
+ since it has turned out not only quite capable, but also complicated! :-)
+ - A note here, since I've received mail about it. SSLeay versions prior to
+ 0.8 will *not* work with curl!
+ - Wil Langford <wil@langford.net> reported a bug that occurred since curl
+ did not properly use CRLF when issuing ftp commands. I fixed it.
+ - Rearranged the order config files are read. .curlrc is now *always* read
+ first and before the command line flags. -K config files then act as
+ additional config items.
+ - Use -q AS THE FIRST OPTION specified to prevent .curlrc from being read.
+ - You can now disable a proxy by using -x "". Useful if the .curlrc file
+ specifies a proxy and you wanna fetch something without going through
+ that.
+ - I'm thinking of dropping the -p support. Its really not useful since ports
+ could (and should?) be specified as :<port> appended on the host name
+ instead, both in URLs and to proxy host names.
+ - Martin Staael <martin@netgroup.dk> reports curl -L bugs under Windows NT
+ (test with URL http://come.to/scsde). This bug is not present in this
+ version anymore.
+ - Added support for the weird FTP URL type= thing. You can download a file
+ using ASCII transfer by appending ";type=A" to the right of it. Other
+ available types are type=D for dir-list (NLST) and type=I for binary
+ transfer. I can't say I've ever seen anyone use this kind of URL though!
+ :-)
+ - Troy Engel <tengel@palladium.net> pointed out a bug in my getenv("HOME")
+ usage for win32 systems. I introduce getenv.c to better cope with
+ this. Mr Engel helps me with the details around that...
+ - A little note to myself and others, I should make the win32-binary built
+ with SSL support...
+ - r-y-a-n/n-e-l-s-o-n <ryan@inch.com> sent me comments about building curl
+ with SSL under FreeBSD. See the Makefile for details. Using the configure
+ script, it should work better and automatically now...
+ - Cleaned up in the port number mess in the source. No longer stores and uses
+ proxy port number separate from normal port number.
+ - 'configure' script working. Confirmed compiles on:
+ Host SSL Compiler
+ SunOS 5.5 no gcc
+ SunOS 5.5.1 yes gcc
+ SunOS 5.6 no cc (with gcc, it has the "gcc include files" problem)
+ SunOS 4.1.3 no gcc (without ANSI C headers)
+ SunOS 4.1.2 no gcc (native compiler failed)
+ Linux 2.0.18 no gcc
+ Linux 2.0.32 yes gcc
+ Linux 2.0.35 no gcc (with glibc)
+ IRIX 6.2 no gcc (cc compiles generate a few warnings)
+ IRIX 6.4 no cc (generated warnings though)
+ Win32 no Borland
+ OSF4.0 no ?
+
+ - Ooops. The 5beta (and 4.10) under win32 failed if the HOME variable wasn't
+ set.
+ - When using a proxy, curl now guesses and uses the protocol part in cases
+ like:
+ curl -x proxy:80 www.site.com
+ Proxies normally go nuts unless http:// is prepended to the host name, so
+ if curl is used like this, it guesses protocol and appends the protocol
+ string before passing it to the proxy. It already did this when used
+ without proxy.
+ - Better port usage with SSL through proxy now. If you specified a different
+ https-port when accessing through a proxy, it didn't use that number
+ correctly. I also rewrote the code that parses the stuff read from the
+ proxy when you wanna connect through it with SSL.
+ - Bjorn Reese <breese@imada.ou.dk> helped me work around one of the compiler
+ warnings on IRIX native cc compiles.
+
+Version 4.10 (Oct 26, 1998)
+ Daniel Stenberg
+ - John A. Bristor <jbristor@bellsouth.net> suggested a config file switch,
+ and since I've been having that idea kind of in the background for a long
+ time I rewrote the parameter parsing function a little and now I introduce
+ the -K/--config flag. I also made curl *always* (unless -K is used) try to
+ load the .curlrc file for command line parameters. The syntax for the
+ config file is the standard command line argument style. Details in 'curl
+ -h' or the README.
+ - I removed the -k option. Keep-alive isn't really anything anyone would
+ want to enable with curl anyway.
+ - Martin Staael <Martin@Staael.dk> helped me add the 'irix' target. Now
+ "make irix" should build curl successfully on non-gcc SGI machines.
+ - Single switches now toggle behaviours. I.e if you use -v -v the second
+ will switch off the verbose mode the first one enabled. This is so that
+ you can disable a default setting a .curlrc file enables etc.
+
+Version 4.9 (Oct 7, 1998)
+ Daniel Stenberg
+ - Martin Staael <Martin@Staael.dk> suggested curl would support cookies.
+ I added -b/--cookie to enable free-text cookie data to be passed. There's
+ also a little blurb about general cookie stuff in the README/help text.
+ - dmh <dmh@jet.es> suggested HTTP resume capabilities. Although you could
+ manually get curl to resume HTTP documents, I made the -c resume flag work
+ for HTTP too (unless -r is used too, which would be very odd anyway).
+ - Added checklinks.pl to the archive. It is a still experimental perl script
+ that checks all links of a web page by using curl.
+ - Rearranged the archive hierarchy a little. Build the executable in the
+ src/ dir from now on!
+ - Version 4.9 and hereafter, is no longer released under the GPL license.
+ I have now updated the LEGAL file etc and now this is released using the
+ Mozilla Public License to avoid the plague known as "the GPL virus". You
+ must make the source available if you decide to change and/or redistribute
+ curl, but if you decide to use curl within something else you do not need
+ to offer the world the source to that too.
+ - Curl did not like HTTP servers that sent no headers at all on a GET
+ request. It is a violation of RFC2068 but appearantly some servers do
+ that anyway. Thanks to Gordon Beaton <gordon@erix.ericsson.se> for the
+ report!
+ - -L/--location was added after a suggestion from Martin Staael
+ <Martin@Staael.dk>. This makes curl ATTEMPT to follow the Location:
+ redirect if one is present in the HTTP headers. If -i or -I is used with
+ this flag, you will see headers from all sites the Location: points to. Do
+ note that the first server can point to a second that points to a third
+ etc. It seems the Location: parameter (said to be an AbsoluteURI in
+ RFC2068) isn't always absolute.. :-/ Anyway, I've made curl ATTEMPT to do
+ the best it can to deal with the reality.
+ - Added getlinks.pl to the archive. getlinks.pl selectively downloads
+ files that a web page links to.
+
+Version 4.8.4
+ Daniel Stenberg
+ - As Julian Romero Nieto <jromero@anaya.es> reported, curl reported wrong
+ version number.
+ - As Teemu Yli-Elsila <tylielsi@mail.student.oulu.fi> pointed out,
+ the win32 version of 4.8 (and probably all other versions for win32)
+ didn't work with binary files since I'm too used to the UNIX style
+ fopen() where binary and text don't differ...
+ - Ralph Beckmann <rabe@uni-paderborn.de> brought me some changes that lets
+ curl compile error and warning free with -Wall -pedantic with
+ g++. I also took the opportunity to clean off some unused variables
+ and similar.
+ - Ralph Beckmann <rabe@uni-paderborn.de> made me aware of a really odd bug
+ now corrected. When curl read a set of headers from a HTTP server, divided
+ into more than one read and the first read showed a full line *exactly*
+ (i.e ending with a newline), curl did not behave well.
+
+Version 4.8.3
+ Daniel Stenberg
+ - I was too quick to release 4.8.2 with too little testing. One of the
+ changes is now reverted slightly to the 4.8.1 way since 4.8.2 couldn't
+ upload files. I still think both problems corrected in 4.8.2 remain
+ corrected. Reported by Julian Romero Nieto <jromero@anaya.es>.
+
+Version 4.8.2
+ Daniel Stenberg
+ - Bernhard Iselborn <biselbor@rhrk.uni-kl.de> reported two FTP protocol
+ errors curl did. They're now corrected. Both appeared when getting files
+ from a MS FTP server! :-)
+
+Version 4.8.1
+ Daniel Stenberg
+ - Added a last update of the progress meter when the transfer is done. The
+ final output on the screen didn't have to be the final size transfered
+ which made it sometimes look odd.
+ - Thanks to David Long <long@research.bell-labs.com> I got rid of a silly
+ bug that happened if a HTTP-page had nothing but header. Appearantly
+ Solaris deals with negative sizes in fwrite() calls a lot better than
+ Linux does... =B-]
+
+Version 4.8
+ Daniel Stenberg
+ - Continue FTP file transfer. -c is the switch. Note that you need to
+ specify a file name if you wanna resume a download (you can't resume a
+ download sent to stdout). Resuming upload may be limited by the server
+ since curl is then using the non-RFC959 command SIZE to get the size of
+ the target file before upload begins (to figure out which offset to
+ use). Use -C to specify the offset yourself! -C is handy if you're doing
+ the output to something else but a plain file or when you just want to get
+ the end of a file.
+ - recursiveftpget.pl now features a maximum recursive level argument.
+
+Version 4.7
+ Daniel Stenberg
+ - Added support to abort a download if the speed is below a certain amount
+ (speed-limit) bytes per second for a certain (speed-time) time.
+ - Wrote a perl script 'recursiveftpget.pl' to recursively use curl to get a
+ whole ftp directory tree. It is meant as an example of how curl can be
+ used. I agree it isn't the wisest thing to do to make a separate new
+ connection for each file and directory for this.
+
+Version 4.6
+ Daniel Stenberg
+ - Added a first attempt to optionally parse the .netrc file for login user
+ and password. If used with http, it enables user authentication. -n is
+ the new switch.
+ - Removed the extra newlines on the default user-agent string.
+ - Corrected the missing ftp upload error messages when it failed without the
+ verbose flag set. Gary W. Swearingen found it.
+ - Now using alarm() to enable second-precision timeout even on the name
+ resolving/connecting phase. The timeout is although reset after that first
+ sequence. (This should be corrected.) Gary W. Swearingen <swear@aa.net>
+ reported.
+ - Now spells "Unknown" properly, as in "Unknown option 'z'"... :-)
+ - Added bug report email address in the README.
+ - Added a "current speed" field to the progress meter. It shows the average
+ speed the last 5 seconds. The other speed field shows the average speed of
+ the entire transfer so far.
+
+Version 4.5.1
+ Linas Vepstas
+ - SSL through proxy fix
+ - Added -A to allow User-Agent: changes
+
+ Daniel Stenberg
+ - Made the -A work when SSL-through-proxy.
+
+Version 4.5
+ Linas Vepstas <linas@linas.org>
+ - More SSL corrections
+ - I've added a port to AIX.
+ - running SSL through a proxy causes a chunk of code to be executred twice.
+ one of those blocks needs to be deleted.
+
+ Daniel Stenberg
+ - Made -i and -I work again
+
+Version 4.4
+ Linas Vepstas <linas@us.ibm.com>
+ - -x can now also specify proxyport when used as in 'proxyhost:proxyport'
+ - SSL fixes
+
+Version 4.3
+ Daniel Stenberg
+ - Adjusted to compile under win32 (VisualC++ 5). The -P switch does not
+ support network interface names in win32. I couldn't figure out how!
+
+Version 4.2
+ Linas Vepstas / Sampo Kellomaki
+ - Added SSL / SSLeay support (https://)
+ - Added the -T usage for HTTP POST.
+
+ Daniel Stenberg
+ - Bugfixed the SSL implementation.
+ - Made -P a lot better to use other IP addresses. It now accepts a following
+ parameter that can be either
+ interface - i.e "eth0" to specify which interface's IP address you
+ want to use
+ IP address - i.e "192.168.10.1" to specify exact IP number
+ host name - i.e "my.host.domain" to specify machine
+ "-" - (any single-letter string) to make it pick the machine's
+ default
+ - The Makefile is now ready to compile for solaris, sunos4 and linux right
+ out of the box.
+ - Better generated version string seen with 'curl -V'
+
+Version 4.1
+ Daniel Stenberg
+ - The IP number returned by the ftp server as a reply to PASV does no longer
+ have to DNS resolve. In fact, no IP-number-only addresses have to anymore.
+ - Binds better to available port when -P is used.
+ - Now LISTs ./ instead of / when used as in ftp://ftp.funet.fi/. The reason
+ for this is that exactly that site, ftp.funet.fi, does not allow LIST /
+ while LIST ./ is fine. Any objections?
+
+Version 4 (1998-03-20)
+ Daniel Stenberg
+ - I took another huge step and changed both version number and project name!
+ The reason for the new name is that there are just one too many programs
+ named urlget already and this program already can a lot more than merely
+ getting URLs, and the reason for the version number is that I did add the
+ pretty big change in -P and since I changed name I wanted to start with
+ something fresh!
+ - The --style flags are working better now.
+ - Listing directories with FTP often reported that the file transfer was
+ incomplete. Wrong assumptions were too common for directories, why no
+ size will be attempted to get compared on them from now on.
+ - Implemented the -P flag that let's the ftp control issue a PORT command
+ instead of the standard PASV.
+ - -a for appending FTP uploads works.
+
+***************************************************************************
+
+Version 3.12
+ Daniel Stenberg
+ - End-of-header tracking still lacked support for \r\n or just \n at the
+ end of the last header line.
+ Sergio Barresi <sbarresi@imispa.it>
+ - Added PROXY authentication.
+ Rafael Sagula
+ - Fixed some little bugs.
+
+Version 3.11
+ Daniel Stenberg
+ - The header parsing was still not correct since the 3.2 modification...
+
+Version 3.10
+ Daniel Stenberg
+ - 3.7 and 3.9 were simultaneously developed and merged into this version.
+ - FTP upload did not work correctly since 3.2.
+
+Version 3.9
+ Rafael Sagula
+ - Added the "-e <url> / --referer <url>" option where we can specify
+ the referer page. Obviously, this is necessary only to fool the
+ server, but...
+
+Version 3.7
+ Daniel Stenberg
+ - Now checks the last error code sent from the ftp server after a file has
+ been received or uploaded. Wasn't done previously.
+ - When 'urlget <host>' is used without a 'protocol://' first in the host part,
+ it now checks for host names starting with ftp or gopher and if it does,
+ it uses that protocol by default instead of http.
+
+Version 3.6
+ Daniel Stenberg
+ - Silly mistake made the POST bug. This has now also been tested to work with
+ proxy.
+
+Version 3.5
+ Daniel Stenberg
+ - Highly inspired by Rafael Sagula's changes to the 3.1 that added an almost
+ functional POST, I applied his changes into this version and made them work.
+ (It seems POST requires the Content-Type and Content-Length headers.) It is
+ now usable with the -d switch.
+
+Version 3.3 - 3.4
+ Passed to avoid confusions
+
+Version 3.2
+ Daniel Stenberg
+ - Major rewrite of two crucial parts of this code: upload and download.
+ They are both now using a select() switch, that allows much better
+ progress meter and time control.
+ - alarm() usage removed completely
+ - FTP get can now list directory contents if the path ends with a slash '/'.
+ Urlget on a ftp-path that doesn't end with a slash means urlget will
+ attempt getting it as a file name.
+ - FTP directory view supports -l for "list-only" which lists the file names
+ only.
+ - All operations support -m for max time usage in seconds allowed.
+ - FTP upload now allows the size of the uploaded file to be provided, and
+ thus it can better check it actually uploaded the whole file. It also
+ makes the progress meter for uploads much better!
+ - Made the parameter parsing fail in cases like 'urlget -r 900' which
+ previously tried to connect to the host named '900'.
+
+Version 3.1
+ Kjell Ericson
+ - Pointed out how to correct the 3 warnings in win32-compiles.
+
+ Daniel Stenberg
+ - Removed all calls to exit().
+ - Made the short help text get written to stdout instead of stderr.
+ - Made this file instead of keeping these comments in the source.
+ - Made two callback hooks, that enable external programs to use urlget()
+ easier and to grab the output/offer the input easier.
+ - It is evident that Win32-compiles are painful. I watched the output from
+ the Borland C++ v5 and it was awful. Just ignore all those warnings.
+
+Version 3.0
+ Daniel Stenberg
+ - Added FTP upload capabilities. The name urlget gets a bit silly now
+ when we can put too... =)
+ - Restructured the source quite a lot.
+ Changed the urlget() interface. This way, we will survive changes much
+ better. New features can come and old can be removed without us needing
+ to change the interface. I've written a small explanation in urlget.h
+ that explains it.
+ - New flags include -t, -T, -O and -h. The -h text is generated by the new
+ mkhelp script.
+
+Version 2.9
+ Remco van Hooff
+ - Added a fix to make it compile smoothly on Amiga using the SAS/C
+ compiler.
+
+ Daniel Stenberg
+ - Believe it or not, but the STUPID Novell web server seems to require
+ that the Host: keyword is used, so well I use it and I (re-introduce) the
+ urlget User-Agent:. I still have to check that this Host: usage works with
+ proxies... 'Host:' is required for HTTP/1.1 GET according to RFC2068.
+
+Version 2.8
+ Rafael Sagula
+ - some little modifications
+
+Version 2.7
+ Daniel Stenberg
+ - Removed the -l option and introduced the -f option instead. Now I'll
+ rewrite the former -l kludge in an external script that'll use urlget to
+ fetch multipart files like that.
+ - '-f' is introduced, it means Fail without output in case of HTTP server
+ errors (return code >=300).
+ - Added support for -r, ranges. Specify which part of a document you
+ want, and only that part is returned. Only with HTTP/1.1-servers.
+ - Split up the source in 3 parts. Now all pure URL functions are in
+ urlget.c and stuff that deals with the stand-alone program is in main.c.
+ - I took a few minutes and wrote an embryo of a README file to explain
+ a few things.
+
+Version 2.6
+ Daniel Stenberg
+ - Made the -l (loop) thing use the new CONF_FAILONERROR which makes
+ urlget() return error code if non-successful. It also won't output anything
+ then. Now finally removed the HTTP 1.0 and error 404 dependencies.
+ - Added -I which uses the HEAD request to get the header only from a
+ http-server.
+
+Version 2.5
+ Rafael Sagula
+ - Made the progress meter use HHH:MM:SS instead of only seconds.
+
+Version 2.4
+ Daniel Stenberg
+ - Added progress meter. It appears when downloading > BUFFER SIZE and
+ mute is not selected. I found out that when downloading large files from
+ really really slow sites, it is desirable to know the status of the
+ download. Do note that some downloads are done unawaring of the size, which
+ makes the progress meter less thrilling ;) If the output is sent to a tty,
+ the progress meter is shut off.
+ - Increased buffer size used for reading.
+ - Added length checks in the user+passwd parsing.
+ - Made it grok user+passwd for HTTP fetches. The trick is to base64
+ encode the user+passwd and send an extra header line. Read chapter 11.1 in
+ RFC2068 for details. I added it to be used just like the ftp one. To get a
+ http document from a place that requires user and password, use an URL
+ like:
+
+ http://user:passwd@www.site.to.leach/doc.html
+
+ I also added the -u flag, since WHEN USING A PROXY YOU CAN'T SPECIFY THE
+ USER AND PASSWORD WITH HTTP LIKE THAT. The -u flag works for ftp too, but
+ not if used with proxy. To do the same as the above one, you can invoke:
+
+ urlget -u user:passwd http://www.site.to.leach/doc.html
+
+Version 2.3
+ Rafael Sagula
+ - Added "-o" option (output file)
+ - Added URG_HTTP_NOT_FOUND return code.
+ (Daniel's note:)
+ Perhaps we should detect all kinds of errors and instead of writing that
+ custom string for the particular 404-error, use the error text we actually
+ get from the server. See further details in RFC2068 (HTTP 1.1
+ definition). The current way also relies on a HTTP/1.0 reply, which newer
+ servers might not do.
+ - Looping mode ("-l" option). It's easier to get various split files.
+ (Daniel's note:)
+ Use it like 'urlget -l 1 http://from.this.site/file%d.html', which will
+ make urlget to attempt to fetch all files named file1.html, file2.html etc
+ until no more files are found. This is only a modification of the
+ STAND_ALONE part, nothing in the urlget() function was modfified for this.
+ Daniel Stenberg
+ - Changed the -h to be -i instead. -h should be preserved to help use.
+ - Bjorn Reese indicated that Borland _might_ use '_WIN32' instead of the
+ VC++ WIN32 define and therefore I added a little fix for that.
+
+Version 2.2
+ Johan Andersson
+ - The urlget function didn't set the path to url when using proxy.
+ - Fixed bug with IMC proxy. Now using (almost) complete GET command.
+
+ Daniel Stenberg
+ - Made it compile on Solaris. Had to reorganize the includes a bit.
+ (so Win32, Linux, SunOS 4 and Solaris 2 compile fine.)
+ - Made Johan's keepalive keyword optional with the -k flag (since it
+ makes a lot of urlgets take a lot longer time).
+ - Made a '-h' switch in case you want the HTTP-header in the output.
+
+Version 2.1
+ Daniel Stenberg and Kjell Ericson
+ - Win32-compilable
+ - No more global variables
+ - Mute option (no output at all to stderr)
+ - Full range of return codes from urlget(), which is now written to be a
+ function for easy-to-use in [other] programs.
+ - Define STAND_ALONE to compile the stand alone urlget program
+ - Now compiles with gcc options -ansi -Wall -pedantic ;)
+
+Version 2.0
+ - Introducing ftp GET support. The FTP URL type is recognized and used.
+ - Renamed the project to 'urlget'.
+ - Supports the user+passwd in the FTP URL (otherwise it tries anonymous
+ login with a weird email address as password).
+
+Version 1.5
+ Daniel Stenberg
+ - The skip_header() crap messed it up big-time. By simply removing that
+ one we can all of a sudden download anything ;)
+ - No longer requires a trailing slash on the URLs.
+ - If the given URL isn't prefixed with 'http://', HTTP is assumed and
+ given a try!
+ - 'void main()' is history.
+
+Version 1.4
+ Daniel Stenberg
+ - The gopher source used the ppath variable instead of path which could
+ lead to disaster.
+
+Version 1.3
+ Daniel Stenberg
+ - Well, I added a lame text about the time it took to get the data. I also
+ fought against Johan to prevent his -f option (to specify a file name
+ that should be written instead of stdout)! =)
+ - Made it write 'connection refused' for that particular connect()
+ problem.
+ - Renumbered the version. Let's not make silly 1.0.X versions, this is
+ a plain 1.3 instead.
+
+Version 1.2
+ Johan Andersson
+ - Discovered and fixed the problem with getting binary files. puts() is
+ now replaced with fwrite(). (Daniel's note: this also fixed the buffer
+ overwrite problem I found in the previous version.)
+
+ Rafael Sagula <sagula@inf.ufrgs.br>
+ - Let "-p" before "-x".
+
+ Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+ - Bugfixed the proxy usage. It should *NOT* use nor strip the port number
+ from the URL but simply pass that information to the proxy. This also
+ made the user/password fields possible to use in proxy [ftp-] URLs.
+ (like in ftp://user:password@ftp.my.site:8021/README)
+
+ Johan Andersson <johan@homemail.com>
+ - Implemented HTTP proxy support.
+ - Receive byte counter added.
+
+ Bjorn Reese <breese@imada.ou.dk>
+ - Implemented URLs (and skipped the old syntax).
+ - Output is written to stdout, so to achieve the above example, do:
+ httpget http://143.54.10.6/info_logo.gif > test.gif
+
+Version 1.1
+ Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+ - Adjusted it slightly to accept named hosts on the command line. We
+ wouldn't wanna use IP numbers for the rest of our lifes, would we?
+
+Version 1.0
+ Rafael Sagula <sagula@inf.ufrgs.br>
+ - Wrote the initial httpget, which started all this!
diff --git a/CONTRIBUTE b/CONTRIBUTE
new file mode 100644
index 000000000..e268d4e21
--- /dev/null
+++ b/CONTRIBUTE
@@ -0,0 +1,68 @@
+ Date: 1999-08-04
+
+To Think About When Contributing Source Code
+
+ This document is intended to offer some guidelines that can be useful to
+ keep in mind when you decide to write a contribution to the project. This
+ concerns new features as well as corrections to existing flaws or bugs.
+
+Naming
+
+ Try using a non-confusing naming scheme for your new functions and variable
+ names. It doesn't necessarily have to mean that you should use the same as
+ in other places of the code, just that the names should be logical,
+ understandable and be named according to what they're used for.
+
+Indenting
+
+ Please try using the same indenting levels and bracing method as all the
+ other code already does. It makes the source code a lot easier to follow if
+ all of it is written using the same style. I don't ask you to like it, I
+ just ask you to follow the tradition! ;-)
+
+Commenting
+
+ Comment your source code extensively. I don't see myself as a very good
+ source commenter, but I try to become one. Commented code is quality code
+ and enables future modifications much more. Uncommented code much more risk
+ being completely replaced when someone wants to extend things, since other
+ persons' source code can get quite hard to read.
+
+General Style
+
+ Keep your functions small. If they're small you avoid a lot of mistakes and
+ you don't accidentaly mix up variables.
+
+Non-clobbering All Over
+
+ When you write new functionality or fix bugs, it is important that you
+ don't fiddle all over the source files and functions. Remember that it is
+ likely that other people have done changes in the same source files as you
+ have and possibly even in the same functions. If you bring completely new
+ functionality, try writing it in a new source file. If you fix bugs, try to
+ fix one bug at a time and send them as separate patches.
+
+Separate Patches Doing Different Things
+
+ It is annoying when you get a huge patch from someone that is said to fix 511
+ odd problems, but discussions and opinions don't agree with 510 of them - or
+ 509 of them were already fixed in a different way. Then the patcher needs to
+ extract the single interesting patch from somewhere within the huge pile of
+ source, and that gives a lot of extra work. Preferably, all fixes that
+ correct different problems should be in their own patch with an attached
+ description exactly what they correct so that all patches can be selectively
+ applied by the maintainer or other interested parties.
+
+Document
+
+ Writing docs is dead boring and one of the big problems with many open
+ source projects. Someone's gotta do it. It makes it a lot easier if you
+ submit a small description of your fix or your new features with every
+ contribution so that it can be swiftly added to the package documentation.
+
+Write Access to CVS Repository
+
+ If you are a frequent contributor, or have another good reason, you can of
+ course get write access to the CVS repository and then you'll be able to
+ check-in all your changes straight into the CVS tree instead of sending all
+ changes by mail as patches. Just ask if this is what you'd want.
diff --git a/FAQ b/FAQ
new file mode 100644
index 000000000..dea807e96
--- /dev/null
+++ b/FAQ
@@ -0,0 +1,31 @@
+Date: 19 November 1999
+
+ Frequently Asked Questions about Curl
+
+1. Problems connecting to SSL servers.
+
+ It took a very long time before I could sort out why curl had problems
+ to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+.
+ The error sometimes showed up similar to:
+
+ 16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
+
+ It turned out to be because many older SSL servers don't deal with SSLv3
+ requests properly. To correct this problem, tell curl to select SSLv2 from
+ the command line (-2/--sslv2).
+
+ I have also seen examples where the remote server didn't like the SSLv2
+ request and instead you had to force curl to use SSLv3 with -3/--sslv3.
+
+2. Does curl support resume?
+
+ Yes. Both ways on FTP, download ways on HTTP.
+
+3. Is libcurl thread safe?
+
+ Yes, as far as curl's own code goes. It does use system calls that often
+ aren't thread safe in most environments, such as gethostbyname().
+
+ I am very interested in once and for all getting some kind of report or
+ README file from those who have used libcurl in a threaded environment,
+ since I haven't and I get this question more and more frequently!
diff --git a/FEATURES b/FEATURES
new file mode 100644
index 000000000..18d3d3d44
--- /dev/null
+++ b/FEATURES
@@ -0,0 +1,72 @@
+Misc
+ - full URL syntax
+ - custom maximum download time
+ - custom least download speed acceptable
+ - multiple URLs
+ - guesses protocol from host name unless specified
+ - uses .netrc
+ - progress bar/time specs while downloading
+ - PROXY environment variables support
+ - config file support
+ - compiles on win32
+
+HTTP
+ - GET
+ - PUT
+ - HEAD
+ - POST
+ - multipart POST
+ - authentication
+ - resume
+ - follow redirects
+ - custom HTTP request
+ - cookie get/send
+ - custom headers (that can replace internally generated headers)
+ - custom user-agent string
+ - custom referer string
+ - range
+ - proxy authentication
+ - time conditions
+ - via http-proxy
+
+HTTPS (*1)
+ - (all the HTTP features)
+ - using certificates
+ - via http-proxy
+
+FTP
+ - download
+ - authentication
+ - PORT or PASV
+ - single file size information (compare to HTTP HEAD)
+ - 'type=' URL support
+ - dir listing
+ - dir listing names-only
+ - upload
+ - upload append
+ - upload via http-proxy as HTTP PUT
+ - download resume
+ - upload resume
+ - QUOT commands
+ - simple "range" support
+ - via http-proxy
+
+TELNET
+ - connection negotiation
+ - stdin/stdout I/O
+
+LDAP (*2)
+ - full LDAP URL support
+
+DICT
+ - extended DICT URL support
+
+GOPHER
+ - GET
+ - via http-proxy
+
+FILE
+ - URL support
+
+ *1 = requires OpenSSL
+ *2 = requires OpenLDAP
diff --git a/FILES b/FILES
new file mode 100644
index 000000000..d26a3c01f
--- /dev/null
+++ b/FILES
@@ -0,0 +1,47 @@
+CHANGES
+CONTRIBUTE
+FEATURES
+FAQ
+FILES
+INSTALL
+LEGAL
+MPL-1.0.txt
+README
+README.curl
+README.libcurl
+curl.1
+*spec
+RESOURCES
+TODO
+maketgz
+Makefile.in
+Makefile.am
+acconfig.h
+aclocal.m4
+config.guess
+config.h.in
+config.sub
+configure
+configure.in
+install-sh
+missing
+mkinstalldirs
+reconf
+stamp-h.in
+perl/README
+perl/*.pl.in
+src/*.[ch]
+src/*in
+src/*am
+src/mkhelp.pl
+src/Makefile.vc6
+src/*m32
+lib/getdate.y
+lib/*.[ch]
+lib/*in
+lib/*am
+lib/Makefile.vc6
+lib/*m32
+include/README
+include/curl/*.h
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 000000000..a2e389433
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,195 @@
+ _ _ ____ _
+ ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+ How To Compile
+
+UNIX
+====
+
+ The configure script *always* tries to find a working SSL library unless
+ explicitely told not to. If you have SSLeay or OpenSSL installed in the
+ default search path for your compiler/linker, you don't need to do anything
+ special.
+
+ If you have SSLeay or OpenSSL installed in /usr/local/ssl, you can
+ run configure like so:
+
+ ./configure --with-ssl
+
+ If you have SSLeay or OpenSSL installed somewhere else (for example,
+ /opt/OpenSSL,) you can run configure like this:
+
+ ./configure --with-ssl=/opt/OpenSSL
+
+ If you insist on forcing a build *without* SSL support, even though you may
+ have it installed in your system, you can run configure like this:
+
+ ./configure --without-ssl
+
+ If you have SSLeay or OpenSSL installed, but with the libraries in
+ one place and the header files somewhere else, you'll have to set the
+ LDFLAGS and CPPFLAGS environment variables prior to running configure.
+ Something like this should work:
+
+ (with the Bourne shell and its clones):
+
+ CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
+ ./configure
+
+ (with csh, tcsh and their clones):
+
+ env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
+ ./configure
+
+ If your SSL library was compiled with rsaref (usually for use in
+ the United States), you may also need to set:
+
+ LIBS=-lRSAglue -lrsaref
+ (from Doug Kaufman <dkaufman@rahul.net>)
+
+ Without SSL support, just run:
+
+ ./configure
+
+ Then run:
+
+ make
+
+ Use the executable `curl` in src/ directory.
+
+ 'make install' copies the curl file to /usr/local/bin/ (or $prefix/bin
+ if you used the --prefix option to configure) and copies the curl.1
+ man page to a suitable place too.
+
+ KNOWN PROBLEMS
+
+ If you happen to have autoconf installed, but a version older than
+ 2.12 you will get into trouble. Then you can still build curl by
+ issuing these commands: (from Ralph Beckmann <rabe@uni-paderborn.de>)
+
+ ./configure [...]
+ cd lib; make; cd ..
+ cd src; make; cd ..
+ cp src/curl elsewhere/bin/
+
+ OPTIONS
+
+ Remember, to force configure to use the standard cc compiler if both
+ cc and gcc are present, run configure like
+
+ CC=cc ./configure
+ or
+ env Cc=cc ./configure
+
+
+Win32
+=====
+
+ Without SSL:
+
+ MingW32 (GCC-2.95) style
+ ------------------------
+ Run the 'mingw32.bat' file to get the proper environment variables
+ set, then run 'make -f Makefile.m32' in the lib/ dir and then
+ 'make -f Makefile.m32' in the src/ dir.
+
+ If you have any problems linking libraries or finding header files,
+ be sure to look at the provided "Makefile.m32" files for the proper
+ paths, and adjust as necessary.
+
+ Cygwin style
+ ------------
+ Almost identical to the unix installation. Run the configure script
+ in the curl root with 'sh configure'. Make sure you have the sh
+ executable in /bin/ or you'll see the configure fail towards the
+ end.
+
+ Run 'make'
+
+ Microsoft command line style
+ ----------------------------
+ Run the 'vcvars32.bat' file to get the proper environment variables
+ set, then run 'nmake -f Makefile.vc6' in the lib/ dir and then
+ 'nmake -f Makefile.vc6' in the src/ dir.
+
+ IDE-style
+ -------------------------
+ If you use VC++, Borland or similar compilers. Include all lib source
+ files in a static lib "project" (all .c and .h files that is).
+ (you should name it libcurl or similar)
+
+ Make the sources in the src/ drawer be a "win32 console application"
+ project. Name it curl.
+
+ With VC++, add 'wsock32.lib' to the link libs when you build curl!
+ Borland seems to do that itself magically. Of course you have to
+ make sure it links with the libcurl too!
+
+ For VC++ 6, there's an included Makefile.vc6 that should be possible
+ to use out-of-the-box.
+
+ Microsoft note: add /Zm200 to the compiler options, as the hugehelp.c
+ won't compile otherwise due to "too long puts string" or something
+ like that!
+
+
+ With SSL:
+
+ MingW32 (GCC-2.95) style
+ ------------------------
+ Run the 'mingw32.bat' file to get the proper environment variables
+ set, then run 'make -f Makefile.m32 SSL=1' in the lib/ dir and then
+ 'make -f Makefile.m32 SSL=1' in the src/ dir.
+
+ If you have any problems linking libraries or finding header files,
+ be sure to look at the provided "Makefile.m32" files for the proper
+ paths, and adjust as necessary.
+
+ Cygwin style
+ ------------
+
+ Haven't done, nor got any reports on how to do. It should although be
+ identical to the unix setup for the same purpose. See above.
+
+ Microsoft command line style
+ ----------------------------
+ Run the 'vcvars32.bat' file to get the proper environment variables
+ set, then run 'nmake -f Makefile.vc6 release-ssl' in the lib/ dir and
+ then 'nmake -f Makefile.vc6' in the src/ dir.
+
+ Microsoft / Borland style
+ -------------------------
+ If you have OpenSSL/SSLeay, and want curl to take advantage of it,
+ edit your project properties to use the SSL include path, link with
+ the SSL libs and define the USE_SSLEAY symbol.
+
+
+OpenSSL/SSLeay
+==============
+
+ You'll find OpenSSL information at:
+
+ http://www.openssl.org
+
+
+MingW32/Cygwin
+==============
+
+ You'll find MingW32 and Cygwin information at:
+
+ http://www.xraylith.wisc.edu/~khan/software/gnu-win32/index.html
+
+OpenLDAP
+========
+
+ You'll find OpenLDAP information at:
+
+ http://www.openldap.org
+
+ You need to install it with shared libraries, which is enabled when running
+ the ldap configure script with "--enable-shared". With my linux 2.0.36
+ kernel I also had to disable using threads (with --without-threads),
+ because the configure script couldn't figure out my system.
diff --git a/LEGAL b/LEGAL
new file mode 100644
index 000000000..cc1143c7d
--- /dev/null
+++ b/LEGAL
@@ -0,0 +1,21 @@
+Part of this software is distributed under the Mozilla Public License
+version 1.0, which is part of this distribution (MPL-1.0.txt) and
+available on-line at http://www.mozilla.org/MPL/
+
+The terminology used here is described in the Mozilla Public License.
+
+In accordance with section "4. Inability to Comply Due to Statute or
+Regulation" the following exemptions apply to this software:
+
+ * The Initial Developer has the right, regardless of the citizenship
+ of any involved party, to choose the location for settling disputes
+ as refered to under section "11. Miscellaneous" of the Mozilla Public
+ License.
+
+Initial Developers of this software are:
+
+ Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+ Rafael Linden Sagula <sagula@inf.ufrgs.br>
+
+Curl is Copyright (C) 1996-1998 Daniel Stenberg and Rafael Linden Sagula
+ \ No newline at end of file
diff --git a/MPL-1.0.txt b/MPL-1.0.txt
new file mode 100644
index 000000000..f7f2ff185
--- /dev/null
+++ b/MPL-1.0.txt
@@ -0,0 +1,360 @@
+ MOZILLA PUBLIC LICENSE
+ Version 1.0
+
+ ----------------
+
+1. Definitions.
+
+ 1.1. ``Contributor'' means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. ``Contributor Version'' means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. ``Covered Code'' means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. ``Electronic Distribution Mechanism'' means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. ``Executable'' means Covered Code in any form other than Source
+ Code.
+
+ 1.6. ``Initial Developer'' means the individual or entity identified as
+ the Initial Developer in the Source Code notice required by Exhibit A.
+
+ 1.7. ``Larger Work'' means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. ``License'' means this document.
+
+ 1.9. ``Modifications'' means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. ``Original Code'' means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this License
+ is not already Covered Code governed by this License.
+
+ 1.11. ``Source Code'' means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus any
+ associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or a list of source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. ``You'' means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License or a future
+ version of this License issued under Section 6.1. For legal entities,
+ ``You'' includes any entity which controls, is controlled by, or is
+ under common control with You. For purposes of this definition,
+ ``control'' means (a) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (b) ownership of fifty percent (50%) or more of the
+ outstanding shares or beneficial ownership of such entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+
+ (a) to use, reproduce, modify, display, perform, sublicense and
+ distribute the Original Code (or portions thereof) with or without
+ Modifications, or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by Initial
+ Developer, to make, have made, use and sell (``Utilize'') the
+ Original Code (or portions thereof), but solely to the extent that
+ any such patent is reasonably necessary to enable You to Utilize
+ the Original Code (or portions thereof) and not to any greater
+ extent that may be necessary to Utilize further Modifications or
+ combinations.
+
+ 2.2. Contributor Grant.
+ Each Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+
+ (a) to use, reproduce, modify, display, perform, sublicense and
+ distribute the Modifications created by such Contributor (or
+ portions thereof) either on an unmodified basis, with other
+ Modifications, as Covered Code or as part of a Larger Work; and
+
+ (b) under patents now or hereafter owned or controlled by
+ Contributor, to Utilize the Contributor Version (or portions
+ thereof), but solely to the extent that any such patent is
+ reasonably necessary to enable You to Utilize the Contributor
+ Version (or portions thereof), and not to any greater extent that
+ may be necessary to Utilize further Modifications or combinations.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be distributed
+ only under the terms of this License or a future version of this
+ License released under Section 6.1, and You must include a copy of this
+ License with every copy of the Source Code You distribute. You may not
+ offer or impose any terms on any Source Code version that alters or
+ restricts the applicable version of this License or the recipients'
+ rights hereunder. However, You may include an additional document
+ offering the additional rights described in Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which you contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that the
+ Modification is derived, directly or indirectly, from Original Code
+ provided by the Initial Developer and including the name of the Initial
+ Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+
+ (a) Third Party Claims.
+ If You have knowledge that a party claims an intellectual property
+ right in particular functionality or code (or its utilization
+ under this License), you must include a text file with the source
+ code distribution titled ``LEGAL'' which describes the claim and
+ the party making the claim in sufficient detail that a recipient
+ will know whom to contact. If you obtain such knowledge after You
+ make Your Modification available as described in Section 3.2, You
+ shall promptly modify the LEGAL file in all copies You make
+ available thereafter and shall take other steps (such as notifying
+ appropriate mailing lists or newsgroups) reasonably calculated to
+ inform those who received the Covered Code that new knowledge has
+ been obtained.
+
+ (b) Contributor APIs.
+ If Your Modification is an application programming interface and
+ You own or control patents which are reasonably necessary to
+ implement that API, you must also include this information in the
+ LEGAL file.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code, and this License in any documentation for the Source Code, where
+ You describe recipients' rights relating to Covered Code. If You
+ created one or more Modification(s), You may add your name as a
+ Contributor to the notice described in Exhibit A. If it is not possible
+ to put such notice in a particular Source Code file due to its
+ structure, then you must include such notice in a location (such as a
+ relevant directory file) where a user would be likely to look for such
+ a notice. You may choose to offer, and to charge a fee for, warranty,
+ support, indemnity or liability obligations to one or more recipients
+ of Covered Code. However, You may do so only on Your own behalf, and
+ not on behalf of the Initial Developer or any Contributor. You must
+ make it absolutely clear than any such warranty, support, indemnity or
+ liability obligation is offered by You alone, and You hereby agree to
+ indemnify the Initial Developer and every Contributor for any liability
+ incurred by the Initial Developer or such Contributor as a result of
+ warranty, support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of the
+ Covered Code is available under the terms of this License, including a
+ description of how and where You have fulfilled the obligations of
+ Section 3.2. The notice must be conspicuously included in any notice in
+ an Executable version, related documentation or collateral in which You
+ describe recipients' rights relating to the Covered Code. You may
+ distribute the Executable version of Covered Code under a license of
+ Your choice, which may contain terms different from this License,
+ provided that You are in compliance with the terms of this License and
+ that the license for the Executable version does not attempt to limit
+ or alter the recipient's rights in the Source Code version from the
+ rights set forth in this License. If You distribute the Executable
+ version under a different license You must make it absolutely clear
+ that any terms which differ from this License are offered by You alone,
+ not by the Initial Developer or any Contributor. You hereby agree to
+ indemnify the Initial Developer and every Contributor for any liability
+ incurred by the Initial Developer or such Contributor as a result of
+ any such terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to statute
+ or regulation then You must: (a) comply with the terms of this License
+ to the maximum extent possible; and (b) describe the limitations and
+ the code they affect. Such description must be included in the LEGAL
+ file described in Section 3.4 and must be included with all
+ distributions of the Source Code. Except to the extent prohibited by
+ statute or regulation, such description must be sufficiently detailed
+ for a recipient of ordinary skill to be able to understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A, and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation (``Netscape'') may publish revised
+ and/or new versions of the License from time to time. Each version will
+ be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If you create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), you must (a) rename Your license so that the
+ phrases ``Mozilla'', ``MOZILLAPL'', ``MOZPL'', ``Netscape'', ``NPL'' or
+ any confusingly similar phrase do not appear anywhere in your license
+ and (b) otherwise make it clear that your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial Developer,
+ Original Code or Contributor in the notice described in Exhibit A shall
+ not of themselves be deemed to be modifications of this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN ``AS IS'' BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER
+ PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF
+ GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND
+ ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE
+ BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT
+ EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a ``commercial item,'' as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of ``commercial computer
+ software'' and ``commercial computer software documentation,'' as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if any,
+ provides otherwise), excluding its conflict-of-law provisions. With
+ respect to disputes in which at least one party is a citizen of, or an
+ entity chartered or registered to do business in, the United States of
+ America: (a) unless otherwise agreed in writing, all disputes relating
+ to this License (excepting any dispute relating to intellectual
+ property rights) shall be subject to final and binding arbitration,
+ with the losing party paying all costs of arbitration; (b) any
+ arbitration relating to this Agreement shall be held in Santa Clara
+ County, California, under the auspices of JAMS/EndDispute; and (c) any
+ litigation relating to this Agreement shall be subject to the
+ jurisdiction of the Federal Courts of the Northern District of
+ California, with venue lying in Santa Clara County, California, with
+ the losing party responsible for costs, including without limitation,
+ court costs and reasonable attorneys fees and expenses. The application
+ of the United Nations Convention on Contracts for the International
+ Sale of Goods is expressly excluded. Any law or regulation which
+ provides that the language of a contract shall be construed against the
+ drafter shall not apply to this License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ Except in cases where another Contributor has failed to comply with
+ Section 3.4, You are responsible for damages arising, directly or
+ indirectly, out of Your utilization of rights under this License, based
+ on the number of copies of Covered Code you made available, the
+ revenues you received from utilizing such rights, and other relevant
+ factors. You agree to work with affected parties to distribute
+ responsibility on an equitable basis.
+
+EXHIBIT A.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.''
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..0eaf99620
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,426 @@
+# Generated automatically from Makefile.in by configure.
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = .
+prefix = /usr/local
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+mandir = ${prefix}/man
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/curl
+pkglibdir = $(libdir)/curl
+pkgincludedir = $(includedir)/curl
+
+top_builddir = .
+
+ACLOCAL = aclocal
+AUTOCONF = autoconf
+AUTOMAKE = automake
+AUTOHEADER = autoheader
+
+INSTALL = ./install-sh -c
+INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+transform = s,x,x,
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = sparc-sun-solaris2.6
+host_triplet = sparc-sun-solaris2.6
+CC = gcc
+MAKEINFO = makeinfo
+NROFF = /bin/nroff
+PACKAGE = curl
+PERL = /usr/local/bin/perl
+RANLIB = ranlib
+VERSION = 6.3.1
+YACC = bison -y
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+man_MANS = curl.1
+
+EXTRA_DIST = $(man_MANS)
+
+SUBDIRS = lib src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h ./src/config.h
+CONFIG_CLEAN_FILES =
+man1dir = $(mandir)/man1
+MANS = $(man_MANS)
+DIST_COMMON = README ./stamp-h1.in INSTALL Makefile.am Makefile.in TODO \
+acconfig.h aclocal.m4 config.guess config.h.in config.sub configure \
+configure.in install-sh missing mkinstalldirs src/config.h.in \
+src/stamp-h2.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): configure.in
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h1 2> /dev/null
+$(srcdir)/config.h.in: $(srcdir)/stamp-h1.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h1.in; \
+ $(MAKE) $(srcdir)/stamp-h1.in; \
+ else :; fi
+$(srcdir)/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h1.in 2> /dev/null
+
+src/config.h: src/stamp-h2
+ @if test ! -f $@; then \
+ rm -f src/stamp-h2; \
+ $(MAKE) src/stamp-h2; \
+ else :; fi
+src/stamp-h2: $(srcdir)/src/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > src/stamp-h2 2> /dev/null
+$(srcdir)/src/config.h.in: $(srcdir)/src/stamp-h2.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/src/stamp-h2.in; \
+ $(MAKE) $(srcdir)/src/stamp-h2.in; \
+ else :; fi
+$(srcdir)/src/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/src/stamp-h2.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h src/config.h
+
+maintainer-clean-hdr:
+
+install-man1:
+ $(mkinstalldirs) $(DESTDIR)$(man1dir)
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+ done
+
+uninstall-man1:
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+ rm -f $(DESTDIR)$(man1dir)/$$inst; \
+ done
+install-man: $(MANS)
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-man1
+uninstall-man:
+ @$(NORMAL_UNINSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am: install-man
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-man
+uninstall: uninstall-recursive
+all-am: Makefile $(MANS) config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man1
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+install-man1 uninstall-man1 install-man uninstall-man \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 000000000..b5b81a564
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,13 @@
+#
+# $Id$
+#
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+man_MANS = curl.1
+
+EXTRA_DIST = $(man_MANS)
+
+SUBDIRS = lib src
+
+
diff --git a/Makefile.dist b/Makefile.dist
new file mode 100644
index 000000000..843091df0
--- /dev/null
+++ b/Makefile.dist
@@ -0,0 +1,78 @@
+############################################################################
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.0 (the "License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# The Original Code is Curl.
+#
+# The Initial Developer of the Original Code is Daniel Stenberg.
+#
+# Portions created by the Initial Developer are Copyright (C) 1999.
+# All Rights Reserved.
+#
+# ------------------------------------------------------------
+# Main author:
+# - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+#
+# http://curl.haxx.nu
+#
+# $Source$
+# $Revision$
+# $Date$
+# $Author$
+# $State$
+# $Locker$
+#
+# ------------------------------------------------------------
+#
+# In a normal unix-setup, this file will become overwritten.
+#
+############################################################################
+
+all:
+ ./configure
+ make
+
+ssl:
+ ./configure --with-ssl
+ make
+
+mingw32:
+ cd lib; make -f Makefile.m32
+ cd src; make -f Makefile.m32
+
+mingw32-ssl:
+ cd lib; make -f Makefile.m32 SSL=1
+ cd src; make -f Makefile.m32 SSL=1
+
+vc:
+ cd lib; nmake -f Makefile.vc6
+ cd src; nmake -f Makefile.vc6
+
+cygwin:
+ ./configure
+ make
+
+cygwin-ssl:
+ ./configure --with-ssl
+ make
+
+unix: all
+
+unix-ssl: ssl
+
+linux: all
+
+linux-ssl: ssl
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 000000000..18fa70152
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,426 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+MAKEINFO = @MAKEINFO@
+NROFF = @NROFF@
+PACKAGE = @PACKAGE@
+PERL = @PERL@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+man_MANS = curl.1
+
+EXTRA_DIST = $(man_MANS)
+
+SUBDIRS = lib src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h ./src/config.h
+CONFIG_CLEAN_FILES =
+man1dir = $(mandir)/man1
+MANS = $(man_MANS)
+DIST_COMMON = README ./stamp-h1.in INSTALL Makefile.am Makefile.in TODO \
+acconfig.h aclocal.m4 config.guess config.h.in config.sub configure \
+configure.in install-sh missing mkinstalldirs src/config.h.in \
+src/stamp-h2.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): configure.in
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h1 2> /dev/null
+$(srcdir)/config.h.in: $(srcdir)/stamp-h1.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h1.in; \
+ $(MAKE) $(srcdir)/stamp-h1.in; \
+ else :; fi
+$(srcdir)/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h1.in 2> /dev/null
+
+src/config.h: src/stamp-h2
+ @if test ! -f $@; then \
+ rm -f src/stamp-h2; \
+ $(MAKE) src/stamp-h2; \
+ else :; fi
+src/stamp-h2: $(srcdir)/src/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > src/stamp-h2 2> /dev/null
+$(srcdir)/src/config.h.in: $(srcdir)/src/stamp-h2.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/src/stamp-h2.in; \
+ $(MAKE) $(srcdir)/src/stamp-h2.in; \
+ else :; fi
+$(srcdir)/src/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/src/stamp-h2.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h src/config.h
+
+maintainer-clean-hdr:
+
+install-man1:
+ $(mkinstalldirs) $(DESTDIR)$(man1dir)
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+ done
+
+uninstall-man1:
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+ rm -f $(DESTDIR)$(man1dir)/$$inst; \
+ done
+install-man: $(MANS)
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-man1
+uninstall-man:
+ @$(NORMAL_UNINSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am: install-man
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-man
+uninstall: uninstall-recursive
+all-am: Makefile $(MANS) config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man1
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+install-man1 uninstall-man1 install-man uninstall-man \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/README b/README
new file mode 100644
index 000000000..e7754b592
--- /dev/null
+++ b/README
@@ -0,0 +1,28 @@
+ _ _ ____ _
+ ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+README
+
+ Curl is a command line tool for transfering data specified with URL
+ syntax. Find out how to use Curl by reading the curl.1 man page or the
+ README.curl document. Find out how to install Curl by reading the INSTALL
+ document.
+
+ libcurl is a link-library that Curl is using to to its job. It is readily
+ available to be used by your software. Read the README.libcurl document to
+ find out how!
+
+ You find answers to the most frequent questions we get in the FAQ document.
+
+ Always try the Curl web site for the latest news:
+
+ http://curl.haxx.nu
+
+ The official download mirror sites are:
+
+ Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
+ Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
+ China -- http://www.pshowing.com/curl/
diff --git a/README.curl b/README.curl
new file mode 100644
index 000000000..00f685e41
--- /dev/null
+++ b/README.curl
@@ -0,0 +1,611 @@
+LATEST VERSION
+
+ You always find news about what's going on as well as the latest versions
+ from the curl web pages, located at:
+
+ http://curl.haxx.nu
+
+SIMPLE USAGE
+
+ Get the main page from netscape's web-server:
+
+ curl http://www.netscape.com/
+
+ Get the root README file from funet's ftp-server:
+
+ curl ftp://ftp.funet.fi/README
+
+ Get a gopher document from funet's gopher server:
+
+ curl gopher://gopher.funet.fi
+
+ Get a web page from a server using port 8000:
+
+ curl http://www.weirdserver.com:8000/
+
+ Get a list of the root directory of an FTP site:
+
+ curl ftp://ftp.fts.frontec.se/
+
+ Get the definition of curl from a dictionary:
+
+ curl dict://dict.org/m:curl
+
+DOWNLOAD TO A FILE
+
+ Get a web page and store in a local file:
+
+ curl -o thatpage.html http://www.netscape.com/
+
+ Get a web page and store in a local file, make the local file get the name
+ of the remote document (if no file name part is specified in the URL, this
+ will fail):
+
+ curl -O http://www.netscape.com/index.html
+
+USING PASSWORDS
+
+ FTP
+
+ To ftp files using name+passwd, include them in the URL like:
+
+ curl ftp://name:passwd@machine.domain:port/full/path/to/file
+
+ or specify them with the -u flag like
+
+ curl -u name:passwd ftp://machine.domain:port/full/path/to/file
+
+ HTTP
+
+ The HTTP URL doesn't support user and password in the URL string. Curl
+ does support that anyway to provide a ftp-style interface and thus you can
+ pick a file like:
+
+ curl http://name:passwd@machine.domain/full/path/to/file
+
+ or specify user and password separately like in
+
+ curl -u name:passwd http://machine.domain/full/path/to/file
+
+ NOTE! Since HTTP URLs don't support user and password, you can't use that
+ style when using Curl via a proxy. You _must_ use the -u style fetch
+ during such circumstances.
+
+ HTTPS
+
+ Probably most commonly used with private certificates, as explained below.
+
+ GOPHER
+
+ Curl features no password support for gopher.
+
+PROXY
+
+ Get an ftp file using a proxy named my-proxy that uses port 888:
+
+ curl -x my-proxy:888 ftp://ftp.leachsite.com/README
+
+ Get a file from a HTTP server that requires user and password, using the
+ same proxy as above:
+
+ curl -u user:passwd -x my-proxy:888 http://www.get.this/
+
+ Some proxies require special authentication. Specify by using -U as above:
+
+ curl -U user:passwd -x my-proxy:888 http://www.get.this/
+
+ See also the environment variables Curl support that offer further proxy
+ control.
+
+RANGES
+
+ With HTTP 1.1 byte-ranges were introduced. Using this, a client can request
+ to get only one or more subparts of a specified document. Curl supports
+ this with the -r flag.
+
+ Get the first 100 bytes of a document:
+
+ curl -r 0-99 http://www.get.this/
+
+ Get the last 500 bytes of a document:
+
+ curl -r -500 http://www.get.this/
+
+ Curl also supports simple ranges for FTP files as well. Then you can only
+ specify start and stop position.
+
+ Get the first 100 bytes of a document using FTP:
+
+ curl -r 0-99 ftp://www.get.this/README
+
+UPLOADING
+
+ FTP
+
+ Upload all data on stdin to a specified ftp site:
+
+ curl -t ftp://ftp.upload.com/myfile
+
+ Upload data from a specified file, login with user and password:
+
+ curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile
+
+ Upload a local file to the remote site, and use the local file name remote
+ too:
+
+ curl -T uploadfile -u user:passwd ftp://ftp.upload.com/
+
+ NOTE: Curl is not currently supporing ftp upload through a proxy! The reason
+ for this is simply that proxies are seldomly configured to allow this and
+ that no author has supplied code that makes it possible!
+
+ HTTP
+
+ Upload all data on stdin to a specified http site:
+
+ curl -t http://www.upload.com/myfile
+
+ Note that the http server must've been configured to accept PUT before this
+ can be done successfully.
+
+ For other ways to do http data upload, see the POST section below.
+
+VERBOSE / DEBUG
+
+ If curl fails where it isn't supposed to, if the servers don't let you
+ in, if you can't understand the responses: use the -v flag to get VERBOSE
+ fetching. Curl will output lots of info and all data it sends and
+ receives in order to let the user see all client-server interaction.
+
+ curl -v ftp://ftp.upload.com/
+
+DETAILED INFORMATION
+
+ Different protocols provide different ways of getting detailed information
+ about specific files/documents. To get curl to show detailed information
+ about a single file, you should use -I/--head option. It displays all
+ available info on a single file for HTTP and FTP. The HTTP information is a
+ lot more extensive.
+
+ For HTTP, you can get the header information (the same as -I would show)
+ shown before the data by using -i/--include. Curl understands the
+ -D/--dump-header option when getting files from both FTP and HTTP, and it
+ will then store the headers in the specified file.
+
+ Store the HTTP headers in a separate file:
+
+ curl --dump-header headers.txt curl.haxx.nu
+
+ Note that headers stored in a separate file can be very useful at a later
+ time if you want curl to use cookies sent by the server. More about that in
+ the cookies section.
+
+POST (HTTP)
+
+ It's easy to post data using curl. This is done using the -d <data>
+ option. The post data must be urlencoded.
+
+ Post a simple "name" and "phone" guestbook.
+
+ curl -d "name=Rafael%20Sagula&phone=3320780" \
+ http://www.where.com/guest.cgi
+
+ While -d uses the application/x-www-form-urlencoded mime-type, generally
+ understood by CGI's and similar, curl also supports the more capable
+ multipart/form-data type. This latter type supports things like file upload.
+
+ -F accepts parameters like -F "name=contents". If you want the contents to
+ be read from a file, use <@filename> as contents. When specifying a file,
+ you can also specify which content type the file is, by appending
+ ';type=<mime type>' to the file name. You can also post contents of several
+ files in one field. So that the field name 'coolfiles' can be sent three
+ files with different content types in a manner similar to:
+
+ curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \
+ http://www.post.com/postit.cgi
+
+ If content-type is not specified, curl will try to guess from the extension
+ (it only knows a few), or use the previously specified type (from an earlier
+ file if several files are specified in a list) or finally using the default
+ type 'text/plain'.
+
+ Emulate a fill-in form with -F. Let's say you fill in three fields in a
+ form. One field is a file name which to post, one field is your name and one
+ field is a file description. We want to post the file we have written named
+ "cooltext.txt". To let curl do the posting of this data instead of your
+ favourite browser, you have to check out the HTML of the form page to get to
+ know the names of the input fields. In our example, the input field names are
+ 'file', 'yourname' and 'filedescription'.
+
+ curl -F "file=@cooltext.txt" -F "yourname=Daniel" \
+ -F "filedescription=Cool text file with cool text inside" \
+ http://www.post.com/postit.cgi
+
+ So, to send two files in one post you can do it in two ways:
+
+ 1. Send multiple files in a single "field" with a single field name:
+
+ curl -F "pictures=@dog.gif,cat.gif"
+
+ 2. Send two fields with two field names:
+
+ curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif"
+
+REFERER
+
+ A HTTP request has the option to include information about which address
+ that referred to actual page, and curl allows the user to specify that
+ referrer to get specified on the command line. It is especially useful to
+ fool or trick stupid servers or CGI scripts that rely on that information
+ being available or contain certain data.
+
+ curl -e www.coolsite.com http://www.showme.com/
+
+USER AGENT
+
+ A HTTP request has the option to include information about the browser
+ that generated the request. Curl allows it to be specified on the command
+ line. It is especially useful to fool or trick stupid servers or CGI
+ scripts that only accept certain browsers.
+
+ Example:
+
+ curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/
+
+ Other common strings:
+ 'Mozilla/3.0 (Win95; I)' Netscape Version 3 for Windows 95
+ 'Mozilla/3.04 (Win95; U)' Netscape Version 3 for Windows 95
+ 'Mozilla/2.02 (OS/2; U)' Netscape Version 2 for OS/2
+ 'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)' NS for AIX
+ 'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' NS for Linux
+
+ Note that Internet Explorer tries hard to be compatible in every way:
+ 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)' MSIE for W95
+
+ Mozilla is not the only possible User-Agent name:
+ 'Konqueror/1.0' KDE File Manager desktop client
+ 'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser
+
+COOKIES
+
+ Cookies are generally used by web servers to keep state information at the
+ client's side. The server sets cookies by sending a response line in the
+ headers that looks like 'Set-Cookie: <data>' where the data part then
+ typically contains a set of NAME=VALUE pairs (separated by semicolons ';'
+ like "NAME1=VALUE1; NAME2=VALUE2;"). The server can also specify for what
+ path the "cookie" should be used for (by specifying "path=value"), when the
+ cookie should expire ("expire=DATE"), for what domain to use it
+ ("domain=NAME") and if it should be used on secure connections only
+ ("secure").
+
+ If you've received a page from a server that contains a header like:
+ Set-Cookie: sessionid=boo123; path="/foo";
+
+ it means the server wants that first pair passed on when we get anything in
+ a path beginning with "/foo".
+
+ Example, get a page that wants my name passed in a cookie:
+
+ curl -b "name=Daniel" www.sillypage.com
+
+ Curl also has the ability to use previously received cookies in following
+ sessions. If you get cookies from a server and store them in a file in a
+ manner similar to:
+
+ curl --dump-header headers www.example.com
+
+ ... you can then in a second connect to that (or another) site, use the
+ cookies from the 'headers' file like:
+
+ curl -b headers www.example.com
+
+ Note that by specifying -b you enable the "cookie awareness" and with -L
+ you can make curl follow a location: (which often is used in combination
+ with cookies). So that if a site sends cookies and a location, you can
+ use a non-existing file to trig the cookie awareness like:
+
+ curl -L -b empty-file www.example.com
+
+ The file to read cookies from must be formatted using plain HTTP headers OR
+ as netscape's cookie file. Curl will determine what kind it is based on the
+ file contents.
+
+PROGRESS METER
+
+ The progress meter was introduced to better show a user that something
+ actually is happening. The different fields in the output have the following
+ meaning:
+
+ % Received Total Speed Time left Total Curr.Speed
+ 13 524140 3841536 4296 0:12:52 0:14:54 292
+
+ From left-to-right:
+ - The first column, is the percentage of the file currently transfered.
+ - Received means the total number of bytes that has been transfered.
+ - Total is the total number of bytes expected to transfer.
+ - Speed is average speed in bytes per second for the whole transfer so far.
+ - Time left is the estimated time left for this transfer to finnish if the
+ current average speed will remain steady.
+ - Total is the estimated total transfer time.
+ - Curr.Speed is the average transfer speed the last 5 seconds (the first
+ 5 seconds of a transfer is based on less time of course.)
+
+ NOTE: Much of the output is based on the fact that the size of the transfer
+ is known before it takes place. If it isn't, a much less fancy display will
+ be used.
+
+SPEED LIMIT
+
+ Curl offers the user to set conditions regarding transfer speed that must
+ be met to let the transfer keep going. By using the switch -y and -Y you
+ can make curl abort transfers if the transfer speed doesn't exceed your
+ given lowest limit for a specified time.
+
+ To let curl abandon downloading this page if its slower than 3000 bytes per
+ second for 1 minute, run:
+
+ curl -y 3000 -Y 60 www.far-away-site.com
+
+ This can very well be used in combination with the overall time limit, so
+ that the above operatioin must be completed in whole within 30 minutes:
+
+ curl -m 1800 -y 3000 -Y 60 www.far-away-site.com
+
+CONFIG FILE
+
+ Curl automatically tries to read the .curlrc file (or _curlrc file on win32
+ systems) from the user's home dir on startup. The config file should be
+ made up with normal command line switches. Comments can be used within the
+ file. If the first letter on a line is a '#'-letter the rest of the line
+ is treated as a comment.
+
+ Example, set default time out and proxy in a config file:
+
+ # We want a 30 minute timeout:
+ -m 1800
+ # ... and we use a proxy for all accesses:
+ -x proxy.our.domain.com:8080
+
+ White spaces ARE significant at the end of lines, but all white spaces
+ leading up to the first characters of each line are ignored.
+
+ Prevent curl from reading the default file by using -q as the first command
+ line parameter, like:
+
+ curl -q www.thatsite.com
+
+ Force curl to get and display a local help page in case it is invoked
+ without URL by making a config file similar to:
+
+ # default url to get
+ http://help.with.curl.com/curlhelp.html
+
+ You can specify another config file to be read by using the -K/--config
+ flag. If you set config file name to "-" it'll read the config from stdin,
+ which can be handy if you want to hide options from being visible in process
+ tables etc:
+
+ echo "-u user:passwd" | curl -K - http://that.secret.site.com
+
+EXTRA HEADERS
+
+ When using curl in your own very special programs, you may end up needing
+ to pass on your own custom headers when getting a web page. You can do
+ this by using the -H flag.
+
+ Example, send the header "X-you-and-me: yes" to the server when getting a
+ page:
+
+ curl -H "X-you-and-me: yes" www.love.com
+
+ This can also be useful in case you want curl to send a different text in
+ a header than it normally does. The -H header you specify then replaces the
+ header curl would normally send.
+
+FTP and PATH NAMES
+
+ Do note that when getting files with the ftp:// URL, the given path is
+ relative the directory you enter. To get the file 'README' from your home
+ directory at your ftp site, do:
+
+ curl ftp://user:passwd@my.site.com/README
+
+ But if you want the README file from the root directory of that very same
+ site, you need to specify the absolute file name:
+
+ curl ftp://user:passwd@my.site.com//README
+
+ (I.e with an extra slash in front of the file name.)
+
+FTP and firewalls
+
+ The FTP protocol requires one of the involved parties to open a second
+ connction as soon as data is about to get transfered. There are two ways to
+ do this.
+
+ The default way for curl is to issue the PASV command which causes the
+ server to open another port and await another connection performed by the
+ client. This is good if the client is behind a firewall that don't allow
+ incoming connections.
+
+ curl ftp.download.com
+
+ If the server for example, is behind a firewall that don't allow connections
+ on other ports than 21 (or if it just doesn't support the PASV command), the
+ other way to do it is to use the PORT command and instruct the server to
+ connect to the client on the given (as parameters to the PORT command) IP
+ number and port.
+
+ The -P flag to curl allows for different options. Your machine may have
+ several IP-addresses and/or network interfaces and curl allows you to select
+ which of them to use. Default address can also be used:
+
+ curl -P - ftp.download.com
+
+ Download with PORT but use the IP address of our 'le0' interface:
+
+ curl -P le0 ftp.download.com
+
+ Download with PORT but use 192.168.0.10 as our IP address to use:
+
+ curl -P 192.168.0.10 ftp.download.com
+
+HTTPS
+
+ Secure HTTP requires SSLeay to be installed and used when curl is built. If
+ that is done, curl is capable of retrieving and posting documents using the
+ HTTPS procotol.
+
+ Example:
+
+ curl https://www.secure-site.com
+
+ Curl is also capable of using your personal certificates to get/post files
+ from sites that require valid certificates. The only drawback is that the
+ certificate needs to be in PEM-format. PEM is a standard and open format to
+ store certificates with, but it is not used by the most commonly used
+ browsers (Netscape and MSEI both use the so called PKCS#12 format). If you
+ want curl to use the certificates you use with your (favourite) browser, you
+ may need to download/compile a converter that can convert your browser's
+ formatted certificates to PEM formatted ones. Dr Stephen N. Henson has
+ written a patch for SSLeay that adds this functionality. You can get his
+ patch (that requires an SSLeay installation) from his site at:
+ http://www.drh-consultancy.demon.co.uk/
+
+ Example on how to automatically retrieve a document using a certificate with
+ a personal password:
+
+ curl -E /path/to/cert.pem:password https://secure.site.com/
+
+ If you neglect to specify the password on the command line, you will be
+ prompted for the correct password before any data can be received.
+
+ Many older SSL-servers have problems with SSLv3 or TLS, that newer versions
+ of OpenSSL etc is using, therefore it is sometimes useful to specify what
+ SSL-version curl should use. Use -3 or -2 to specify that exact SSL version
+ to use:
+
+ curl -2 https://secure.site.com/
+
+ Otherwise, curl will first attempt to use v3 and then v2.
+
+RESUMING FILE TRANSFERS
+
+ To continue a file transfer where it was previously aborted, curl supports
+ resume on http(s) downloads as well as ftp uploads and downloads.
+
+ Continue downloading a document:
+
+ curl -c -o file ftp://ftp.server.com/path/file
+
+ Continue uploading a document(*1):
+
+ curl -c -T file ftp://ftp.server.com/path/file
+
+ Continue downloading a document from a web server(*2):
+
+ curl -c -o file http://www.server.com/
+
+ (*1) = This requires that the ftp server supports the non-standard command
+ SIZE. If it doesn't, curl will say so.
+
+ (*2) = This requires that the wb server supports at least HTTP/1.1. If it
+ doesn't, curl will say so.
+
+TIME CONDITIONS
+
+ HTTP allows a client to specify a time condition for the document it
+ requests. It is If-Modified-Since or If-Unmodified-Since. Curl allow you to
+ specify them with the -z/--time-cond flag.
+
+ For example, you can easily make a download that only gets performed if the
+ remote file is newer than a local copy. It would be made like:
+
+ curl -z local.html http://remote.server.com/remote.html
+
+ Or you can download a file only if the local file is newer than the remote
+ one. Do this by prepending the date string with a '-', as in:
+
+ curl -z -local.html http://remote.server.com/remote.html
+
+ You can specify a "free text" date as condition. Tell curl to only download
+ the file if it was updated since yesterday:
+
+ curl -z yesterday http://remote.server.com/remote.html
+
+ Curl will then accept a wide range of date formats. You always make the date
+ check the other way around by prepending it with a dash '-'.
+
+DICT
+
+ For fun try
+
+ curl dict://dict.org/m:curl
+ curl dict://dict.org/d:heisenbug:jargon
+ curl dict://dict.org/d:daniel:web1913
+
+ Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define'
+ and 'lookup'. For example,
+
+ curl dict://dict.org/find:curl
+
+ Commands that break the URL description of the RFC (but not the DICT
+ protocol) are
+
+ curl dict://dict.org/show:db
+ curl dict://dict.org/show:strat
+
+ Authentication is still missing (but this is not required by the RFC)
+
+LDAP
+
+ If you have installed the OpenLDAP library, curl can take advantage of it
+ and offer ldap:// support.
+
+ LDAP is a complex thing and writing an LDAP query is not an easy task. I do
+ advice you to dig up the syntax description for that elsewhere, RFC 1959 if
+ no other place is better.
+
+ To show you an example, this is now I can get all people from my local LDAP
+ server that has a certain sub-domain in their email address:
+
+ curl -B "ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se"
+
+ If I want the same info in HTML format, I can get it by not using the -B
+ (enforce ASCII) flag.
+
+ENVIRONMENT VARIABLES
+
+ Curl reads and understands the following environment variables:
+
+ HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY
+
+ They should be set for protocol-specific proxies. General proxy should be
+ set with
+
+ ALL_PROXY
+
+ A comma-separated list of host names that shouldn't go through any proxy is
+ set in (only an asterisk, '*' matches all hosts)
+
+ NO_PROXY
+
+ If a tail substring of the domain-path for a host matches one of these
+ strings, transactions with that node will not be proxied.
+
+
+ The usage of the -x/--proxy flag overrides the environment variables.
+
+MAILING LIST
+
+ We have an open mailing list to discuss curl, its development and things
+ relevant to this.
+
+ To subscribe, mail curl-request@contactor.se with "subscribe <your email
+ address>" in the body.
+
+ To post to the list, mail curl@contactor.se.
+
+ To unsubcribe, mail curl-request@contactor.se with "unsubscribe <your
+ subscribed email address>" in the body.
+
diff --git a/README.libcurl b/README.libcurl
new file mode 100644
index 000000000..ccec76150
--- /dev/null
+++ b/README.libcurl
@@ -0,0 +1,108 @@
+ _ _ _ _
+ | (_) |__ ___ _ _ _ __| |
+ | | | '_ \ / __| | | | '__| |
+ | | | |_) | (__| |_| | | | |
+ |_|_|_.__/ \___|\__,_|_| |_|
+
+
+ How To Use Libcurl In Your Program:
+ (by Ralph Beckmann <rabe@uni-paderborn.de>)
+
+NOTE: If you plan to use libcurl.a in Threads under Linux, do not use the old
+gcc-2.7.x because the function 'gethostbyname' seems not to be thread-safe,
+that is to say an unavoidable SEGMENTATION FAULT might occur.
+
+
+1. a) In a C-Program:
+ #include "curl.h"
+
+ b) In a C++-Program:
+ extern "C" {
+ #include "curl.h"
+ }
+
+2. char *url="http://www.domain.com";
+ curl_urlget (URGTAG_URL, url,
+ URGTAG_FLAGS, CONF_NOPROGRESS,
+ URGTAG_ERRORBUFFER, errorBuffer,
+ URGTAG_WRITEFUNCTION, (size_t (*)(void *, int, int, FILE
+*))handle_data,
+ URGTAG_TIMEOUT, 30, /* or anything You want */
+ ...
+ URGTAG_DONE);
+
+3. size_t handle_data (const void *ptr, size_t size, size_t nitems,
+ FILE *stream)
+ {
+ (void)stream; /* stop complaining using g++ -Wall */
+ if ((int)nitems <= 0) {
+ return (size_t)0;
+ }
+ fprintf(stdout, (char *)ptr); /* or do anything else with it */
+ return nitems;
+ }
+
+4. Compile Your Program with -I$(CURL_DIR)/include
+
+5. Link Your Program together with $(CURL_DIR)/lib/libcurl.a
+
+ Small Example of How To Use libcurl
+
+----------------------------------------------------------------------
+/* Full example that uses libcurl.a to fetch web pages. */
+/* curlthreads.c */
+/* - Test-Program by Ralph Beckmann for using curl in POSIX-Threads */
+/* Change *url1 and *url2 to textual long and slow non-FRAMESET websites! */
+/*
+ 1. Compile with gcc or g++ as $(CC):
+ $(CC) -c -Wall -pedantic curlthreads.c -I$(CURL_DIR)/include
+
+ 2. Link with:
+ - Linux:
+ $(CC) -o curlthreads curlthreads.o $(CURL_DIR)/lib/libcurl.a -lpthread
+-lm
+ - Solaris:
+ $(CC) -o curlthreads curlthreads.o $(CURL_DIR)/lib/libcurl.a -lpthread
+-lm -lsocket -lnsl
+*/
+
+#include <pthread.h>
+#include <stdio.h>
+#ifdef __cplusplus
+extern "C" {
+#include "curl.h"
+}
+#else
+#include "curl.h"
+#endif
+
+size_t storedata (const void *ptr, size_t size, size_t nitems, FILE *stream) {
+ (void)ptr; (void)stream; /* just to stop g++ -Wall complaining */
+ fprintf(stdout, "Thread #%i reads %i Bytes.\n",
+ (int)pthread_self(), (int)(nitems*size));
+ return (nitems);
+}
+
+void *urlfetcher(void *url) {
+ curl_urlget (URGTAG_URL, url,
+ URGTAG_FLAGS, CONF_NOPROGRESS | CONF_FAILONERROR,
+ URGTAG_WRITEFUNCTION, (size_t (*)(void *, int, int, FILE
+*))storedata,
+ URGTAG_DONE);
+ return NULL;
+}
+
+int main(void) {
+ char *url1="www.sun.com";
+ char *url2="www.microsoft.com";
+
+ pthread_t thread_id1, thread_id2;
+ pthread_create(&thread_id1, NULL, urlfetcher, (void *)url1);
+ pthread_create(&thread_id2, NULL, urlfetcher, (void *)url2);
+ pthread_join(thread_id1, NULL);
+ pthread_join(thread_id2, NULL);
+
+ fprintf(stdout, "Ready.\n");
+
+ return 0;
+}
diff --git a/RESOURCES b/RESOURCES
new file mode 100644
index 000000000..92b25ce45
--- /dev/null
+++ b/RESOURCES
@@ -0,0 +1,62 @@
+ _ _ ____ _
+ Project ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+
+This document has been introduced in order to let you find documents that
+specify standards used by curl, software that extends curl and web pages with
+"competing" utilities.
+
+Standards
+
+ RFC 959 - Defines how FTP works
+ RFC 1738 - Uniform Resource Locators
+ RFC 1777 - defines the LDAP protocol
+ RFC 1808 - Relative Uniform Resource Locators
+ RFC 1867 - Form-based File Upload in HTML
+
+ RFC 1950 - ZLIB Compressed Data Format Specification
+ RFC 1951 - DEFLATE Compressed Data Format Specification
+ RFC 1952 - gzip compression format
+
+ RFC 1959 - LDAP URL syntax
+ RFC 2045-2049 - Everything you need to know about MIME! (needed for form
+ based upload)
+ RFC 2068 - HTTP 1.1 (obsoleted by RFC 2616)
+ RFC 2109 - HTTP State Management Mechanism (cookie stuff)
+ - Also, read Netscape's specification at
+ http://www.netscape.com/newsref/std/cookie_spec.html
+ RFC 2183 - "The Content-Disposition Header Field"
+ RFC 2229 - "A Dictionary Server Protocol"
+ RFC 2231 - "MIME Parameter Value and Encoded Word Extensions:
+ Character Sets, Languages, and Continuations"
+ RFC 2388 - "Returning Values from Forms: multipart/form-data"
+ Use this as an addition to the 1867
+ RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics"
+ This one obsoletes 1738, but since 1738 is often mentioned I've left it
+ in this list.
+ RFC 2428 - "FTP Extensions for IPv6 and NATs"
+ This should be considered when introducing IPv6 awareness.
+ RFC 2616 - HTTP 1.1
+ RFC 2617 - HTTP Authentication
+
+Compilers
+
+ MingW32 - http://www.xraylith.wisc.edu/~khan/software/gnu-win32/index.html
+
+Software
+
+ OpenSSL - http://www.openssl.org
+ OpenLDAP - http://www.openldap.org
+ zlib - http://www.cdrom.com/pub/infozip/zlib/
+
+Competitors
+
+ wget - ftp://prep.ai.mit.edu/pub/gnu/
+ snarf - http://www.xach.com/snarf/
+ lynx - http://lynx.browser.org/ (well at least when -dump is used)
+ swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
+ fetch - ?
+
diff --git a/TODO b/TODO
new file mode 100644
index 000000000..6ff69fc3f
--- /dev/null
+++ b/TODO
@@ -0,0 +1,87 @@
+ _ _ ____ _
+ ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+TODO
+
+ Ok, this is what I wanna do with Curl. Please tell me what you think, and
+ please don't hesitate to contribute and send me patches that improve this
+ product! (Yes, you may add things not mentioned here, these are just a
+ few teasers...)
+
+ * rtsp:// support -- "Real Time Streaming Protocol"
+
+ RFC 2326
+
+ * "Content-Encoding: compress/gzip/zlib"
+
+ HTTP 1.1 clearly defines how to get and decode compressed documents. There
+ is the zlib that is pretty good at decompressing stuff. This work was
+ started in October 1999 but halted again since it proved more work than we
+ thought. It is still a good idea to implement though.
+
+ * HTTP Pipelining/persistant connections
+
+ - I'm gonna introduce HTTP "pipelining". Curl should be able
+ to request for several HTTP documents in one connect. It is the beginning
+ for supporing more advanced functions in the future, like web site
+ mirroring. This will require that the urlget() function supports several
+ documents from a single HTTP server, which it doesn't today.
+
+ - When curl supports fetching several documents from the same
+ server using pipelining, I'd like to offer that function to the command
+ line. Anyone has a good idea how? The current way of specifying one URL
+ with the output sent to the stdout or a file gets in the way. Imagine a
+ syntax that supports "additional documents from the same server" in a way
+ similar to:
+
+ curl <main URL> --more-doc <path> --more-doc <path>
+
+ where --more-doc specifies another document on the same server. Where are
+ the output files gonna be put and how should they be named? Should each
+ "--more-doc" parameter require a local file name to store the result in?
+ Like "--more-file" as in:
+
+ curl <URL> --more-doc <path> --more-file <file>
+
+ * RFC2617 compliance, "Digest Access Authentication"
+ A valid test page seem to exist at:
+ http://hopf.math.nwu.edu/testpage/digest/
+ And some friendly person's server source code is available at
+ http://hopf.math.nwu.edu/digestauth/index.html
+
+ Then there's the Apache mod_digest source code too of course.
+ It seems as if Netscape doesn't support this, and not many servers
+ do. Although this is a lot better authentication method than the more
+ common "Basic". Basic sends the password in cleartext over the network,
+ this "Digest" method uses a challange-response protocol which increases
+ security quite a lot.
+
+ * Different FTP Upload Through Web Proxy
+ I don't know any web proxies that allow CONNECT through on port 21, but
+ that would be the best way to do ftp upload. All we would need to do would
+ be to 'CONNECT <host>:<port> HTTP/1.0\r\n\r\n' and then do business as
+ usual. I least I think so. It would be fun if someone tried this...
+
+ * Multiple Proxies?
+ Is there anyone that actually uses serial-proxies? I mean, send CONNECT to
+ the first proxy to connect to the second proxy to which you send CONNECT to
+ connect to the remote host (or even more iterations). Is there anyone
+ wanting curl to support it? (Not that it would be hard, just confusing...)
+
+ * Other proxies
+ Ftp-kind proxy, Socks5, whatever kind of proxies are there?
+
+ * IPv6 Awareness
+ Where ever it would fit. I am not that into v6 yet to fully grasp what we
+ would need to do, but letting the autoconf search for v6-versions of a few
+ functions and then use them instead is of course the first thing to do...
+ RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT
+ should be replaced with EPRT for IPv6, and EPSV instead of PASV.
+
+ * An automatic RPM package maker
+ Please, write me a script that makes it. It'd make my day.
+
+ * SSL for more protocols, like SSL-FTP...
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 000000000..616cc069a
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,12 @@
+/* Name of this package! */
+#undef PACKAGE
+
+/* Version number of this archive. */
+#undef VERSION
+
+/* Define if you have the getpass function. */
+#undef HAVE_GETPASS
+
+/* Define cpu-machine-OS */
+#undef OS
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 000000000..bd4779c71
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,127 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4
+
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
diff --git a/config-win32.h b/config-win32.h
new file mode 100644
index 000000000..8fe85e8aa
--- /dev/null
+++ b/config-win32.h
@@ -0,0 +1,168 @@
+/* config.h. Generated automatically by configure. */
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define as the return type of signal handlers (int or void). */
+/*#define RETSIGTYPE void */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+/* #define TIME_WITH_SYS_TIME 1 */
+
+/* Define cpu-machine-OS */
+#define OS "win32"
+
+/* The number of bytes in a long double. */
+#define SIZEOF_LONG_DOUBLE 16
+
+/* The number of bytes in a long long. */
+#define SIZEOF_LONG_LONG 8
+
+/* Define if you have the gethostbyaddr function. */
+#define HAVE_GETHOSTBYADDR 1
+
+/* Define if you have the gethostname function. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the getpass function. */
+/*#define HAVE_GETPASS 1*/
+
+/* Define if you have the getservbyname function. */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define if you have the gettimeofday function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if you have the inet_addr function. */
+#define HAVE_INET_ADDR 1
+
+/* Define if you have the inet_ntoa function. */
+#define HAVE_INET_NTOA 1
+
+/* Define if you have the perror function. */
+#define HAVE_PERROR 1
+
+/* Define if you have the select function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the socket function. */
+#define HAVE_SOCKET 1
+
+/* Define if you have the strcasecmp function. */
+/*#define HAVE_STRCASECMP 1*/
+
+/* Define if you have the strdup function. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strftime function. */
+#define HAVE_STRFTIME 1
+
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
+/* Define if you have the tcgetattr function. */
+/*#define HAVE_TCGETATTR 1*/
+
+/* Define if you have the tcsetattr function. */
+/*#define HAVE_TCSETATTR 1*/
+
+/* Define if you have the uname function. */
+#define HAVE_UNAME 1
+
+/* Define if you have the <alloca.h> header file. */
+/*#define HAVE_ALLOCA_H 1*/
+
+/* Define if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define if you have the <crypto.h> header file. */
+/* #undef HAVE_CRYPTO_H */
+
+/* Define if you have the <dlfcn.h> header file. */
+/*#define HAVE_DLFCN_H 1*/
+
+/* Define if you have the <err.h> header file. */
+/* #undef HAVE_ERR_H */
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define if you have the <sgtty.h> header file. */
+/*#define HAVE_SGTTY_H 1*/
+
+/* Define if you have the <ssl.h> header file. */
+/* #undef HAVE_SSL_H */
+
+/* Define if you have the <sys/param.h> header file. */
+/*#define HAVE_SYS_PARAM_H 1*/
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <sys/socket.h> header file. */
+/*#define HAVE_SYS_SOCKET_H 1*/
+
+/* Define if you have the <sys/sockio.h> header file. */
+#define HAVE_SYS_SOCKIO_H 1
+
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <termio.h> header file. */
+#define HAVE_TERMIO_H 1
+
+/* Define if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "curl"
+
+/* Version number of package */
+#define VERSION "6.3.1"
+
+/* Define if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define if you have the <winsock.h> header file. */
+#define HAVE_WINSOCK_H 1
+
+/* Define if you have the closesocket function. */
+#define HAVE_CLOSESOCKET 1
diff --git a/config.cache b/config.cache
new file mode 100644
index 000000000..ba8353a0d
--- /dev/null
+++ b/config.cache
@@ -0,0 +1,86 @@
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+ac_cv_c_const=${ac_cv_c_const='yes'}
+ac_cv_func_closesocket=${ac_cv_func_closesocket='no'}
+ac_cv_func_connect=${ac_cv_func_connect='no'}
+ac_cv_func_dlopen=${ac_cv_func_dlopen='no'}
+ac_cv_func_gethostbyaddr=${ac_cv_func_gethostbyaddr='yes'}
+ac_cv_func_gethostbyname=${ac_cv_func_gethostbyname='no'}
+ac_cv_func_gethostname=${ac_cv_func_gethostname='yes'}
+ac_cv_func_getpass=${ac_cv_func_getpass='yes'}
+ac_cv_func_getservbyname=${ac_cv_func_getservbyname='yes'}
+ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'}
+ac_cv_func_inet_addr=${ac_cv_func_inet_addr='yes'}
+ac_cv_func_inet_ntoa=${ac_cv_func_inet_ntoa='yes'}
+ac_cv_func_perror=${ac_cv_func_perror='yes'}
+ac_cv_func_select=${ac_cv_func_select='yes'}
+ac_cv_func_socket=${ac_cv_func_socket='yes'}
+ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
+ac_cv_func_strdup=${ac_cv_func_strdup='yes'}
+ac_cv_func_strftime=${ac_cv_func_strftime='yes'}
+ac_cv_func_strstr=${ac_cv_func_strstr='yes'}
+ac_cv_func_tcgetattr=${ac_cv_func_tcgetattr='yes'}
+ac_cv_func_tcsetattr=${ac_cv_func_tcsetattr='yes'}
+ac_cv_func_uname=${ac_cv_func_uname='yes'}
+ac_cv_func_vprintf=${ac_cv_func_vprintf='yes'}
+ac_cv_header_alloca_h=${ac_cv_header_alloca_h='yes'}
+ac_cv_header_arpa_inet_h=${ac_cv_header_arpa_inet_h='yes'}
+ac_cv_header_dlfcn_h=${ac_cv_header_dlfcn_h='yes'}
+ac_cv_header_fcntl_h=${ac_cv_header_fcntl_h='yes'}
+ac_cv_header_getopt_h=${ac_cv_header_getopt_h='no'}
+ac_cv_header_io_h=${ac_cv_header_io_h='no'}
+ac_cv_header_net_if_h=${ac_cv_header_net_if_h='yes'}
+ac_cv_header_netdb_h=${ac_cv_header_netdb_h='yes'}
+ac_cv_header_netinet_in_h=${ac_cv_header_netinet_in_h='yes'}
+ac_cv_header_openssl_crypto_h=${ac_cv_header_openssl_crypto_h='yes'}
+ac_cv_header_openssl_err_h=${ac_cv_header_openssl_err_h='yes'}
+ac_cv_header_openssl_pem_h=${ac_cv_header_openssl_pem_h='yes'}
+ac_cv_header_openssl_rsa_h=${ac_cv_header_openssl_rsa_h='yes'}
+ac_cv_header_openssl_ssl_h=${ac_cv_header_openssl_ssl_h='yes'}
+ac_cv_header_openssl_x509_h=${ac_cv_header_openssl_x509_h='yes'}
+ac_cv_header_sgtty_h=${ac_cv_header_sgtty_h='yes'}
+ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
+ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
+ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='yes'}
+ac_cv_header_sys_socket_h=${ac_cv_header_sys_socket_h='yes'}
+ac_cv_header_sys_sockio_h=${ac_cv_header_sys_sockio_h='yes'}
+ac_cv_header_sys_stat_h=${ac_cv_header_sys_stat_h='yes'}
+ac_cv_header_sys_types_h=${ac_cv_header_sys_types_h='yes'}
+ac_cv_header_termio_h=${ac_cv_header_termio_h='yes'}
+ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
+ac_cv_header_time=${ac_cv_header_time='yes'}
+ac_cv_header_time_h=${ac_cv_header_time_h='yes'}
+ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
+ac_cv_header_winsock_h=${ac_cv_header_winsock_h='no'}
+ac_cv_lib_crypto_CRYPTO_lock=${ac_cv_lib_crypto_CRYPTO_lock='yes'}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen='yes'}
+ac_cv_lib_nsl_gethostbyname=${ac_cv_lib_nsl_gethostbyname='yes'}
+ac_cv_lib_socket_connect=${ac_cv_lib_socket_connect='yes'}
+ac_cv_lib_ssl_SSL_connect=${ac_cv_lib_ssl_SSL_connect='yes'}
+ac_cv_path_NROFF=${ac_cv_path_NROFF='/bin/nroff'}
+ac_cv_path_PERL=${ac_cv_path_PERL='/usr/local/bin/perl'}
+ac_cv_prog_CC=${ac_cv_prog_CC='gcc'}
+ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
+ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'}
+ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
+ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'}
+ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
+ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'}
+ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'}
+ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
+ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double='16'}
+ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
+ac_cv_type_signal=${ac_cv_type_signal='void'}
+ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
diff --git a/config.guess b/config.guess
new file mode 100755
index 000000000..1d27287d5
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,997 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ ${CC-cc} $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 )
+ sed 's/^ //' << EOF >$dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE*:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ *9??*:MPE*:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo t3e-cray-unicosmk${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ if test -x /usr/bin/objformat; then
+ if test "elf" = "`/usr/bin/objformat`"; then
+ echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0
+ fi
+ fi
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+# # uname on the ARM produces all sorts of strangeness, and we need to
+# # filter it out.
+# case "$UNAME_MACHINE" in
+# armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
+# arm* | sa110*) UNAME_MACHINE="arm" ;;
+# esac
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32arm) echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 ;;
+ elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >$dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ ${CC-cc} $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i?86:UnixWare:*:*)
+ if /bin/uname -X 2>/dev/null >/dev/null ; then
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ fi
+ echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.guess-991124 b/config.guess-991124
new file mode 100755
index 000000000..58670decb
--- /dev/null
+++ b/config.guess-991124
@@ -0,0 +1,900 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin32
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # uname on the ARM produces all sorts of strangeness, and we need to
+ # filter it out.
+ case "$UNAME_MACHINE" in
+ arm* | sa110*) UNAME_MACHINE="arm" ;;
+ esac
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >dummy.c <<EOF
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+#include <features.h>
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined(__APPLE__)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*Kernel Release \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.h b/config.h
new file mode 100644
index 000000000..195afa8ba
--- /dev/null
+++ b/config.h
@@ -0,0 +1,220 @@
+/* config.h. Generated automatically by configure. */
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if you have the vprintf function. */
+#define HAVE_VPRINTF 1
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define cpu-machine-OS */
+#define OS "sparc-sun-solaris2.6"
+
+/* The number of bytes in a long double. */
+#define SIZEOF_LONG_DOUBLE 16
+
+/* The number of bytes in a long long. */
+#define SIZEOF_LONG_LONG 8
+
+/* Define if you have the closesocket function. */
+/* #undef HAVE_CLOSESOCKET */
+
+/* Define if you have the gethostbyaddr function. */
+#define HAVE_GETHOSTBYADDR 1
+
+/* Define if you have the gethostname function. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define if you have the getpass function. */
+#define HAVE_GETPASS 1
+
+/* Define if you have the getservbyname function. */
+#define HAVE_GETSERVBYNAME 1
+
+/* Define if you have the gettimeofday function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if you have the inet_addr function. */
+#define HAVE_INET_ADDR 1
+
+/* Define if you have the inet_ntoa function. */
+#define HAVE_INET_NTOA 1
+
+/* Define if you have the perror function. */
+#define HAVE_PERROR 1
+
+/* Define if you have the select function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the socket function. */
+#define HAVE_SOCKET 1
+
+/* Define if you have the strcasecmp function. */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the strdup function. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strftime function. */
+#define HAVE_STRFTIME 1
+
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
+/* Define if you have the tcgetattr function. */
+#define HAVE_TCGETATTR 1
+
+/* Define if you have the tcsetattr function. */
+#define HAVE_TCSETATTR 1
+
+/* Define if you have the uname function. */
+#define HAVE_UNAME 1
+
+/* Define if you have the <alloca.h> header file. */
+#define HAVE_ALLOCA_H 1
+
+/* Define if you have the <arpa/inet.h> header file. */
+#define HAVE_ARPA_INET_H 1
+
+/* Define if you have the <crypto.h> header file. */
+/* #undef HAVE_CRYPTO_H */
+
+/* Define if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define if you have the <err.h> header file. */
+/* #undef HAVE_ERR_H */
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
+
+/* Define if you have the <net/if.h> header file. */
+#define HAVE_NET_IF_H 1
+
+/* Define if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H 1
+
+/* Define if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H 1
+
+/* Define if you have the <openssl/crypto.h> header file. */
+#define HAVE_OPENSSL_CRYPTO_H 1
+
+/* Define if you have the <openssl/err.h> header file. */
+#define HAVE_OPENSSL_ERR_H 1
+
+/* Define if you have the <openssl/pem.h> header file. */
+#define HAVE_OPENSSL_PEM_H 1
+
+/* Define if you have the <openssl/rsa.h> header file. */
+#define HAVE_OPENSSL_RSA_H 1
+
+/* Define if you have the <openssl/ssl.h> header file. */
+#define HAVE_OPENSSL_SSL_H 1
+
+/* Define if you have the <openssl/x509.h> header file. */
+#define HAVE_OPENSSL_X509_H 1
+
+/* Define if you have the <pem.h> header file. */
+/* #undef HAVE_PEM_H */
+
+/* Define if you have the <rsa.h> header file. */
+/* #undef HAVE_RSA_H */
+
+/* Define if you have the <sgtty.h> header file. */
+#define HAVE_SGTTY_H 1
+
+/* Define if you have the <ssl.h> header file. */
+/* #undef HAVE_SSL_H */
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define if you have the <sys/sockio.h> header file. */
+#define HAVE_SYS_SOCKIO_H 1
+
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <termio.h> header file. */
+#define HAVE_TERMIO_H 1
+
+/* Define if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <winsock.h> header file. */
+/* #undef HAVE_WINSOCK_H */
+
+/* Define if you have the <x509.h> header file. */
+/* #undef HAVE_X509_H */
+
+/* Define if you have the crypto library (-lcrypto). */
+#define HAVE_LIBCRYPTO 1
+
+/* Define if you have the dl library (-ldl). */
+#define HAVE_LIBDL 1
+
+/* Define if you have the nsl library (-lnsl). */
+#define HAVE_LIBNSL 1
+
+/* Define if you have the resolve library (-lresolve). */
+/* #undef HAVE_LIBRESOLVE */
+
+/* Define if you have the socket library (-lsocket). */
+#define HAVE_LIBSOCKET 1
+
+/* Define if you have the ssl library (-lssl). */
+#define HAVE_LIBSSL 1
+
+/* Define if you have the ucb library (-lucb). */
+/* #undef HAVE_LIBUCB */
+
+/* Name of package */
+#define PACKAGE "curl"
+
+/* Version number of package */
+#define VERSION "6.3.1"
+
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 000000000..9c5e11013
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,219 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+#undef _ALL_SOURCE
+#endif
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define if you don't have vprintf but do have _doprnt. */
+#undef HAVE_DOPRNT
+
+/* Define if you have the vprintf function. */
+#undef HAVE_VPRINTF
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+#undef size_t
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define cpu-machine-OS */
+#undef OS
+
+/* The number of bytes in a long double. */
+#undef SIZEOF_LONG_DOUBLE
+
+/* The number of bytes in a long long. */
+#undef SIZEOF_LONG_LONG
+
+/* Define if you have the closesocket function. */
+#undef HAVE_CLOSESOCKET
+
+/* Define if you have the gethostbyaddr function. */
+#undef HAVE_GETHOSTBYADDR
+
+/* Define if you have the gethostname function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define if you have the getpass function. */
+#undef HAVE_GETPASS
+
+/* Define if you have the getservbyname function. */
+#undef HAVE_GETSERVBYNAME
+
+/* Define if you have the gettimeofday function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the inet_addr function. */
+#undef HAVE_INET_ADDR
+
+/* Define if you have the inet_ntoa function. */
+#undef HAVE_INET_NTOA
+
+/* Define if you have the perror function. */
+#undef HAVE_PERROR
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the socket function. */
+#undef HAVE_SOCKET
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
+/* Define if you have the strftime function. */
+#undef HAVE_STRFTIME
+
+/* Define if you have the strstr function. */
+#undef HAVE_STRSTR
+
+/* Define if you have the tcgetattr function. */
+#undef HAVE_TCGETATTR
+
+/* Define if you have the tcsetattr function. */
+#undef HAVE_TCSETATTR
+
+/* Define if you have the uname function. */
+#undef HAVE_UNAME
+
+/* Define if you have the <alloca.h> header file. */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <crypto.h> header file. */
+#undef HAVE_CRYPTO_H
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <err.h> header file. */
+#undef HAVE_ERR_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
+/* Define if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <openssl/crypto.h> header file. */
+#undef HAVE_OPENSSL_CRYPTO_H
+
+/* Define if you have the <openssl/err.h> header file. */
+#undef HAVE_OPENSSL_ERR_H
+
+/* Define if you have the <openssl/pem.h> header file. */
+#undef HAVE_OPENSSL_PEM_H
+
+/* Define if you have the <openssl/rsa.h> header file. */
+#undef HAVE_OPENSSL_RSA_H
+
+/* Define if you have the <openssl/ssl.h> header file. */
+#undef HAVE_OPENSSL_SSL_H
+
+/* Define if you have the <openssl/x509.h> header file. */
+#undef HAVE_OPENSSL_X509_H
+
+/* Define if you have the <pem.h> header file. */
+#undef HAVE_PEM_H
+
+/* Define if you have the <rsa.h> header file. */
+#undef HAVE_RSA_H
+
+/* Define if you have the <sgtty.h> header file. */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <ssl.h> header file. */
+#undef HAVE_SSL_H
+
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <winsock.h> header file. */
+#undef HAVE_WINSOCK_H
+
+/* Define if you have the <x509.h> header file. */
+#undef HAVE_X509_H
+
+/* Define if you have the crypto library (-lcrypto). */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the dl library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the resolve library (-lresolve). */
+#undef HAVE_LIBRESOLVE
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define if you have the ssl library (-lssl). */
+#undef HAVE_LIBSSL
+
+/* Define if you have the ucb library (-lucb). */
+#undef HAVE_LIBUCB
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
diff --git a/config.log b/config.log
new file mode 100644
index 000000000..ac13614e4
--- /dev/null
+++ b/config.log
@@ -0,0 +1,90 @@
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+configure:562: checking for a BSD compatible install
+configure:615: checking whether build environment is sane
+configure:672: checking whether make sets ${MAKE}
+configure:718: checking for working aclocal
+configure:731: checking for working autoconf
+configure:744: checking for working automake
+configure:757: checking for working autoheader
+configure:770: checking for working makeinfo
+configure:787: checking for gcc
+configure:900: checking whether the C compiler (gcc ) works
+configure:916: gcc -o conftest conftest.c 1>&5
+configure:942: checking whether the C compiler (gcc ) is a cross-compiler
+configure:947: checking whether we are using GNU C
+configure:975: checking whether gcc accepts -g
+configure:1018: checking for a BSD compatible install
+configure:1071: checking whether make sets ${MAKE}
+configure:1099: checking how to run the C preprocessor
+configure:1179: checking for AIX
+configure:1205: checking for gethostbyname
+configure:1251: checking for gethostbyname in -lnsl
+configure:1301: checking for strcasecmp
+configure:1397: checking for connect
+configure:1443: checking for connect in -lsocket
+configure:1493: checking for gethostname
+configure:1589: checking for dlopen
+configure:1635: checking for dlopen in -ldl
+configure:1701: checking where to look for SSL
+configure:1713: checking for CRYPTO_lock in -lcrypto
+configure:1762: checking for SSL_connect in -lssl
+configure:1813: checking for openssl/x509.h
+configure:1813: checking for openssl/rsa.h
+configure:1813: checking for openssl/crypto.h
+configure:1813: checking for openssl/pem.h
+configure:1813: checking for openssl/ssl.h
+configure:1813: checking for openssl/err.h
+configure:1903: checking for ANSI C header files
+configure:2032: checking for unistd.h
+configure:2032: checking for arpa/inet.h
+configure:2032: checking for net/if.h
+configure:2032: checking for netinet/in.h
+configure:2032: checking for netdb.h
+configure:2032: checking for sys/select.h
+configure:2032: checking for sys/socket.h
+configure:2032: checking for sys/sockio.h
+configure:2032: checking for sys/stat.h
+configure:2032: checking for sys/types.h
+configure:2032: checking for getopt.h
+configure:2032: checking for sys/param.h
+configure:2032: checking for termios.h
+configure:2032: checking for termio.h
+configure:2032: checking for sgtty.h
+configure:2032: checking for fcntl.h
+configure:2032: checking for dlfcn.h
+configure:2032: checking for alloca.h
+configure:2032: checking for winsock.h
+configure:2032: checking for time.h
+configure:2032: checking for io.h
+configure:2071: checking for working const
+configure:2146: checking for size_t
+configure:2179: checking whether time.h and sys/time.h may both be included
+configure:2218: checking size of long double
+configure:2258: checking size of long long
+configure:2304: checking host system type
+configure:2330: checking return type of signal handlers
+configure:2371: checking for vprintf
+configure:2496: checking for socket
+configure:2496: checking for select
+configure:2496: checking for strdup
+configure:2496: checking for strstr
+configure:2496: checking for strftime
+configure:2496: checking for uname
+configure:2496: checking for strcasecmp
+configure:2496: checking for gethostname
+configure:2496: checking for gethostbyaddr
+configure:2496: checking for getservbyname
+configure:2496: checking for gettimeofday
+configure:2496: checking for inet_addr
+configure:2496: checking for inet_ntoa
+configure:2496: checking for tcsetattr
+configure:2496: checking for tcgetattr
+configure:2496: checking for perror
+configure:2496: checking for getpass
+configure:2496: checking for closesocket
+configure:2554: checking for perl
+configure:2593: checking for nroff
+configure:2633: checking for ranlib
+configure:2665: checking for bison
diff --git a/config.status b/config.status
new file mode 100755
index 000000000..8c3de4b68
--- /dev/null
+++ b/config.status
@@ -0,0 +1,492 @@
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host pm1:
+#
+# ./configure --with-ssl=/home/dast
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running ${CONFIG_SHELL-/bin/sh} ./configure --with-ssl=/home/dast --no-create --no-recursion"
+ exec ${CONFIG_SHELL-/bin/sh} ./configure --with-ssl=/home/dast --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "./config.status generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "$ac_cs_usage"; exit 0 ;;
+ *) echo "$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=.
+ac_given_INSTALL="./install-sh -c"
+
+trap 'rm -fr Makefile src/Makefile lib/Makefile perl/checklinks.pl perl/getlinks.pl perl/formfind.pl perl/recursiveftpget.pl config.h src/config.h conftest*; exit 1' 1 2 15
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+/^[ ]*VPATH[ ]*=[^:]*$/d
+
+s%@SHELL@%/bin/sh%g
+s%@CFLAGS@%-g -O2%g
+s%@CPPFLAGS@% -I/home/dast/include/openssl -I/home/dast/include%g
+s%@CXXFLAGS@%%g
+s%@FFLAGS@%%g
+s%@DEFS@%-DHAVE_CONFIG_H%g
+s%@LDFLAGS@%%g
+s%@LIBS@%-lssl -lcrypto -ldl -lsocket -lnsl -L/home/dast/lib%g
+s%@exec_prefix@%${prefix}%g
+s%@prefix@%/usr/local%g
+s%@program_transform_name@%s,x,x,%g
+s%@bindir@%${exec_prefix}/bin%g
+s%@sbindir@%${exec_prefix}/sbin%g
+s%@libexecdir@%${exec_prefix}/libexec%g
+s%@datadir@%${prefix}/share%g
+s%@sysconfdir@%${prefix}/etc%g
+s%@sharedstatedir@%${prefix}/com%g
+s%@localstatedir@%${prefix}/var%g
+s%@libdir@%${exec_prefix}/lib%g
+s%@includedir@%${prefix}/include%g
+s%@oldincludedir@%/usr/include%g
+s%@infodir@%${prefix}/info%g
+s%@mandir@%${prefix}/man%g
+s%@INSTALL_PROGRAM@%${INSTALL}%g
+s%@INSTALL_SCRIPT@%${INSTALL_PROGRAM}%g
+s%@INSTALL_DATA@%${INSTALL} -m 644%g
+s%@PACKAGE@%curl%g
+s%@VERSION@%6.3.1%g
+s%@ACLOCAL@%aclocal%g
+s%@AUTOCONF@%autoconf%g
+s%@AUTOMAKE@%automake%g
+s%@AUTOHEADER@%autoheader%g
+s%@MAKEINFO@%makeinfo%g
+s%@SET_MAKE@%%g
+s%@CC@%gcc%g
+s%@CPP@%gcc -E%g
+s%@host@%sparc-sun-solaris2.6%g
+s%@host_alias@%sparc-sun-solaris2.6%g
+s%@host_cpu@%sparc%g
+s%@host_vendor@%sun%g
+s%@host_os@%solaris2.6%g
+s%@PERL@%/usr/local/bin/perl%g
+s%@NROFF@%/bin/nroff%g
+s%@RANLIB@%ranlib%g
+s%@YACC@%bison -y%g
+
+CEOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+
+CONFIG_FILES=${CONFIG_FILES-"Makefile src/Makefile lib/Makefile perl/checklinks.pl perl/getlinks.pl perl/formfind.pl perl/recursiveftpget.pl "}
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+ CONFIG_HEADERS="config.h src/config.h"
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}PACKAGE${ac_dB}PACKAGE${ac_dC}"curl"${ac_dD}
+${ac_uA}PACKAGE${ac_uB}PACKAGE${ac_uC}"curl"${ac_uD}
+${ac_eA}PACKAGE${ac_eB}PACKAGE${ac_eC}"curl"${ac_eD}
+${ac_dA}VERSION${ac_dB}VERSION${ac_dC}"6.3.1"${ac_dD}
+${ac_uA}VERSION${ac_uB}VERSION${ac_uC}"6.3.1"${ac_uD}
+${ac_eA}VERSION${ac_eB}VERSION${ac_eC}"6.3.1"${ac_eD}
+${ac_dA}HAVE_LIBNSL${ac_dB}HAVE_LIBNSL${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIBNSL${ac_uB}HAVE_LIBNSL${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIBNSL${ac_eB}HAVE_LIBNSL${ac_eC}1${ac_eD}
+${ac_dA}HAVE_LIBSOCKET${ac_dB}HAVE_LIBSOCKET${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIBSOCKET${ac_uB}HAVE_LIBSOCKET${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIBSOCKET${ac_eB}HAVE_LIBSOCKET${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_LIBDL${ac_dB}HAVE_LIBDL${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIBDL${ac_uB}HAVE_LIBDL${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIBDL${ac_eB}HAVE_LIBDL${ac_eC}1${ac_eD}
+${ac_dA}HAVE_LIBCRYPTO${ac_dB}HAVE_LIBCRYPTO${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIBCRYPTO${ac_uB}HAVE_LIBCRYPTO${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIBCRYPTO${ac_eB}HAVE_LIBCRYPTO${ac_eC}1${ac_eD}
+${ac_dA}HAVE_LIBSSL${ac_dB}HAVE_LIBSSL${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIBSSL${ac_uB}HAVE_LIBSSL${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIBSSL${ac_eB}HAVE_LIBSSL${ac_eC}1${ac_eD}
+${ac_dA}HAVE_OPENSSL_X509_H${ac_dB}HAVE_OPENSSL_X509_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_X509_H${ac_uB}HAVE_OPENSSL_X509_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_X509_H${ac_eB}HAVE_OPENSSL_X509_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_OPENSSL_RSA_H${ac_dB}HAVE_OPENSSL_RSA_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_RSA_H${ac_uB}HAVE_OPENSSL_RSA_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_RSA_H${ac_eB}HAVE_OPENSSL_RSA_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_OPENSSL_CRYPTO_H${ac_dB}HAVE_OPENSSL_CRYPTO_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_CRYPTO_H${ac_uB}HAVE_OPENSSL_CRYPTO_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_CRYPTO_H${ac_eB}HAVE_OPENSSL_CRYPTO_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_OPENSSL_PEM_H${ac_dB}HAVE_OPENSSL_PEM_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_PEM_H${ac_uB}HAVE_OPENSSL_PEM_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_PEM_H${ac_eB}HAVE_OPENSSL_PEM_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_OPENSSL_SSL_H${ac_dB}HAVE_OPENSSL_SSL_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_SSL_H${ac_uB}HAVE_OPENSSL_SSL_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_SSL_H${ac_eB}HAVE_OPENSSL_SSL_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_OPENSSL_ERR_H${ac_dB}HAVE_OPENSSL_ERR_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_OPENSSL_ERR_H${ac_uB}HAVE_OPENSSL_ERR_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_OPENSSL_ERR_H${ac_eB}HAVE_OPENSSL_ERR_H${ac_eC}1${ac_eD}
+${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
+${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
+${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
+${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_ARPA_INET_H${ac_dB}HAVE_ARPA_INET_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_ARPA_INET_H${ac_uB}HAVE_ARPA_INET_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_ARPA_INET_H${ac_eB}HAVE_ARPA_INET_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_NET_IF_H${ac_dB}HAVE_NET_IF_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_NET_IF_H${ac_uB}HAVE_NET_IF_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_NET_IF_H${ac_eB}HAVE_NET_IF_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_NETINET_IN_H${ac_dB}HAVE_NETINET_IN_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_NETINET_IN_H${ac_uB}HAVE_NETINET_IN_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_NETINET_IN_H${ac_eB}HAVE_NETINET_IN_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_NETDB_H${ac_dB}HAVE_NETDB_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_NETDB_H${ac_uB}HAVE_NETDB_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_NETDB_H${ac_eB}HAVE_NETDB_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SYS_SELECT_H${ac_dB}HAVE_SYS_SELECT_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_SELECT_H${ac_uB}HAVE_SYS_SELECT_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_SELECT_H${ac_eB}HAVE_SYS_SELECT_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_SYS_SOCKET_H${ac_dB}HAVE_SYS_SOCKET_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_SOCKET_H${ac_uB}HAVE_SYS_SOCKET_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_SOCKET_H${ac_eB}HAVE_SYS_SOCKET_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SYS_SOCKIO_H${ac_dB}HAVE_SYS_SOCKIO_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_SOCKIO_H${ac_uB}HAVE_SYS_SOCKIO_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_SOCKIO_H${ac_eB}HAVE_SYS_SOCKIO_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SYS_STAT_H${ac_dB}HAVE_SYS_STAT_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_STAT_H${ac_uB}HAVE_SYS_STAT_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_STAT_H${ac_eB}HAVE_SYS_STAT_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SYS_TYPES_H${ac_dB}HAVE_SYS_TYPES_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_TYPES_H${ac_uB}HAVE_SYS_TYPES_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_TYPES_H${ac_eB}HAVE_SYS_TYPES_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_TERMIOS_H${ac_dB}HAVE_TERMIOS_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_TERMIOS_H${ac_uB}HAVE_TERMIOS_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_TERMIOS_H${ac_eB}HAVE_TERMIOS_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_TERMIO_H${ac_dB}HAVE_TERMIO_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_TERMIO_H${ac_uB}HAVE_TERMIO_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_TERMIO_H${ac_eB}HAVE_TERMIO_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SGTTY_H${ac_dB}HAVE_SGTTY_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SGTTY_H${ac_uB}HAVE_SGTTY_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SGTTY_H${ac_eB}HAVE_SGTTY_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_FCNTL_H${ac_dB}HAVE_FCNTL_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_FCNTL_H${ac_uB}HAVE_FCNTL_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_FCNTL_H${ac_eB}HAVE_FCNTL_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_DLFCN_H${ac_dB}HAVE_DLFCN_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_DLFCN_H${ac_uB}HAVE_DLFCN_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_DLFCN_H${ac_eB}HAVE_DLFCN_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_ALLOCA_H${ac_dB}HAVE_ALLOCA_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_ALLOCA_H${ac_uB}HAVE_ALLOCA_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_ALLOCA_H${ac_eB}HAVE_ALLOCA_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_TIME_H${ac_dB}HAVE_TIME_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_TIME_H${ac_uB}HAVE_TIME_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_TIME_H${ac_eB}HAVE_TIME_H${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD}
+${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD}
+${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD}
+${ac_dA}SIZEOF_LONG_DOUBLE${ac_dB}SIZEOF_LONG_DOUBLE${ac_dC}16${ac_dD}
+${ac_uA}SIZEOF_LONG_DOUBLE${ac_uB}SIZEOF_LONG_DOUBLE${ac_uC}16${ac_uD}
+${ac_eA}SIZEOF_LONG_DOUBLE${ac_eB}SIZEOF_LONG_DOUBLE${ac_eC}16${ac_eD}
+${ac_dA}SIZEOF_LONG_LONG${ac_dB}SIZEOF_LONG_LONG${ac_dC}8${ac_dD}
+${ac_uA}SIZEOF_LONG_LONG${ac_uB}SIZEOF_LONG_LONG${ac_uC}8${ac_uD}
+${ac_eA}SIZEOF_LONG_LONG${ac_eB}SIZEOF_LONG_LONG${ac_eC}8${ac_eD}
+${ac_dA}OS${ac_dB}OS${ac_dC}"sparc-sun-solaris2.6"${ac_dD}
+${ac_uA}OS${ac_uB}OS${ac_uC}"sparc-sun-solaris2.6"${ac_uD}
+${ac_eA}OS${ac_eB}OS${ac_eC}"sparc-sun-solaris2.6"${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}RETSIGTYPE${ac_dB}RETSIGTYPE${ac_dC}void${ac_dD}
+${ac_uA}RETSIGTYPE${ac_uB}RETSIGTYPE${ac_uC}void${ac_uD}
+${ac_eA}RETSIGTYPE${ac_eB}RETSIGTYPE${ac_eC}void${ac_eD}
+${ac_dA}HAVE_VPRINTF${ac_dB}HAVE_VPRINTF${ac_dC}1${ac_dD}
+${ac_uA}HAVE_VPRINTF${ac_uB}HAVE_VPRINTF${ac_uC}1${ac_uD}
+${ac_eA}HAVE_VPRINTF${ac_eB}HAVE_VPRINTF${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SOCKET${ac_dB}HAVE_SOCKET${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SOCKET${ac_uB}HAVE_SOCKET${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SOCKET${ac_eB}HAVE_SOCKET${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SELECT${ac_dB}HAVE_SELECT${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SELECT${ac_uB}HAVE_SELECT${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SELECT${ac_eB}HAVE_SELECT${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_STRDUP${ac_dB}HAVE_STRDUP${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRDUP${ac_uB}HAVE_STRDUP${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRDUP${ac_eB}HAVE_STRDUP${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STRSTR${ac_dB}HAVE_STRSTR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRSTR${ac_uB}HAVE_STRSTR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRSTR${ac_eB}HAVE_STRSTR${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STRFTIME${ac_dB}HAVE_STRFTIME${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRFTIME${ac_uB}HAVE_STRFTIME${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRFTIME${ac_eB}HAVE_STRFTIME${ac_eC}1${ac_eD}
+${ac_dA}HAVE_UNAME${ac_dB}HAVE_UNAME${ac_dC}1${ac_dD}
+${ac_uA}HAVE_UNAME${ac_uB}HAVE_UNAME${ac_uC}1${ac_uD}
+${ac_eA}HAVE_UNAME${ac_eB}HAVE_UNAME${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_STRCASECMP${ac_dB}HAVE_STRCASECMP${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRCASECMP${ac_uB}HAVE_STRCASECMP${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRCASECMP${ac_eB}HAVE_STRCASECMP${ac_eC}1${ac_eD}
+${ac_dA}HAVE_GETHOSTNAME${ac_dB}HAVE_GETHOSTNAME${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETHOSTNAME${ac_uB}HAVE_GETHOSTNAME${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETHOSTNAME${ac_eB}HAVE_GETHOSTNAME${ac_eC}1${ac_eD}
+${ac_dA}HAVE_GETHOSTBYADDR${ac_dB}HAVE_GETHOSTBYADDR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETHOSTBYADDR${ac_uB}HAVE_GETHOSTBYADDR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETHOSTBYADDR${ac_eB}HAVE_GETHOSTBYADDR${ac_eC}1${ac_eD}
+${ac_dA}HAVE_GETSERVBYNAME${ac_dB}HAVE_GETSERVBYNAME${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETSERVBYNAME${ac_uB}HAVE_GETSERVBYNAME${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETSERVBYNAME${ac_eB}HAVE_GETSERVBYNAME${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_GETTIMEOFDAY${ac_dB}HAVE_GETTIMEOFDAY${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETTIMEOFDAY${ac_uB}HAVE_GETTIMEOFDAY${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETTIMEOFDAY${ac_eB}HAVE_GETTIMEOFDAY${ac_eC}1${ac_eD}
+${ac_dA}HAVE_INET_ADDR${ac_dB}HAVE_INET_ADDR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_INET_ADDR${ac_uB}HAVE_INET_ADDR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_INET_ADDR${ac_eB}HAVE_INET_ADDR${ac_eC}1${ac_eD}
+${ac_dA}HAVE_INET_NTOA${ac_dB}HAVE_INET_NTOA${ac_dC}1${ac_dD}
+${ac_uA}HAVE_INET_NTOA${ac_uB}HAVE_INET_NTOA${ac_uC}1${ac_uD}
+${ac_eA}HAVE_INET_NTOA${ac_eB}HAVE_INET_NTOA${ac_eC}1${ac_eD}
+${ac_dA}HAVE_TCSETATTR${ac_dB}HAVE_TCSETATTR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_TCSETATTR${ac_uB}HAVE_TCSETATTR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_TCSETATTR${ac_eB}HAVE_TCSETATTR${ac_eC}1${ac_eD}
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ cat > conftest.frag <<CEOF
+${ac_dA}HAVE_TCGETATTR${ac_dB}HAVE_TCGETATTR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_TCGETATTR${ac_uB}HAVE_TCGETATTR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_TCGETATTR${ac_eB}HAVE_TCGETATTR${ac_eC}1${ac_eD}
+${ac_dA}HAVE_PERROR${ac_dB}HAVE_PERROR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_PERROR${ac_uB}HAVE_PERROR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_PERROR${ac_eB}HAVE_PERROR${ac_eC}1${ac_eD}
+${ac_dA}HAVE_GETPASS${ac_dB}HAVE_GETPASS${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETPASS${ac_uB}HAVE_GETPASS${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETPASS${ac_eB}HAVE_GETPASS${ac_eC}1${ac_eD}
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+
+
+am_indx=1
+for am_file in config.h src/config.h; do
+ case " $CONFIG_HEADERS " in
+ *" $am_file "*)
+ echo timestamp > `echo $am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "$am_indx" + 1`
+done
+
+exit 0
diff --git a/config.sub b/config.sub
new file mode 100755
index 000000000..ecf770cea
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,979 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+ | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
+ | hppa2.0w \
+ | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+ | mipstx39 | mipstx39el | armv[34][lb] \
+ | sparc | sparclet | sparclite | sparc64 | v850)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
+ | hppa2.0w-* \
+ | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mipstx39-* | mipstx39el-* \
+ | f301-* | armv*-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ os=-mpeix
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ os=-mpeix
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netwinder)
+ basic_machine=armv4l-corel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | k6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | k6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
+ | -openstep* | -mpeix* | -oskit*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-corel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/config.sub-991124 b/config.sub-991124
new file mode 100755
index 000000000..e24b85041
--- /dev/null
+++ b/config.sub-991124
@@ -0,0 +1,952 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+ | mipstx39 | mipstx39el \
+ | sparc | sparclet | sparclite | sparc64 | v850)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
+ | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mipstx39-* | mipstx39el-* \
+ | f301-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | k6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | k6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/configure b/configure
new file mode 100755
index 000000000..51b1b3dad
--- /dev/null
+++ b/configure
@@ -0,0 +1,3091 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
+ DIR points to the SSL installation [/usr/local/ssl]"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=lib/urldata.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:562: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:615: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:672: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=curl
+
+VERSION="6.3.1"
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:718: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:731: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:744: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:757: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:770: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:787: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:817: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:868: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:900: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 911 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:942: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:947: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:975: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1018: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1071: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1099: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1114 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1120: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1131 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1137: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1148 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for AIX""... $ac_c" 1>&6
+echo "configure:1179: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1181 "configure"
+#include "confdefs.h"
+#ifdef _AIX
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+#define _ALL_SOURCE 1
+EOF
+
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+
+
+echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:1205: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1210 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:1251: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1259 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:1270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6
+echo "configure:1301: checking for strcasecmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1306 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char strcasecmp(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strcasecmp();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_strcasecmp) || defined (__stub___strcasecmp)
+choke me
+#else
+strcasecmp();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_strcasecmp=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_strcasecmp=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'strcasecmp`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for strcasecmp in -lresolve""... $ac_c" 1>&6
+echo "configure:1347: checking for strcasecmp in -lresolve" >&5
+ac_lib_var=`echo resolve'_'strcasecmp | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lresolve $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1355 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strcasecmp();
+
+int main() {
+strcasecmp()
+; return 0; }
+EOF
+if { (eval echo configure:1366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo resolve | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lresolve $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:1397: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1402 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_connect=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:1443: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1451 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for gethostname""... $ac_c" 1>&6
+echo "configure:1493: checking for gethostname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1498 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostname(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostname) || defined (__stub___gethostname)
+choke me
+#else
+gethostname();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostname=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_gethostname=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'gethostname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for gethostname in -lucb""... $ac_c" 1>&6
+echo "configure:1539: checking for gethostname in -lucb" >&5
+ac_lib_var=`echo ucb'_'gethostname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lucb $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1547 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostname();
+
+int main() {
+gethostname()
+; return 0; }
+EOF
+if { (eval echo configure:1558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo ucb | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lucb $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:1589: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1594 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:1635: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1643 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:1654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/^a-zA-Z0-9_/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-ldl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+
+OPT_SSL=off
+# Check whether --with-ssl or --without-ssl was given.
+if test "${with_ssl+set}" = set; then
+ withval="$with_ssl"
+ OPT_SSL=$withval
+
+fi
+
+
+if test X"$OPT_SSL" = Xno
+then
+ echo "configure: warning: SSL/https support disabled" 1>&2
+else
+
+
+ echo $ac_n "checking where to look for SSL""... $ac_c" 1>&6
+echo "configure:1701: checking where to look for SSL" >&5
+ if test X"$OPT_SSL" = Xoff
+ then
+ echo "$ac_t""defaults (or given in environment)" 1>&6
+ else
+ test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
+ LIBS="$LIBS -L$OPT_SSL/lib"
+ CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
+ echo "$ac_t""$OPT_SSL" 1>&6
+ fi
+
+ echo $ac_n "checking for CRYPTO_lock in -lcrypto""... $ac_c" 1>&6
+echo "configure:1713: checking for CRYPTO_lock in -lcrypto" >&5
+ac_lib_var=`echo crypto'_'CRYPTO_lock | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lcrypto $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1721 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char CRYPTO_lock();
+
+int main() {
+CRYPTO_lock()
+; return 0; }
+EOF
+if { (eval echo configure:1732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo crypto | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lcrypto $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
+ echo $ac_n "checking for SSL_connect in -lssl""... $ac_c" 1>&6
+echo "configure:1762: checking for SSL_connect in -lssl" >&5
+ac_lib_var=`echo ssl'_'SSL_connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lssl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1770 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char SSL_connect();
+
+int main() {
+SSL_connect()
+; return 0; }
+EOF
+if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo ssl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lssl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ for ac_hdr in openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1813: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1818 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test $ac_cv_header_openssl_x509_h = no; then
+ for ac_hdr in x509.h rsa.h crypto.h pem.h ssl.h err.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1855: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1860 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
+
+ fi
+fi
+
+
+
+
+
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1903: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1908 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1933 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1951 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1972 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_hdr in \
+ unistd.h \
+ arpa/inet.h \
+ net/if.h \
+ netinet/in.h \
+ netdb.h \
+ sys/select.h \
+ sys/socket.h \
+ sys/sockio.h \
+ sys/stat.h \
+ sys/types.h \
+ getopt.h \
+ sys/param.h \
+ termios.h \
+ termio.h \
+ sgtty.h \
+ fcntl.h \
+ dlfcn.h \
+ alloca.h \
+ winsock.h \
+ time.h \
+ io.h \
+
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2032: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2037 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:2071: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2076 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:2125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2146: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2151 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:2179: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2184 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+ cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+# mprintf() checks:
+
+# check for 'long double'
+echo $ac_n "checking size of long double""... $ac_c" 1>&6
+echo "configure:2218: checking size of long double" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_sizeof_long_double=8
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2226 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long double));
+ exit(0);
+}
+EOF
+if { (eval echo configure:2237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long_double=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long_double=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long_double" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double
+EOF
+
+
+# check for 'long long'
+echo $ac_n "checking size of long long""... $ac_c" 1>&6
+echo "configure:2258: checking size of long long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_sizeof_long_long=4
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2266 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:2277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+EOF
+
+
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:2304: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+cat >> confdefs.h <<EOF
+#define OS "${host}"
+EOF
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2330: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2335 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+echo $ac_n "checking for vprintf""... $ac_c" 1>&6
+echo "configure:2371: checking for vprintf" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2376 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vprintf(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char vprintf();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_vprintf) || defined (__stub___vprintf)
+choke me
+#else
+vprintf();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vprintf=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_VPRINTF 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$ac_cv_func_vprintf" != yes; then
+echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
+echo "configure:2423: checking for _doprnt" >&5
+if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2428 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+_doprnt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func__doprnt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_DOPRNT 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+for ac_func in socket \
+ select \
+ strdup \
+ strstr \
+ strftime \
+ uname \
+ strcasecmp \
+ gethostname \
+ gethostbyaddr \
+ getservbyname \
+ gettimeofday \
+ inet_addr \
+ inet_ntoa \
+ tcsetattr \
+ tcgetattr \
+ perror \
+ getpass \
+ closesocket
+
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2496: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2501 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2554: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$PERL" in
+ /*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin "
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_PERL="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+fi
+PERL="$ac_cv_path_PERL"
+if test -n "$PERL"; then
+ echo "$ac_t""$PERL" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+for ac_prog in nroff gnroff
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2593: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_NROFF'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$NROFF" in
+ /*)
+ ac_cv_path_NROFF="$NROFF" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_NROFF="$NROFF" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH:/usr/bin/:/usr/local/bin "
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_NROFF="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+fi
+NROFF="$ac_cv_path_NROFF"
+if test -n "$NROFF"; then
+ echo "$ac_t""$NROFF" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$NROFF" && break
+done
+
+
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2633: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+for ac_prog in 'bison -y' byacc
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2665: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$YACC"; then
+ ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_YACC="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+YACC="$ac_cv_prog_YACC"
+if test -n "$YACC"; then
+ echo "$ac_t""$YACC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile \
+ src/Makefile \
+ lib/Makefile \
+ perl/checklinks.pl \
+ perl/getlinks.pl \
+ perl/formfind.pl \
+ perl/recursiveftpget.pl config.h src/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@PERL@%$PERL%g
+s%@NROFF@%$NROFF%g
+s%@RANLIB@%$RANLIB%g
+s%@YACC@%$YACC%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile \
+ src/Makefile \
+ lib/Makefile \
+ perl/checklinks.pl \
+ perl/getlinks.pl \
+ perl/formfind.pl \
+ perl/recursiveftpget.pl "}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h src/config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+am_indx=1
+for am_file in config.h src/config.h; do
+ case " $CONFIG_HEADERS " in
+ *" $am_file "*)
+ echo timestamp > `echo $am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "$am_indx" + 1`
+done
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 000000000..17418fd64
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,210 @@
+dnl $Id$
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(lib/urldata.h)
+AM_CONFIG_HEADER(config.h src/config.h)
+AM_INIT_AUTOMAKE(curl,"6.3.1")
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+dnl Check for AIX weirdos
+AC_AIX
+
+dnl **********************************************************************
+dnl Checks for libraries.
+dnl **********************************************************************
+
+dnl nsl lib?
+AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
+
+dnl resolve lib?
+AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
+
+dnl socket lib?
+AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
+
+dnl ucb lib?
+AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
+
+dnl dl lib?
+AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
+
+dnl **********************************************************************
+dnl Check for the presence of SSL libraries and headers
+dnl **********************************************************************
+
+dnl Default to compiler & linker defaults for SSL files & libraries.
+OPT_SSL=off
+AC_ARG_WITH(ssl,dnl
+[ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths]
+ DIR points to the SSL installation [/usr/local/ssl]],
+ OPT_SSL=$withval
+)
+
+if test X"$OPT_SSL" = Xno
+then
+ AC_MSG_WARN(SSL/https support disabled)
+else
+
+ dnl Check for & handle argument to --with-ssl.
+
+ AC_MSG_CHECKING(where to look for SSL)
+ if test X"$OPT_SSL" = Xoff
+ then
+ AC_MSG_RESULT([defaults (or given in environment)])
+ else
+ test X"$OPT_SSL" = Xyes && OPT_SSL=/usr/local/ssl
+ LIBS="$LIBS -L$OPT_SSL/lib"
+ CPPFLAGS="$CPPFLAGS -I$OPT_SSL/include/openssl -I$OPT_SSL/include"
+ AC_MSG_RESULT([$OPT_SSL])
+ fi
+
+ dnl check for crypto libs (part of SSLeay)
+ AC_CHECK_LIB(crypto, CRYPTO_lock)
+
+ if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then
+ dnl This is only reasonable to do if crypto actually is there: check for
+ dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
+ AC_CHECK_LIB(ssl, SSL_connect)
+
+ dnl Check for SSLeay headers
+ AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h openssl/pem.h openssl/ssl.h openssl/err.h)
+
+ if test $ac_cv_header_openssl_x509_h = no; then
+ AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
+ fi
+
+ fi
+fi
+
+dnl **********************************************************************
+dnl Check for the presence of ZLIB libraries and headers
+dnl **********************************************************************
+
+dnl Default to compiler & linker defaults for files & libraries.
+dnl OPT_ZLIB=no
+dnl AC_ARG_WITH(zlib,dnl
+dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
+dnl DIR points to the ZLIB installation prefix [/usr/local]],
+dnl OPT_ZLIB=$withval,
+dnl )
+
+dnl Check for & handle argument to --with-zlib.
+dnl
+dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
+dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
+dnl
+
+dnl AC_MSG_CHECKING(where to look for ZLIB)
+dnl if test X"$OPT_ZLIB" = Xno
+dnl then
+dnl AC_MSG_RESULT([defaults (or given in environment)])
+dnl else
+dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
+dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
+dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
+dnl AC_MSG_RESULT([$OPT_ZLIB])
+dnl fi
+
+dnl z lib?
+dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
+
+dnl **********************************************************************
+dnl Back to "normal" configuring
+dnl **********************************************************************
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS( \
+ unistd.h \
+ arpa/inet.h \
+ net/if.h \
+ netinet/in.h \
+ netdb.h \
+ sys/select.h \
+ sys/socket.h \
+ sys/sockio.h \
+ sys/stat.h \
+ sys/types.h \
+ getopt.h \
+ sys/param.h \
+ termios.h \
+ termio.h \
+ sgtty.h \
+ fcntl.h \
+ dlfcn.h \
+ alloca.h \
+ winsock.h \
+ time.h \
+ io.h \
+)
+
+dnl Check for libz header
+dnl AC_CHECK_HEADERS(zlib.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+# mprintf() checks:
+
+# check for 'long double'
+AC_CHECK_SIZEOF(long double, 8)
+# check for 'long long'
+AC_CHECK_SIZEOF(long long, 4)
+
+dnl Get system canonical name
+AC_CANONICAL_HOST
+AC_DEFINE_UNQUOTED(OS, "${host}")
+
+dnl Checks for library functions.
+dnl AC_PROG_GCC_TRADITIONAL
+AC_TYPE_SIGNAL
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS( socket \
+ select \
+ strdup \
+ strstr \
+ strftime \
+ uname \
+ strcasecmp \
+ gethostname \
+ gethostbyaddr \
+ getservbyname \
+ gettimeofday \
+ inet_addr \
+ inet_ntoa \
+ tcsetattr \
+ tcgetattr \
+ perror \
+ getpass \
+ closesocket
+)
+
+
+
+AC_PATH_PROG( PERL, perl, ,
+ $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
+AC_SUBST(PERL)
+
+AC_PATH_PROGS( NROFF, nroff gnroff, ,
+ $PATH:/usr/bin/:/usr/local/bin )
+AC_SUBST(NROFF)
+
+AC_PROG_RANLIB
+AC_PROG_YACC
+
+dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
+dnl $PATH:/usr/bin/:/usr/local/bin )
+dnl AC_SUBST(RANLIB)
+
+AC_OUTPUT( Makefile \
+ src/Makefile \
+ lib/Makefile \
+ perl/checklinks.pl \
+ perl/getlinks.pl \
+ perl/formfind.pl \
+ perl/recursiveftpget.pl )
diff --git a/curl-6.3.1.tar.gz b/curl-6.3.1.tar.gz
new file mode 100644
index 000000000..38bba51aa
--- /dev/null
+++ b/curl-6.3.1.tar.gz
Binary files differ
diff --git a/curl-ssl.spec b/curl-ssl.spec
new file mode 100644
index 000000000..1d69342d3
--- /dev/null
+++ b/curl-ssl.spec
@@ -0,0 +1,52 @@
+%define name curl-ssl
+%define tarball curl
+%define version 6.0
+%define release 1
+%define prefix /usr/local
+
+%define builddir $RPM_BUILD_DIR/%{tarball}-%{version}
+
+Summary: get a file from a FTP, GOPHER or HTTP server.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Copyright: MPL
+Vendor: Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+Packager: Troy Engel <tengel@sonic.net>
+Group: Utilities/Console
+Source: %{tarball}-%{version}.tar.gz
+URL: http://curl.haxx.nu/
+BuildRoot: /tmp/%{tarball}-%{version}-root
+
+%description
+curl is a client to get documents/files from servers, using any of the
+supported protocols. The command is designed to work without user
+interaction or any kind of interactivity.
+
+curl offers a busload of useful tricks like proxy support, user
+authentication, ftp upload, HTTP post, file transfer resume and more.
+
+Note: this version is compiled with SSL (https:) support.
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+rm -rf %{builddir}
+
+%setup -n %{tarball}-%{version}
+
+%build
+CFLAGS=$RPM_OPT_FLAGS ./configure --prefix=$RPM_BUILD_ROOT%{prefix} --with-ssl
+make CFLAGS="-DUSE_SSLEAY -I/usr/include/openssl"
+
+%install
+make install-strip
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+rm -rf %{builddir}
+
+%files
+%defattr(-,root,root)
+%attr(0755,root,root) %{prefix}/bin/curl
+%doc curl.1 README* CHANGES CONTRIBUTE FAQ FILES INSTALL LEGAL MPL-1.0.txt RESOURCES TODO perl/
+
diff --git a/curl.1 b/curl.1
new file mode 100644
index 000000000..f93bc0ea0
--- /dev/null
+++ b/curl.1
@@ -0,0 +1,402 @@
+.\" You can view this file with:
+.\" nroff -man curl.1
+.\" Written by Daniel Stenberg
+.\"
+.TH curl 1 "8 November 1999" "Curl 6.3" "Curl Manual"
+.SH NAME
+curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
+HTTPS syntax.
+.SH SYNOPSIS
+.B curl [options]
+.I url
+.SH DESCRIPTION
+.B curl
+is a client to get documents/files from servers, using any of the
+supported protocols. The command is designed to work without user
+interaction or any kind of interactivity.
+
+curl offers a busload of useful tricks like proxy support, user
+authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file
+transfer resume and more.
+.SH URL
+The URL syntax is protocol dependent. You'll find a detailed description in
+RFC 2396.
+
+You can specify multiple URLs or parts of URLs by writing part sets within
+braces as in:
+
+ http://site.{one,two,three}.com
+
+or you can get sequences of alphanumeric series by using [] as in:
+
+ ftp://ftp.numericals.com/file[1-100].txt
+ ftp://ftp.numericals.com/file[001-100].txt (with leading zeros)
+ ftp://ftp.letters.com/file[a-z].txt
+
+It is possible to specify up to 9 sets or series for a URL, but no nesting is
+supported at the moment:
+
+ http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.html
+.SH OPTIONS
+.IP "-a/--append"
+(FTP)
+When used in a ftp upload, this will tell curl to append to the target
+file instead of overwriting it. If the file doesn't exist, it will
+be created.
+.IP "-A/--user-agent <agent string>"
+(HTTP)
+Specify the User-Agent string to send to the HTTP server. Some badly done CGIs
+fail if its not set to "Mozilla/4.0". To encode blanks in the string,
+surround the string with single quote marks. This can also be set with the
+-H/--header flag of course.
+.IP "-b/--cookie <name=data>"
+(HTTP)
+Pass the data to the HTTP server as a cookie. It is supposedly the
+data previously received from the server in a "Set-Cookie:" line.
+The data should be in the format "NAME1=VALUE1; NAME2=VALUE2".
+
+If no '=' letter is used in the line, it is treated as a filename to use to
+read previously stored cookie lines from, which should be used in this session
+if they match. Using this method also activates the "cookie parser" which
+will make curl record incoming cookies too, which may be handy if you're using
+this in combination with the -L/--location option. The file format of the file
+to read cookies from should be plain HTTP headers or the netscape cookie file
+format.
+.IP "-B/--ftp-ascii"
+(FTP/LDAP)
+Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
+also be enforced by using an URL that ends with ";type=A".
+.IP "-c/--continue"
+Continue/Resume a previous file transfer. This instructs curl to
+continue appending data on the file where it was previously left,
+possibly because of a broken connection to the server. There must be
+a named physical file to append to for this to work.
+Note: Upload resume is depening on a command named SIZE not always
+present in all ftp servers! Upload resume is for FTP only.
+HTTP resume is only possible with HTTP/1.1 or later servers.
+.IP "-C/--continue-at <offset>"
+Continue/Resume a previous file transfer at the given offset. The
+given offset is the exact number of bytes that will be skipped
+counted from the beginning of the source file before it is transfered
+to the destination.
+If used with uploads, the ftp server command SIZE will not be used by
+curl. Upload resume is for FTP only.
+HTTP resume is only possible with HTTP/1.1 or later servers.
+.IP "-d/--data <data>"
+(HTTP)
+Sends the specified data in a POST request to the HTTP server. Note
+that the data is sent exactly as specified with no extra processing.
+The data is expected to be "url-encoded". This will cause curl to
+pass the data to the server using the content-type
+application/x-www-form-urlencoded. Compare to -F.
+
+If you start the data with the letter @, the rest should be a file name to
+read the data from, or - if you want curl to read the data from stdin.
+The contents of the file must already be url-encoded.
+.IP "-D/--dump-header <file>"
+(HTTP/FTP)
+Write the HTTP headers to this file. Write the FTP file info to this
+file if -I/--head is used.
+.IP "-e/--referer <URL>"
+(HTTP)
+Sends the "Referer Page" information to the HTTP server. Some badly
+done CGIs fail if it's not set. This can also be set with the -H/--header
+flag of course.
+.IP "-E/--cert <certificate[:password]>"
+(HTTPS)
+Tells curl to use the specified certificate file when getting a file
+with HTTPS. The certificate must be in PEM format.
+If the optional password isn't specified, it will be queried for on
+the terminal. Note that this certificate is the private key and the private
+certificate concatenated!
+.IP "-f/--fail"
+(HTTP)
+Fail silently (no output at all) on server errors. This is mostly done
+like this to better enable scripts etc to better deal with failed
+attempts. In normal cases when a HTTP server fails to deliver a
+document, it returns a HTML document stating so (which often also
+describes why and more). This flag will prevent curl from
+outputting that and fail silently instead.
+.IP "-F/--form <name=content>"
+(HTTP)
+This lets curl emulate a filled in form in which a user has pressed
+the submit button. This causes curl to POST data using the
+content-type multipart/form-data according to RFC1867. This enables
+uploading of binary files etc. To force the 'content' part to be
+read from a file, prefix the file name with an @ sign. Example, to
+send your password file to the server, where 'password' is the
+name of the form-field to which /etc/passwd will be the input:
+
+.B curl
+-F password=@/etc/passwd www.mypasswords.com
+
+To read the file's content from stdin insted of a file, use - where the file
+name should've been.
+.IP "-h/--help"
+Usage help.
+.IP "-H/--header <header>"
+(HTTP)
+Extra header to use when getting a web page. You may specify any number of
+extra headers. Note that if you should add a custom header that has the same
+name as one of the internal ones curl would use, your externally set header
+will be used instead of the internal one. This allows you to make even
+trickier stuff than curl would normally do. You should not replace internally
+set headers without knowing perfectly well what you're doing.
+.IP "-i/--include"
+(HTTP)
+Include the HTTP-header in the output. The HTTP-header includes things
+like server-name, date of the document, HTTP-version and more...
+.IP "-I/--head"
+(HTTP/FTP)
+Fetch the HTTP-header only! HTTP-servers feature the command HEAD
+which this uses to get nothing but the header of a document. When used
+on a FTP file, curl displays the file size only.
+.IP "-K/--config <config file>"
+Specify which config file to read curl arguments from. The config
+file is a text file in which command line arguments can be written
+which then will be used as if they were written on the actual command
+line. If the first column of a config line is a '#' character, the
+rest of the line will be treated as a comment.
+
+Specify the filename as '-' to make curl read the file from stdin.
+.IP "-l/--list-only"
+(FTP)
+When listing an FTP directory, this switch forces a name-only view.
+Especially useful if you want to machine-parse the contents of an FTP
+directory since the normal directory view doesn't use a standard look
+or format.
+.IP "-L/--location"
+(HTTP/HTTPS)
+If the server reports that the requested page has a different location
+(indicated with the header line Location:) this flag will let curl
+attempt to reattempt the get on the new place. If used together with
+-i or -I, headers from all requested pages will be shown.
+.IP "-m/--max-time <seconds>"
+Maximum time in seconds that you allow the whole operation to take.
+This is useful for preventing your batch jobs from hanging for hours
+due to slow networks or links going down.
+This doesn't work properly in win32 systems.
+.IP "-M/--manual"
+Manual. Display the huge help text.
+.IP "-n/--netrc"
+Makes curl scan the
+.I .netrc
+file in the user's home directory for login name and password. This is
+typically used for ftp on unix. If used with http, curl will enable user
+authentication. See
+.BR netrc(4)
+for details on the file format. Curl will not complain if that file
+hasn't the right permissions (it should not be world nor group
+readable). The environment variable "HOME" is used to find the home
+directory.
+
+A quick and very simple example of how to setup a
+.I .netrc
+to allow curl to ftp to the machine host.domain.com with user name
+'myself' and password 'secret' should look similar to:
+
+.B "machine host.domain.com user myself password secret"
+.IP "-o/--output <file>"
+Write output to <file> instead of stdout. If you are using {} or [] to fetch
+multiple documents, you can use #<num> in the <file> specifier. That variable
+will be replaced with the current string for the URL being fetched. Like in:
+
+ curl http://{one,two}.site.com -o "file_#1.txt"
+
+or use several variables like:
+
+ curl http://{site,host}.host[1-5].com -o "#1_#2"
+.IP "-O/--remote-name"
+Write output to a local file named like the remote file we get. (Only
+the file part of the remote file is used, the path is cut off.)
+.IP "-P/--ftpport <address>"
+(FTP)
+Reverses the initiator/listenor roles when connecting with ftp. This
+switch makes Curl use the PORT command instead of PASV. In
+practice, PORT tells the server to connect to the client's specified
+address and port, while PASV asks the server for an ip address and
+port to connect to. <address> should be one of:
+ interface - i.e "eth0" to specify which interface's IP address you want to use (Unix only)
+ IP address - i.e "192.168.10.1" to specify exact IP number
+ host name - i.e "my.host.domain" to specify machine
+ "-" - (any single-letter string) to make it pick the machine's default
+.IP "-q"
+If used as the first parameter on the command line, the
+.I $HOME/.curlrc
+file will not be read and used as a config file.
+.IP "-Q/--quote <comand>"
+(FTP) Send an arbitrary command to the remote FTP server, by using the QUOTE
+command of the server. Not all servers support this command, and the set of
+QUOTE commands are server specific!
+.IP "-r/--range <range>"
+(HTTP/FTP)
+Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP
+server. Ranges can be specified in a number of ways.
+ 0-499 - specifies the first 500 bytes
+ 500-999 - specifies the second 500 bytes
+ -500 - specifies the last 500 bytes
+ 9500- - specifies the bytes from offset 9500 and forward
+ 0-0,-1 - specifies the first and last byte only(*)(H)
+ 500-700,600-799 - specifies 300 bytes from offset 500(H)
+ 100-199,500-599 - specifies two separate 100 bytes ranges(*)(H)
+
+(*) = NOTE that this will cause the server to reply with a multipart
+response!
+
+You should also be aware that many HTTP/1.1 servers do not have this feature
+enabled, so that when you attempt to get a range, you'll instead get the whole
+document.
+
+FTP range downloads only support the simple syntax 'start-stop' (optionally
+with one of the numbers omitted). It depends on the non-RFC command SIZE.
+.IP "-s/--silent"
+Silent mode. Don't show progress meter or error messages. Makes
+Curl mute.
+.IP "-S/--show-error"
+When used with -s it makes curl show error message if it fails.
+.IP "-t/--upload"
+Transfer the stdin data to the specified file. Curl will read
+everything from stdin until EOF and store with the supplied name. If
+this is used on a http(s) server, the PUT command will be used.
+.IP "-T/--upload-file <file>"
+Like -t, but this transfers the specified local file. If there is no
+file part in the specified URL, Curl will append the local file
+name. NOTE that you must use a trailing / on the last directory to
+really prove to Curl that there is no file name or curl will
+think that your last directory name is the remote file name to
+use. That will most likely cause the upload operation to fail. If
+this is used on a http(s) server, the PUT command will be used.
+.IP "-u/--user <user:password>"
+Specify user and password to use when fetching. See README.curl for detailed
+examples of how to use this. If no password is specified, curl will
+ask for it interactively.
+.IP "-U/--proxy-user <user:password>"
+Specify user and password to use for Proxy authentication. If no
+password is specified, curl will ask for it interactively.
+.IP "-v/--verbose"
+Makes the fetching more verbose/talkative. Mostly usable for
+debugging. Lines starting with '>' means data sent by curl, '<'
+means data received by curl that is hidden in normal cases and lines
+starting with '*' means additional info provided by curl.
+.IP "-V/--version"
+Displays the full version of curl, libcurl and other 3rd party libraries
+linked with the executable.
+.IP "-x/--proxy <proxyhost[:port]>"
+Use specified proxy. If the port number is not specified, it is assumed at
+port 1080.
+.IP "-X/--request <command>"
+(HTTP)
+Specifies a custom request to use when communicating with the HTTP server.
+The specified request will be used instead of the standard GET. Read the
+HTTP 1.1 specification for details and explanations.
+
+(FTP)
+Specifies a custom FTP command to use instead of LIST when doing file lists
+with ftp.
+.IP "-y/--speed-time <speed>"
+Speed Limit. If a download is slower than this given speed, in bytes
+per second, for Speed Time seconds it gets aborted. Speed Time is set
+with -Y and is 30 if not set.
+.IP "-Y/--speed-limit <time>"
+Speed Time. If a download is slower than Speed Limit bytes per second
+during a Speed Time period, the download gets aborted. If Speed Time
+is used, the default Speed Limit will be 1 unless set with -y.
+.IP "-z/--time-cond <date expression>"
+(HTTP)
+Request to get a file that has been modified later than the given time and
+date, or one that has been modified before that time. The date expression can
+be all sorts of date strings or if it doesn't match any internal ones, it
+tries to get the time from a given file name instead! See the
+.BR "GNU date(1)"
+man page for date expression details.
+
+Start the date expression with a dash (-) to make it request for a document
+that is older than the given date/time, default is a document that is newer
+than the specified date/time.
+.IP "-3/--sslv3"
+(HTTPS)
+Forces curl to use SSL version 3 when negotiating with a remote SSL server.
+.IP "-2/--sslv2"
+(HTTPS)
+Forces curl to use SSL version 2 when negotiating with a remote SSL server.
+.IP "-#/--progress-bar"
+Make curl display progress information as a progress bar instead of the
+default statistics.
+.IP "--crlf"
+(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
+.IP "--stderr <file>"
+Redirect all writes to stderr to the specified file instead. If the file name
+is a plain '-', it is instead written to stdout. This option has no point when
+you're using a shell with decent redirecting capabilities.
+.SH FILES
+.I ~/.curlrc
+.RS
+Default config file.
+
+.SH ENVIRONMENT
+.IP "HTTP_PROXY [protocol://]<host>[:port]"
+Sets proxy server to use for HTTP.
+.IP "HTTPS_PROXY [protocol://]<host>[:port]"
+Sets proxy server to use for HTTPS.
+.IP "FTP_PROXY [protocol://]<host>[:port]"
+Sets proxy server to use for FTP.
+.IP "GOPHER_PROXY [protocol://]<host>[:port]"
+Sets proxy server to use for GOPHER.
+.IP "ALL_PROXY [protocol://]<host>[:port]"
+Sets proxy server to use if no protocol-specific proxy is set.
+.IP "NO_PROXY <comma-separated list of hosts>"
+list of host names that shouldn't go through any proxy. If set to a
+asterisk '*' only, it matches all hosts.
+.IP "COLUMNS <integer>"
+The width of the terminal. This variable only affects curl when the
+--progress-bar option is used.
+.SH DIAGNOSTICS
+There exists a bunch of different error messages that may appear during
+bad conditions. They're all pretty verbose and descriptive and therefore
+you won't find any closer description of them here.
+.SH BUGS
+If you do find any (or have other suggestions), mail Daniel Stenberg
+<Daniel.Stenberg@haxx.nu>.
+.SH AUTHORS / CONTRIBUTORS
+ - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ - Rafael Sagula <sagula@inf.ufrgs.br>
+ - Sampo Kellomaki <sampo@iki.fi>
+ - Linas Vepstas <linas@linas.org>
+ - Bjorn Reese <breese@mail1.stofanet.dk>
+ - Johan Anderson <johan@homemail.com>
+ - Kjell Ericson <Kjell.Ericson@sth.frontec.se>
+ - Troy Engel <tengel@sonic.net>
+ - Ryan Nelson <ryan@inch.com>
+ - Bjorn Stenberg <Bjorn.Stenberg@sth.frontec.se>
+ - Angus Mackay <amackay@gus.ml.org>
+ - Eric Young <eay@cryptsoft.com>
+ - Simon Dick <simond@totally.irrelevant.org>
+ - Oren Tirosh <oren@monty.hishome.net>
+ - Steven G. Johnson <stevenj@alum.mit.edu>
+ - Gilbert Ramirez Jr. <gram@verdict.uthscsa.edu>
+ - Andrés García <ornalux@redestb.es>
+ - Douglas E. Wegscheid <wegscd@whirlpool.com>
+ - Mark Butler <butlerm@xmission.com>
+ - Eric Thelin <eric@generation-i.com>
+ - Marc Boucher <marc@mbsi.ca>
+ - Greg Onufer <Greg.Onufer@Eng.Sun.COM>
+ - Doug Kaufman <dkaufman@rahul.net>
+ - David Eriksson <david@2good.com>
+ - Ralph Beckmann <rabe@uni-paderborn.de>
+ - T. Yamada <tai@imasy.or.jp>
+ - Lars J. Aas <larsa@sim.no>
+ - Jörn Hartroth <Joern.Hartroth@telekom.de>
+ - Matthew Clarke <clamat@van.maves.ca>
+ - Linus Nielsen <Linus.Nielsen@haxx.nu>
+ - Felix von Leitner <felix@convergence.de>
+ - Dan Zitter <dzitter@zitter.net>
+ - Jongki Suwandi <Jongki.Suwandi@eng.sun.com>
+ - Chris Maltby <chris@aurema.com>
+.SH WWW
+http://curl.haxx.nu
+.SH FTP
+ftp://ftp.sunet.se/pub/www/utilities/curl/
+.SH "SEE ALSO"
+.BR ftp (1),
+.BR wget (1),
+.BR snarf (1)
diff --git a/curl.beos-patch b/curl.beos-patch
new file mode 100644
index 000000000..25a1b3b60
--- /dev/null
+++ b/curl.beos-patch
@@ -0,0 +1,695 @@
+? Makefile.in
+? autogen.sh
+? configure
+? lib/Makefile.in
+? src/Makefile.in
+Index: config.h.in
+===================================================================
+RCS file: /cvs/curl/curl/config.h.in,v
+retrieving revision 1.10
+diff -u -r1.10 config.h.in
+--- config.h.in 1999/10/17 11:18:34 1.10
++++ config.h.in 1999/11/24 15:15:21
+@@ -109,6 +109,9 @@
+ /* Define if you have the <getopt.h> header file. */
+ #undef HAVE_GETOPT_H
+
++/* Define if you have the <net/if.h> header file. */
++#undef HAVE_NET_IF_H
++
+ /* Define if you have the <netdb.h> header file. */
+ #undef HAVE_NETDB_H
+
+Index: configure.in
+===================================================================
+RCS file: /cvs/curl/curl/configure.in,v
+retrieving revision 1.35
+diff -u -r1.35 configure.in
+--- configure.in 1999/11/11 21:05:38 1.35
++++ configure.in 1999/11/24 15:15:21
+@@ -117,24 +117,26 @@
+
+ dnl Checks for header files.
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS( unistd.h \
+- arpa/inet.h \
+- netinet/in.h \
+- netdb.h \
+- sys/select.h \
+- sys/socket.h \
+- sys/sockio.h \
+- sys/stat.h \
+- sys/types.h \
+- getopt.h \
+- sys/param.h \
+- termios.h \
+- termio.h \
+- sgtty.h \
+- fcntl.h \
+- dlfcn.h \
+- alloca.h )
+-
++AC_CHECK_HEADERS( \
++ unistd.h \
++ arpa/inet.h \
++ net/if.h \
++ netinet/in.h \
++ netdb.h \
++ sys/select.h \
++ sys/socket.h \
++ sys/sockio.h \
++ sys/stat.h \
++ sys/types.h \
++ getopt.h \
++ sys/param.h \
++ termios.h \
++ termio.h \
++ sgtty.h \
++ fcntl.h \
++ dlfcn.h \
++ alloca.h \
++)
+
+ dnl Check for libz header
+ dnl AC_CHECK_HEADERS(zlib.h)
+Index: include/curl/curl.h
+===================================================================
+RCS file: /cvs/curl/curl/include/curl/curl.h,v
+retrieving revision 1.5
+diff -u -r1.5 curl.h
+--- curl.h 1999/11/23 08:22:42 1.5
++++ curl.h 1999/11/24 15:15:21
+@@ -365,9 +365,13 @@
+ TIMECOND_LAST
+ } TimeCond;
+
++#ifdef __BEOS__
++#include <support/SupportDefs.h>
++#else
+ #ifndef __cplusplus /* (rabe) */
+ typedef char bool;
+ #endif /* (rabe) */
++#endif
+
+ /**********************************************************************
+ *
+Index: lib/Makefile.am
+===================================================================
+RCS file: /cvs/curl/curl/lib/Makefile.am,v
+retrieving revision 1.16
+diff -u -r1.16 Makefile.am
+--- Makefile.am 1999/10/22 13:27:36 1.16
++++ Makefile.am 1999/11/24 15:15:21
+@@ -9,7 +9,7 @@
+ # Some flags needed when trying to cause warnings ;-)
+ # CFLAGS = -Wall -pedantic
+
+-INCLUDES = -I../include
++INCLUDES = -I$(top_srcdir)/include
+
+ libcurl_a_SOURCES = \
+ arpa_telnet.h file.c getpass.h netrc.h timeval.c \
+Index: lib/dict.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/dict.c,v
+retrieving revision 1.5
+diff -u -r1.5 dict.c
+--- dict.c 1999/10/13 22:27:12 1.5
++++ dict.c 1999/11/24 15:15:22
+@@ -66,8 +66,12 @@
+ #include <unistd.h>
+ #endif
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <signal.h>
+
+Index: lib/download.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/download.c,v
+retrieving revision 1.30
+diff -u -r1.30 download.c
+--- download.c 1999/11/23 08:24:26 1.30
++++ download.c 1999/11/24 15:15:23
+@@ -54,6 +54,10 @@
+ #include "urldata.h"
+ #include <curl/curl.h>
+
++#ifdef __BEOS__
++#include <net/socket.h>
++#endif
++
+ #ifdef WIN32
+ #if !defined( __GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Index: lib/file.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/file.c,v
+retrieving revision 1.6
+diff -u -r1.6 file.c
+--- file.c 1999/11/19 07:25:40 1.6
++++ file.c 1999/11/24 15:15:23
+@@ -67,8 +67,12 @@
+ #include <unistd.h>
+ #endif
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <signal.h>
+
+Index: lib/ftp.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/ftp.c,v
+retrieving revision 1.18
+diff -u -r1.18 ftp.c
+--- ftp.c 1999/11/23 08:25:06 1.18
++++ ftp.c 1999/11/24 15:15:26
+@@ -58,7 +58,9 @@
+ #else /* some kind of unix */
+ #include <sys/socket.h>
+ #include <netinet/in.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
+ #include <sys/utsname.h>
+ #include <netdb.h>
+ #endif
+Index: lib/getdate.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/getdate.c,v
+retrieving revision 1.5
+diff -u -r1.5 getdate.c
+--- getdate.c 1999/08/12 06:43:33 1.5
++++ getdate.c 1999/11/24 15:15:31
+@@ -1,26 +1,26 @@
+
+ /* A Bison parser, made from getdate.y
+- by GNU Bison version 1.25
++ by GNU Bison version 1.27
+ */
+
+ #define YYBISON 1 /* Identify Bison output. */
+
+-#define tAGO 258
+-#define tDAY 259
+-#define tDAY_UNIT 260
+-#define tDAYZONE 261
+-#define tDST 262
+-#define tHOUR_UNIT 263
+-#define tID 264
+-#define tMERIDIAN 265
+-#define tMINUTE_UNIT 266
+-#define tMONTH 267
+-#define tMONTH_UNIT 268
+-#define tSEC_UNIT 269
+-#define tSNUMBER 270
+-#define tUNUMBER 271
+-#define tYEAR_UNIT 272
+-#define tZONE 273
++#define tAGO 257
++#define tDAY 258
++#define tDAY_UNIT 259
++#define tDAYZONE 260
++#define tDST 261
++#define tHOUR_UNIT 262
++#define tID 263
++#define tMERIDIAN 264
++#define tMINUTE_UNIT 265
++#define tMONTH 266
++#define tMONTH_UNIT 267
++#define tSEC_UNIT 268
++#define tSNUMBER 269
++#define tUNUMBER 270
++#define tYEAR_UNIT 271
++#define tZONE 272
+
+ #line 1 "getdate.y"
+
+@@ -211,9 +211,11 @@
+
+ #ifndef __cplusplus
+ #ifndef __STDC__
++#ifndef const
+ #define const
+ #endif
+ #endif
++#endif
+
+
+
+@@ -221,7 +223,7 @@
+ #define YYFLAG -32768
+ #define YYNTBASE 22
+
+-#define YYTRANSLATE(x) ((unsigned)(x) <= 273 ? yytranslate[x] : 32)
++#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 32)
+
+ static const char yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+@@ -249,9 +251,9 @@
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+- 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
+- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+- 16, 17, 18
++ 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
++ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
++ 17, 18
+ };
+
+ #if YYDEBUG != 0
+@@ -370,7 +372,8 @@
+ 56
+ };
+ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+-#line 3 "/usr/lib/bison.simple"
++#line 3 "/boot/apps/GeekGadgets/share/bison.simple"
++/* This file comes from bison-1.27. */
+
+ /* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+@@ -387,46 +390,66 @@
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
++ Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
+
+ /* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+-#ifndef alloca
++/* This is the parser code that is written into each bison parser
++ when the %semantic_parser declaration is not specified in the grammar.
++ It was written by Richard Stallman by simplifying the hairy parser
++ used when %semantic_parser is specified. */
++
++#ifndef YYSTACK_USE_ALLOCA
++#ifdef alloca
++#define YYSTACK_USE_ALLOCA
++#else /* alloca not defined */
+ #ifdef __GNUC__
++#define YYSTACK_USE_ALLOCA
+ #define alloca __builtin_alloca
+ #else /* not GNU C. */
+-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
++#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
++#define YYSTACK_USE_ALLOCA
+ #include <alloca.h>
+ #else /* not sparc */
+-#if defined (MSDOS) && !defined (__TURBOC__)
++/* We think this test detects Watcom and Microsoft C. */
++/* This used to test MSDOS, but that is a bad idea
++ since that symbol is in the user namespace. */
++#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
++#if 0 /* No need for malloc.h, which pollutes the namespace;
++ instead, just don't use alloca. */
+ #include <malloc.h>
++#endif
+ #else /* not MSDOS, or __TURBOC__ */
+ #if defined(_AIX)
+-#include <malloc.h>
++/* I don't know what this was needed for, but it pollutes the namespace.
++ So I turned it off. rms, 2 May 1997. */
++/* #include <malloc.h> */
+ #pragma alloca
+-#else /* not MSDOS, __TURBOC__, or _AIX */
+-#ifdef __hpux
+-#ifdef __cplusplus
+-extern "C" {
+-void *alloca (unsigned int);
+-};
+-#else /* not __cplusplus */
+-void *alloca ();
+-#endif /* not __cplusplus */
++#define YYSTACK_USE_ALLOCA
++#else /* not MSDOS, or __TURBOC__, or _AIX */
++#if 0
++#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
++ and on HPUX 10. Eventually we can turn this on. */
++#define YYSTACK_USE_ALLOCA
++#define alloca __builtin_alloca
+ #endif /* __hpux */
++#endif
+ #endif /* not _AIX */
+ #endif /* not MSDOS, or __TURBOC__ */
+-#endif /* not sparc. */
+-#endif /* not GNU C. */
+-#endif /* alloca not defined. */
++#endif /* not sparc */
++#endif /* not GNU C */
++#endif /* alloca not defined */
++#endif /* YYSTACK_USE_ALLOCA not defined */
+
+-/* This is the parser code that is written into each bison parser
+- when the %semantic_parser declaration is not specified in the grammar.
+- It was written by Richard Stallman by simplifying the hairy parser
+- used when %semantic_parser is specified. */
++#ifdef YYSTACK_USE_ALLOCA
++#define YYSTACK_ALLOC alloca
++#else
++#define YYSTACK_ALLOC malloc
++#endif
+
+ /* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+@@ -436,8 +459,8 @@
+ #define yyclearin (yychar = YYEMPTY)
+ #define YYEMPTY -2
+ #define YYEOF 0
+-#define YYACCEPT return(0)
+-#define YYABORT return(1)
++#define YYACCEPT goto yyacceptlab
++#define YYABORT goto yyabortlab
+ #define YYERROR goto yyerrlab1
+ /* Like YYERROR except do call yyerror.
+ This remains here temporarily to ease the
+@@ -518,12 +541,12 @@
+ #ifndef YYMAXDEPTH
+ #define YYMAXDEPTH 10000
+ #endif
+-
+-/* Prevent warning if -Wstrict-prototypes. */
+-#ifdef __GNUC__
+-int yyparse (void);
+-#endif
+
++/* Define __yy_memcpy. Note that the size argument
++ should be passed with type unsigned int, because that is what the non-GCC
++ definitions require. With GCC, __builtin_memcpy takes an arg
++ of type size_t, but it can handle unsigned int. */
++
+ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+ #else /* not GNU C or C++ */
+@@ -535,7 +558,7 @@
+ __yy_memcpy (to, from, count)
+ char *to;
+ char *from;
+- int count;
++ unsigned int count;
+ {
+ register char *f = from;
+ register char *t = to;
+@@ -550,10 +573,10 @@
+ /* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+ static void
+-__yy_memcpy (char *to, char *from, int count)
++__yy_memcpy (char *to, char *from, unsigned int count)
+ {
+- register char *f = from;
+ register char *t = to;
++ register char *f = from;
+ register int i = count;
+
+ while (i-- > 0)
+@@ -563,7 +586,7 @@
+ #endif
+ #endif
+
+-#line 196 "/usr/lib/bison.simple"
++#line 216 "/boot/apps/GeekGadgets/share/bison.simple"
+
+ /* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+@@ -584,6 +607,15 @@
+ #define YYPARSE_PARAM_DECL
+ #endif /* not YYPARSE_PARAM */
+
++/* Prevent warning if -Wstrict-prototypes. */
++#ifdef __GNUC__
++#ifdef YYPARSE_PARAM
++int yyparse (void *);
++#else
++int yyparse (void);
++#endif
++#endif
++
+ int
+ yyparse(YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
+@@ -612,6 +644,7 @@
+ #endif
+
+ int yystacksize = YYINITDEPTH;
++ int yyfree_stacks = 0;
+
+ #ifdef YYPURE
+ int yychar;
+@@ -696,18 +729,32 @@
+ if (yystacksize >= YYMAXDEPTH)
+ {
+ yyerror("parser stack overflow");
++ if (yyfree_stacks)
++ {
++ free (yyss);
++ free (yyvs);
++#ifdef YYLSP_NEEDED
++ free (yyls);
++#endif
++ }
+ return 2;
+ }
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
+- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
++#ifndef YYSTACK_USE_ALLOCA
++ yyfree_stacks = 1;
++#endif
++ yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
++ __yy_memcpy ((char *)yyss, (char *)yyss1,
++ size * (unsigned int) sizeof (*yyssp));
++ yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
++ __yy_memcpy ((char *)yyvs, (char *)yyvs1,
++ size * (unsigned int) sizeof (*yyvsp));
+ #ifdef YYLSP_NEEDED
+- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
++ yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
++ __yy_memcpy ((char *)yyls, (char *)yyls1,
++ size * (unsigned int) sizeof (*yylsp));
+ #endif
+ #endif /* no yyoverflow */
+
+@@ -1230,7 +1277,7 @@
+ break;}
+ }
+ /* the action file gets copied in in place of this dollarsign */
+-#line 498 "/usr/lib/bison.simple"
++#line 542 "/boot/apps/GeekGadgets/share/bison.simple"
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+@@ -1425,6 +1472,30 @@
+
+ yystate = yyn;
+ goto yynewstate;
++
++ yyacceptlab:
++ /* YYACCEPT comes here. */
++ if (yyfree_stacks)
++ {
++ free (yyss);
++ free (yyvs);
++#ifdef YYLSP_NEEDED
++ free (yyls);
++#endif
++ }
++ return 0;
++
++ yyabortlab:
++ /* YYABORT comes here. */
++ if (yyfree_stacks)
++ {
++ free (yyss);
++ free (yyvs);
++#ifdef YYLSP_NEEDED
++ free (yyls);
++#endif
++ }
++ return 1;
+ }
+ #line 451 "getdate.y"
+
+Index: lib/hostip.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/hostip.c,v
+retrieving revision 1.8
+diff -u -r1.8 hostip.c
+--- hostip.c 1999/10/13 22:27:12 1.8
++++ hostip.c 1999/11/24 15:15:31
+@@ -53,7 +53,9 @@
+ #endif
+ #include <netinet/in.h>
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
+ #endif
+
+ #include "urldata.h"
+Index: lib/http.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/http.c,v
+retrieving revision 1.17
+diff -u -r1.17 http.c
+--- http.c 1999/10/30 15:43:52 1.17
++++ http.c 1999/11/24 15:15:31
+@@ -66,8 +66,12 @@
+ #include <unistd.h>
+ #endif
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <signal.h>
+
+Index: lib/if2ip.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/if2ip.c,v
+retrieving revision 1.7
+diff -u -r1.7 if2ip.c
+--- if2ip.c 1999/10/13 22:27:12 1.7
++++ if2ip.c 1999/11/24 15:15:31
+@@ -48,13 +48,17 @@
+ #include <unistd.h>
+ #endif
+
+-#ifndef WIN32
++#if ! defined(WIN32) && ! defined(__BEOS__)
+
+ #include <sys/socket.h>
+ #include <netinet/in.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
+ #include <netinet/in.h>
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+
+ /* -- if2ip() -- */
+Index: lib/if2ip.h
+===================================================================
+RCS file: /cvs/curl/curl/lib/if2ip.h,v
+retrieving revision 1.5
+diff -u -r1.5 if2ip.h
+--- if2ip.h 1999/10/13 22:27:12 1.5
++++ if2ip.h 1999/11/24 15:15:31
+@@ -41,7 +41,7 @@
+ ****************************************************************************/
+ #include <curl/setup.h>
+
+-#ifndef WIN32
++#if ! defined(WIN32) && ! defined(__BEOS__)
+ char *if2ip(char *interface);
+ #else
+ #define if2ip(x) NULL
+Index: lib/telnet.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/telnet.c,v
+retrieving revision 1.9
+diff -u -r1.9 telnet.c
+--- telnet.c 1999/10/13 22:27:12 1.9
++++ telnet.c 1999/11/24 15:15:32
+@@ -74,8 +74,12 @@
+ #include <unistd.h>
+ #endif
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <signal.h>
+
+Index: lib/upload.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/upload.c,v
+retrieving revision 1.9
+diff -u -r1.9 upload.c
+--- upload.c 1999/10/13 22:27:12 1.9
++++ upload.c 1999/11/24 15:15:32
+@@ -58,6 +58,11 @@
+ #endif
+
+ #include <curl/curl.h>
++
++#ifdef __BEOS__
++#include <net/socket.h>
++#endif
++
+ #include "urldata.h"
+ #include "speedcheck.h"
+ #include "sendf.h"
+Index: lib/url.c
+===================================================================
+RCS file: /cvs/curl/curl/lib/url.c,v
+retrieving revision 1.31
+diff -u -r1.31 url.c
+--- url.c 1999/11/19 07:07:10 1.31
++++ url.c 1999/11/24 15:15:36
+@@ -71,8 +71,12 @@
+ #include <unistd.h>
+ #endif
+ #include <netdb.h>
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++#ifdef HAVE_NET_IF_H
+ #include <net/if.h>
++#endif
+ #include <sys/ioctl.h>
+ #include <signal.h>
+
+Index: src/Makefile.am
+===================================================================
+RCS file: /cvs/curl/curl/src/Makefile.am,v
+retrieving revision 1.13
+diff -u -r1.13 Makefile.am
+--- Makefile.am 1999/10/13 22:50:30 1.13
++++ Makefile.am 1999/11/24 15:15:36
+@@ -6,7 +6,7 @@
+ # CFLAGS = -Wall -pedantic
+ CPPFLAGS = -DGLOBURL -DCURL_SEPARATORS
+
+-INCLUDES = -I../include
++INCLUDES = -I$(top_srcdir)/include
+
+ bin_PROGRAMS = curl
+
+@@ -22,6 +22,6 @@
+ AUTOMAKE_OPTIONS = foreign no-dependencies
+
+ # This generates the hugehelp.c file
+-hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
++hugehelp.c: $(top_srcdir)/README.curl $(top_srcdir)/curl.1 mkhelp.pl
+ rm -f hugehelp.c
+- $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
++ $(NROFF) -man $(top_srcdir)/curl.1 | $(PERL) $(top_srcdir)/src/mkhelp.pl $(top_srcdir)/README.curl > hugehelp.c
diff --git a/curl.spec b/curl.spec
new file mode 100644
index 000000000..adf907e91
--- /dev/null
+++ b/curl.spec
@@ -0,0 +1,52 @@
+%define name curl
+%define version 6.0
+%define release 1
+%define prefix /usr/local
+
+%define builddir $RPM_BUILD_DIR/%{name}-%{version}
+
+Summary: get a file from a FTP, GOPHER or HTTP server.
+Name: %{name}
+Version: %{version}
+Release: %{release}
+Copyright: MPL
+Vendor: Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+Packager: Troy Engel <tengel@sonic.net>
+Group: Utilities/Console
+Source: %{name}-%{version}.tar.gz
+URL: http://curl.haxx.nu/
+BuildRoot: /tmp/%{name}-%{version}-root
+
+%description
+curl is a client to get documents/files from servers, using any of the
+supported protocols. The command is designed to work without user
+interaction or any kind of interactivity.
+
+curl offers a busload of useful tricks like proxy support, user
+authentication, ftp upload, HTTP post, file transfer resume and more.
+
+Note: this version is compiled without SSL (https:) support.
+
+%prep
+rm -rf $RPM_BUILD_ROOT
+rm -rf %{builddir}
+
+%setup
+
+%build
+export CFLAGS=$RPM_OPT_FLAGS
+./configure --prefix=$RPM_BUILD_ROOT%{prefix}
+make
+
+%install
+make install-strip
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+rm -rf %{builddir}
+
+%files
+%defattr(-,root,root)
+%attr(0755,root,root) %{prefix}/bin/curl
+%doc curl.1 README* CHANGES CONTRIBUTE FAQ FILES INSTALL LEGAL MPL-1.0.txt RESOURCES TODO perl/
+
diff --git a/curl_631_general.patch b/curl_631_general.patch
new file mode 100644
index 000000000..242e308f9
--- /dev/null
+++ b/curl_631_general.patch
@@ -0,0 +1,1265 @@
+Only in curl-6.3.1: config-win32.h
+Only in curl-6.3.1: config-win32.h~
+Only in curl-6.3.1: config.cache
+Only in curl-6.3.1: config.h
+diff -cr curl-6.3.1-org/config.h.in curl-6.3.1/config.h.in
+*** curl-6.3.1-org/config.h.in Sun Oct 17 13:18:34 1999
+--- curl-6.3.1/config.h.in Thu Dec 9 14:23:01 1999
+***************
+*** 37,42 ****
+--- 37,45 ----
+ /* The number of bytes in a long long. */
+ #undef SIZEOF_LONG_LONG
+
++ /* Define if you have the closesocket function. */
++ #undef HAVE_CLOSESOCKET
++
+ /* Define if you have the gethostbyaddr function. */
+ #undef HAVE_GETHOSTBYADDR
+
+***************
+*** 109,114 ****
+--- 112,120 ----
+ /* Define if you have the <getopt.h> header file. */
+ #undef HAVE_GETOPT_H
+
++ /* Define if you have the <io.h> header file. */
++ #undef HAVE_IO_H
++
+ /* Define if you have the <netdb.h> header file. */
+ #undef HAVE_NETDB_H
+
+***************
+*** 169,177 ****
+--- 175,189 ----
+ /* Define if you have the <termios.h> header file. */
+ #undef HAVE_TERMIOS_H
+
++ /* Define if you have the <time.h> header file. */
++ #undef HAVE_TIME_H
++
+ /* Define if you have the <unistd.h> header file. */
+ #undef HAVE_UNISTD_H
+
++ /* Define if you have the <winsock.h> header file. */
++ #undef HAVE_WINSOCK_H
++
+ /* Define if you have the <x509.h> header file. */
+ #undef HAVE_X509_H
+
+Only in curl-6.3.1: config.log
+Only in curl-6.3.1: config.status
+Only in curl-6.3.1: configure
+diff -cr curl-6.3.1-org/configure.in curl-6.3.1/configure.in
+*** curl-6.3.1-org/configure.in Wed Nov 24 14:48:38 1999
+--- curl-6.3.1/configure.in Thu Dec 9 14:34:36 1999
+***************
+*** 1,7 ****
+ dnl $Id$
+ dnl Process this file with autoconf to produce a configure script.
+ AC_INIT(lib/urldata.h)
+! AM_CONFIG_HEADER(config.h)
+ AM_INIT_AUTOMAKE(curl,"6.3.1")
+
+ dnl Checks for programs.
+--- 1,7 ----
+ dnl $Id$
+ dnl Process this file with autoconf to produce a configure script.
+ AC_INIT(lib/urldata.h)
+! AM_CONFIG_HEADER(config.h src/config.h)
+ AM_INIT_AUTOMAKE(curl,"6.3.1")
+
+ dnl Checks for programs.
+***************
+*** 133,139 ****
+ sgtty.h \
+ fcntl.h \
+ dlfcn.h \
+! alloca.h )
+
+
+ dnl Check for libz header
+--- 133,143 ----
+ sgtty.h \
+ fcntl.h \
+ dlfcn.h \
+! alloca.h \
+! winsock.h \
+! time.h \
+! io.h
+! )
+
+
+ dnl Check for libz header
+***************
+*** 175,181 ****
+ tcsetattr \
+ tcgetattr \
+ perror \
+! getpass )
+
+
+
+--- 179,187 ----
+ tcsetattr \
+ tcgetattr \
+ perror \
+! getpass \
+! closesocket
+! )
+
+
+
+Only in curl-6.3.1: configure.in~
+Common subdirectories: curl-6.3.1-org/include and curl-6.3.1/include
+Common subdirectories: curl-6.3.1-org/lib and curl-6.3.1/lib
+Common subdirectories: curl-6.3.1-org/perl and curl-6.3.1/perl
+Common subdirectories: curl-6.3.1-org/src and curl-6.3.1/src
+Only in curl-6.3.1: stamp-h1
+Common subdirectories: curl-6.3.1-org/include/curl and curl-6.3.1/include/curl
+diff -cr curl-6.3.1-org/include/curl/curl.h curl-6.3.1/include/curl/curl.h
+*** curl-6.3.1-org/include/curl/curl.h Wed Nov 24 14:48:37 1999
+--- curl-6.3.1/include/curl/curl.h Wed Dec 8 15:34:53 1999
+***************
+*** 352,360 ****
+--- 352,367 ----
+ /* HTTP request, for odd commands like DELETE, TRACE and others */
+ T(HTTPREQUEST, OBJECTPOINT, 35),
+
++ /* Progress mode sets alternative progress mode displays, the only
++ one defined today is 1 which makes the #-style progress bar. */
++ T(PROGRESSMODE, LONG, 36),
++
+ URGTAG_LASTENTRY /* the last unusued */
+ } UrgTag;
+
++ #define CURL_PROGRESS_STATS 0 /* default progress display */
++ #define CURL_PROGRESS_BAR 1
++
+ typedef enum {
+ TIMECOND_NONE,
+
+Only in curl-6.3.1/include/curl: curl.h~
+Only in curl-6.3.1-org/include/curl: setup.h
+Only in curl-6.3.1/include/curl: setup.h~
+diff -cr curl-6.3.1-org/lib/Makefile curl-6.3.1/lib/Makefile
+*** curl-6.3.1-org/lib/Makefile Wed Dec 8 13:38:22 1999
+--- curl-6.3.1/lib/Makefile Thu Dec 9 15:42:21 1999
+***************
+*** 90,98 ****
+
+
+ DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I..
+! CPPFLAGS =
+! LDFLAGS =
+! LIBS = -ldl -lsocket -lnsl
+ libcurl_a_LIBADD =
+ libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
+ formdata.o upload.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
+--- 90,98 ----
+
+
+ DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I..
+! CPPFLAGS = -I/homes/qradlsg/openssl-0.9.4/include
+! LDFLAGS = -L/homes/qradlsg/openssl-0.9.4
+! LIBS = -lssl -lcrypto -ldl -lsocket -lnsl
+ libcurl_a_LIBADD =
+ libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
+ formdata.o upload.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
+***************
+*** 99,105 ****
+ speedcheck.o getdate.o download.o ldap.o ssluse.o version.o getenv.o \
+ escape.o mprintf.o telnet.o getpass.o netrc.o
+ AR = ar
+! CFLAGS = -g -O2
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+--- 99,105 ----
+ speedcheck.o getdate.o download.o ldap.o ssluse.o version.o getenv.o \
+ escape.o mprintf.o telnet.o getpass.o netrc.o
+ AR = ar
+! CFLAGS = -g -O2 -Wall -pedantic
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+Only in curl-6.3.1/lib: Makefile~
+diff -cr curl-6.3.1-org/lib/cookie.c curl-6.3.1/lib/cookie.c
+*** curl-6.3.1-org/lib/cookie.c Fri Nov 12 15:54:59 1999
+--- curl-6.3.1/lib/cookie.c Thu Dec 9 15:44:37 1999
+***************
+*** 60,66 ****
+ #include <ctype.h>
+
+ #include "cookie.h"
+! #include <curl/setup.h>
+ #include "getdate.h"
+
+ /****************************************************************************
+--- 60,66 ----
+ #include <ctype.h>
+
+ #include "cookie.h"
+! #include "setup.h"
+ #include "getdate.h"
+
+ /****************************************************************************
+***************
+*** 134,140 ****
+ }
+ }
+ ptr=strtok(NULL, ";");
+! while(ptr && *ptr && isspace(*ptr))
+ ptr++;
+ }
+ }
+--- 134,140 ----
+ }
+ }
+ ptr=strtok(NULL, ";");
+! while(ptr && *ptr && isspace((int)*ptr))
+ ptr++;
+ }
+ }
+***************
+*** 288,294 ****
+ {
+ char line[MAX_COOKIE_LINE];
+ struct CookieInfo *c;
+- struct Cookie *co;
+ FILE *fp;
+
+ c = (struct CookieInfo *)malloc(sizeof(struct CookieInfo));
+--- 288,293 ----
+***************
+*** 303,309 ****
+ if(strnequal("Set-Cookie:", line, 11)) {
+ /* This is a cookie line, get it! */
+ char *lineptr=&line[11];
+! while(*lineptr && isspace(*lineptr))
+ lineptr++;
+
+ cookie_add(c, TRUE, lineptr);
+--- 302,308 ----
+ if(strnequal("Set-Cookie:", line, 11)) {
+ /* This is a cookie line, get it! */
+ char *lineptr=&line[11];
+! while(*lineptr && isspace((int)*lineptr))
+ lineptr++;
+
+ cookie_add(c, TRUE, lineptr);
+***************
+*** 311,317 ****
+ else {
+ /* This might be a netscape cookie-file line, get it! */
+ char *lineptr=line;
+! while(*lineptr && isspace(*lineptr))
+ lineptr++;
+
+ cookie_add(c, FALSE, lineptr);
+--- 310,316 ----
+ else {
+ /* This might be a netscape cookie-file line, get it! */
+ char *lineptr=line;
+! while(*lineptr && isspace((int)*lineptr))
+ lineptr++;
+
+ cookie_add(c, FALSE, lineptr);
+Only in curl-6.3.1/lib: cookie.c~
+Binary files curl-6.3.1-org/lib/cookie.o and curl-6.3.1/lib/cookie.o differ
+diff -cr curl-6.3.1-org/lib/dict.c curl-6.3.1/lib/dict.c
+*** curl-6.3.1-org/lib/dict.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/dict.c Thu Dec 9 14:27:23 1999
+***************
+*** 49,55 ****
+
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 49,55 ----
+
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Binary files curl-6.3.1-org/lib/dict.o and curl-6.3.1/lib/dict.o differ
+diff -cr curl-6.3.1-org/lib/download.c curl-6.3.1/lib/download.c
+*** curl-6.3.1-org/lib/download.c Tue Nov 23 09:24:26 1999
+--- curl-6.3.1/lib/download.c Thu Dec 9 14:27:23 1999
+***************
+*** 42,48 ****
+ #include <stdio.h>
+ #include <string.h>
+
+! #include <curl/setup.h>
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+--- 42,48 ----
+ #include <stdio.h>
+ #include <string.h>
+
+! #include "setup.h"
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+Binary files curl-6.3.1-org/lib/download.o and curl-6.3.1/lib/download.o differ
+diff -cr curl-6.3.1-org/lib/file.c curl-6.3.1/lib/file.c
+*** curl-6.3.1-org/lib/file.c Fri Nov 19 08:25:40 1999
+--- curl-6.3.1/lib/file.c Thu Dec 9 14:27:24 1999
+***************
+*** 49,55 ****
+
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 49,55 ----
+
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Binary files curl-6.3.1-org/lib/file.o and curl-6.3.1/lib/file.o differ
+diff -cr curl-6.3.1-org/lib/formdata.c curl-6.3.1/lib/formdata.c
+*** curl-6.3.1-org/lib/formdata.c Tue Nov 23 17:54:36 1999
+--- curl-6.3.1/lib/formdata.c Thu Dec 9 14:27:25 1999
+***************
+*** 56,62 ****
+
+ #include <time.h>
+
+! #include <curl/setup.h>
+ #include <curl/curl.h>
+ #include "formdata.h"
+
+--- 56,62 ----
+
+ #include <time.h>
+
+! #include "setup.h"
+ #include <curl/curl.h>
+ #include "formdata.h"
+
+Binary files curl-6.3.1-org/lib/formdata.o and curl-6.3.1/lib/formdata.o differ
+diff -cr curl-6.3.1-org/lib/ftp.c curl-6.3.1/lib/ftp.c
+*** curl-6.3.1-org/lib/ftp.c Tue Nov 23 09:25:06 1999
+--- curl-6.3.1/lib/ftp.c Thu Dec 9 15:43:10 1999
+***************
+*** 44,50 ****
+ #include <ctype.h>
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+--- 44,50 ----
+ #include <ctype.h>
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+***************
+*** 728,734 ****
+ char *ptr2;
+
+ from=strtol(data->range, &ptr, 0);
+! while(ptr && *ptr && (isspace(*ptr) || (*ptr=='-')))
+ ptr++;
+ to=strtol(ptr, &ptr2, 0);
+ if(ptr == ptr2) {
+--- 728,734 ----
+ char *ptr2;
+
+ from=strtol(data->range, &ptr, 0);
+! while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-')))
+ ptr++;
+ to=strtol(ptr, &ptr2, 0);
+ if(ptr == ptr2) {
+***************
+*** 886,892 ****
+ if('(' == *bytes)
+ break;
+ /* if only skip digits, or else we're in deep trouble */
+! if(!isdigit(*bytes)) {
+ bytes=NULL;
+ break;
+ }
+--- 886,892 ----
+ if('(' == *bytes)
+ break;
+ /* if only skip digits, or else we're in deep trouble */
+! if(!isdigit((int)*bytes)) {
+ bytes=NULL;
+ break;
+ }
+Only in curl-6.3.1/lib: ftp.c~
+Binary files curl-6.3.1-org/lib/ftp.o and curl-6.3.1/lib/ftp.o differ
+diff -cr curl-6.3.1-org/lib/hostip.c curl-6.3.1/lib/hostip.c
+*** curl-6.3.1-org/lib/hostip.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/hostip.c Thu Dec 9 14:27:27 1999
+***************
+*** 40,46 ****
+
+ #include <string.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 40,46 ----
+
+ #include <string.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Binary files curl-6.3.1-org/lib/hostip.o and curl-6.3.1/lib/hostip.o differ
+diff -cr curl-6.3.1-org/lib/http.c curl-6.3.1/lib/http.c
+*** curl-6.3.1-org/lib/http.c Sat Oct 30 17:43:52 1999
+--- curl-6.3.1/lib/http.c Thu Dec 9 14:27:27 1999
+***************
+*** 49,55 ****
+
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 49,55 ----
+
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Binary files curl-6.3.1-org/lib/http.o and curl-6.3.1/lib/http.o differ
+diff -cr curl-6.3.1-org/lib/if2ip.c curl-6.3.1/lib/if2ip.c
+*** curl-6.3.1-org/lib/if2ip.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/if2ip.c Thu Dec 9 14:27:28 1999
+***************
+*** 42,48 ****
+ #include <stdlib.h>
+ #include <string.h>
+
+! #include <curl/setup.h>
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+--- 42,48 ----
+ #include <stdlib.h>
+ #include <string.h>
+
+! #include "setup.h"
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+diff -cr curl-6.3.1-org/lib/if2ip.h curl-6.3.1/lib/if2ip.h
+*** curl-6.3.1-org/lib/if2ip.h Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/if2ip.h Thu Dec 9 14:27:49 1999
+***************
+*** 39,45 ****
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+! #include <curl/setup.h>
+
+ #ifndef WIN32
+ char *if2ip(char *interface);
+--- 39,45 ----
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+! #include "setup.h"
+
+ #ifndef WIN32
+ char *if2ip(char *interface);
+Binary files curl-6.3.1-org/lib/if2ip.o and curl-6.3.1/lib/if2ip.o differ
+diff -cr curl-6.3.1-org/lib/ldap.c curl-6.3.1/lib/ldap.c
+*** curl-6.3.1-org/lib/ldap.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/ldap.c Thu Dec 9 15:44:17 1999
+***************
+*** 48,54 ****
+ #include <sys/stat.h>
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__)
+ #else
+--- 48,54 ----
+ #include <sys/stat.h>
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__)
+ #else
+***************
+*** 125,130 ****
+--- 125,131 ----
+ struct UrlData *data = (struct UrlData *)param;
+
+ printf("%s\n", text);
++ return 0;
+ }
+
+ /***********************************************************************
+***************
+*** 145,155 ****
+--- 146,158 ----
+ void *server;
+ void *result;
+ void *entryIterator;
++ #if 0
+ char *dn;
+ char **attrArray;
+ char *attrIterator;
+ char *attrString;
+ void *dummy;
++ #endif
+ int ldaptext;
+
+ infof(data, "LDAP: %s %s\n", data->url);
+Only in curl-6.3.1/lib: ldap.c~
+Binary files curl-6.3.1-org/lib/ldap.o and curl-6.3.1/lib/ldap.o differ
+Binary files curl-6.3.1-org/lib/libcurl.a and curl-6.3.1/lib/libcurl.a differ
+diff -cr curl-6.3.1-org/lib/netrc.c curl-6.3.1/lib/netrc.c
+*** curl-6.3.1-org/lib/netrc.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/netrc.c Thu Dec 9 14:27:29 1999
+***************
+*** 54,60 ****
+ #include <stdlib.h>
+ #include <string.h>
+
+! #include <curl/setup.h>
+ #include "getenv.h"
+
+ /* Debug this single source file with:
+--- 54,60 ----
+ #include <stdlib.h>
+ #include <string.h>
+
+! #include "setup.h"
+ #include "getenv.h"
+
+ /* Debug this single source file with:
+Binary files curl-6.3.1-org/lib/netrc.o and curl-6.3.1/lib/netrc.o differ
+diff -cr curl-6.3.1-org/lib/progress.c curl-6.3.1/lib/progress.c
+*** curl-6.3.1-org/lib/progress.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/progress.c Thu Dec 9 14:27:29 1999
+***************
+*** 39,45 ****
+ ****************************************************************************/
+
+ #include <string.h>
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #if defined(__MINGW32__)
+--- 39,45 ----
+ ****************************************************************************/
+
+ #include <string.h>
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #if defined(__MINGW32__)
+***************
+*** 56,77 ****
+ /* --- start of progress routines --- */
+ int progressmax=-1;
+
+- static int progressmode=0;
+ static int prev = 0;
+ static int width = 0;
+
+- void ProgressMode(int mode)
+- {
+- progressmode=mode;
+- }
+-
+ void ProgressInit(struct UrlData *data, int max)
+ {
+! static char beenhere=0;
+!
+! if(beenhere || (data->conf&(CONF_NOPROGRESS|CONF_MUTE)))
+ return;
+! /*beenhere=1;*/
+ prev = 0;
+
+ /* TODO: get terminal width through ansi escapes or something similar.
+--- 56,69 ----
+ /* --- start of progress routines --- */
+ int progressmax=-1;
+
+ static int prev = 0;
+ static int width = 0;
+
+ void ProgressInit(struct UrlData *data, int max)
+ {
+! if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
+ return;
+!
+ prev = 0;
+
+ /* TODO: get terminal width through ansi escapes or something similar.
+***************
+*** 89,95 ****
+ return;
+ }
+
+! if ( progressmode == URG_PROGRESS_MODE_STATS )
+ fprintf(stderr, " %% Received Total Speed Time left Total Curr.Speed\n");
+ }
+
+--- 81,87 ----
+ return;
+ }
+
+! if ( data->progressmode == CURL_PROGRESS_STATS )
+ fprintf(stderr, " %% Received Total Speed Time left Total Curr.Speed\n");
+ }
+
+***************
+*** 104,111 ****
+ void ProgressShow(struct UrlData *data,
+ int point, struct timeval start, struct timeval now, bool force)
+ {
+! switch ( progressmode ) {
+! case URG_PROGRESS_MODE_STATS:
+ {
+ static long lastshow;
+ double percen;
+--- 96,103 ----
+ void ProgressShow(struct UrlData *data,
+ int point, struct timeval start, struct timeval now, bool force)
+ {
+! switch ( data->progressmode ) {
+! case CURL_PROGRESS_STATS:
+ {
+ static long lastshow;
+ double percen;
+***************
+*** 172,178 ****
+ lastshow = now.tv_sec;
+ break;
+ }
+! case URG_PROGRESS_MODE_BAR: /* 19990617 larsa */
+ {
+ if (point == prev) break;
+ if (progressmax == -1) {
+--- 164,170 ----
+ lastshow = now.tv_sec;
+ break;
+ }
+! case CURL_PROGRESS_BAR: /* 19990617 larsa */
+ {
+ if (point == prev) break;
+ if (progressmax == -1) {
+Only in curl-6.3.1/lib: progress.c~
+diff -cr curl-6.3.1-org/lib/progress.h curl-6.3.1/lib/progress.h
+*** curl-6.3.1-org/lib/progress.h Mon Sep 6 08:59:41 1999
+--- curl-6.3.1/lib/progress.h Thu Dec 9 14:27:50 1999
+***************
+*** 51,58 ****
+ /* Don't show progress for sizes smaller than: */
+ #define LEAST_SIZE_PROGRESS BUFSIZE
+
+- /* we want more progress info modes... */
+- #define URG_PROGRESS_MODE_STATS (0) /* default is the mode with value 0 */
+- #define URG_PROGRESS_MODE_BAR (1)
+-
+ #endif /* __PROGRESS_H */
+--- 51,54 ----
+Only in curl-6.3.1/lib: progress.h~
+Binary files curl-6.3.1-org/lib/progress.o and curl-6.3.1/lib/progress.o differ
+Only in curl-6.3.1/lib: replace.sh
+Only in curl-6.3.1/lib: replace.sh~
+diff -cr curl-6.3.1-org/lib/sendf.c curl-6.3.1/lib/sendf.c
+*** curl-6.3.1-org/lib/sendf.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/sendf.c Thu Dec 9 14:27:30 1999
+***************
+*** 42,48 ****
+ #include <stdarg.h>
+ #include <stdlib.h>
+
+! #include <curl/setup.h>
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+--- 42,48 ----
+ #include <stdarg.h>
+ #include <stdlib.h>
+
+! #include "setup.h"
+
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+Binary files curl-6.3.1-org/lib/sendf.o and curl-6.3.1/lib/sendf.o differ
+Only in curl-6.3.1/lib: setup.h
+Only in curl-6.3.1/lib: setup.h~
+diff -cr curl-6.3.1-org/lib/speedcheck.h curl-6.3.1/lib/speedcheck.h
+*** curl-6.3.1-org/lib/speedcheck.h Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/speedcheck.h Thu Dec 9 14:27:50 1999
+***************
+*** 40,46 ****
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+! #include <curl/setup.h>
+
+ #include "timeval.h"
+
+--- 40,46 ----
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+! #include "setup.h"
+
+ #include "timeval.h"
+
+Binary files curl-6.3.1-org/lib/speedcheck.o and curl-6.3.1/lib/speedcheck.o differ
+diff -cr curl-6.3.1-org/lib/ssluse.c curl-6.3.1/lib/ssluse.c
+*** curl-6.3.1-org/lib/ssluse.c Mon Sep 6 08:59:41 1999
+--- curl-6.3.1/lib/ssluse.c Thu Dec 9 14:27:30 1999
+***************
+*** 133,138 ****
+--- 133,152 ----
+
+ #endif
+
++ #if SSL_VERIFY_CERT
++ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
++ {
++ X509 *err_cert;
++ char buf[256];
++
++ err_cert=X509_STORE_CTX_get_current_cert(ctx);
++ X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
++
++ return 1;
++ }
++
++ #endif
++
+ /* ====================================================== */
+ int
+ UrgSSLConnect (struct UrlData *data)
+***************
+*** 176,182 ****
+ return 2;
+ }
+ }
+! /* Lets make a SSL structure */
+ data->ssl = SSL_new (data->ctx);
+ SSL_set_connect_state (data->ssl);
+
+--- 190,204 ----
+ return 2;
+ }
+ }
+!
+! #if SSL_VERIFY_CERT
+! SSL_CTX_set_verify(data->ctx,
+! SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
+! SSL_VERIFY_CLIENT_ONCE,
+! cert_verify_callback);
+! #endif
+!
+! /* Lets make an SSL structure */
+ data->ssl = SSL_new (data->ctx);
+ SSL_set_connect_state (data->ssl);
+
+***************
+*** 227,232 ****
+--- 249,261 ----
+ /* We could do all sorts of certificate verification stuff here before
+ deallocating the certificate. */
+
++
++ #if SSL_VERIFY_CERT
++ infof(data, "Verify result: %d\n", SSL_get_verify_result(data->ssl));
++ #endif
++
++
++
+ X509_free (data->server_cert);
+ #else /* USE_SSLEAY */
+ /* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
+Only in curl-6.3.1/lib: ssluse.c~
+Binary files curl-6.3.1-org/lib/ssluse.o and curl-6.3.1/lib/ssluse.o differ
+diff -cr curl-6.3.1-org/lib/telnet.c curl-6.3.1/lib/telnet.c
+*** curl-6.3.1-org/lib/telnet.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/telnet.c Thu Dec 9 14:27:31 1999
+***************
+*** 57,63 ****
+
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 57,63 ----
+
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+Binary files curl-6.3.1-org/lib/telnet.o and curl-6.3.1/lib/telnet.o differ
+diff -cr curl-6.3.1-org/lib/timeval.h curl-6.3.1/lib/timeval.h
+*** curl-6.3.1-org/lib/timeval.h Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/timeval.h Thu Dec 9 14:27:51 1999
+***************
+*** 46,52 ****
+ #include <sys/time.h>
+ #endif
+
+! #include <curl/setup.h>
+
+ #ifndef HAVE_GETTIMEOFDAY
+ #if !defined(_WINSOCKAPI_) && !defined(__MINGW32__)
+--- 46,52 ----
+ #include <sys/time.h>
+ #endif
+
+! #include "setup.h"
+
+ #ifndef HAVE_GETTIMEOFDAY
+ #if !defined(_WINSOCKAPI_) && !defined(__MINGW32__)
+Binary files curl-6.3.1-org/lib/timeval.o and curl-6.3.1/lib/timeval.o differ
+diff -cr curl-6.3.1-org/lib/upload.c curl-6.3.1/lib/upload.c
+*** curl-6.3.1-org/lib/upload.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/upload.c Thu Dec 9 14:27:32 1999
+***************
+*** 38,44 ****
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+! #include <curl/setup.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+--- 38,44 ----
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+! #include "setup.h"
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+Binary files curl-6.3.1-org/lib/upload.o and curl-6.3.1/lib/upload.o differ
+diff -cr curl-6.3.1-org/lib/url.c curl-6.3.1/lib/url.c
+*** curl-6.3.1-org/lib/url.c Fri Nov 19 08:07:10 1999
+--- curl-6.3.1/lib/url.c Thu Dec 9 14:27:32 1999
+***************
+*** 54,60 ****
+
+ #include <errno.h>
+
+! #include <curl/setup.h>
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+--- 54,60 ----
+
+ #include <errno.h>
+
+! #include "setup.h"
+
+ #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+ #include <winsock.h>
+***************
+*** 387,392 ****
+--- 387,395 ----
+ case URGTAG_POSTFIELDS:
+ data->postfields = (char *)param_obj;
+ break;
++ case URGTAG_PROGRESSMODE:
++ data->progressmode = (long)param_long;
++ break;
+ case URGTAG_REFERER:
+ data->referer = (char *)param_obj;
+ break;
+Only in curl-6.3.1/lib: url.c~
+Binary files curl-6.3.1-org/lib/url.o and curl-6.3.1/lib/url.o differ
+diff -cr curl-6.3.1-org/lib/urldata.h curl-6.3.1/lib/urldata.h
+*** curl-6.3.1-org/lib/urldata.h Sat Oct 30 17:44:42 1999
+--- curl-6.3.1/lib/urldata.h Thu Dec 9 14:27:52 1999
+***************
+*** 42,48 ****
+
+ /* This file is for lib internal stuff */
+
+! #include <curl/setup.h>
+
+ #ifndef MAXHOSTNAMELEN
+ #define MAXHOSTNAMELEN 256
+--- 42,48 ----
+
+ /* This file is for lib internal stuff */
+
+! #include "setup.h"
+
+ #ifndef MAXHOSTNAMELEN
+ #define MAXHOSTNAMELEN 256
+***************
+*** 184,189 ****
+--- 184,190 ----
+
+ char *headerbuff; /* allocated buffer to store headers in */
+ int headersize; /* size of the allocation */
++ int progressmode; /* what kind of progress meter to display */
+
+ #define MAX_CURL_USER_LENGTH 128
+ #define MAX_CURL_PASSWORD_LENGTH 128
+Only in curl-6.3.1/lib: urldata.h~
+diff -cr curl-6.3.1-org/lib/version.c curl-6.3.1/lib/version.c
+*** curl-6.3.1-org/lib/version.c Thu Oct 14 00:27:12 1999
+--- curl-6.3.1/lib/version.c Thu Dec 9 14:27:32 1999
+***************
+*** 41,47 ****
+ #include <string.h>
+ #include <stdio.h>
+
+! #include <curl/setup.h>
+ #include <curl/curl.h>
+ #include "urldata.h"
+
+--- 41,47 ----
+ #include <string.h>
+ #include <stdio.h>
+
+! #include "setup.h"
+ #include <curl/curl.h>
+ #include "urldata.h"
+
+Binary files curl-6.3.1-org/lib/version.o and curl-6.3.1/lib/version.o differ
+diff -cr curl-6.3.1-org/src/Makefile curl-6.3.1/src/Makefile
+*** curl-6.3.1-org/src/Makefile Wed Dec 8 13:39:41 1999
+--- curl-6.3.1/src/Makefile Thu Dec 9 14:47:51 1999
+***************
+*** 97,107 ****
+
+
+ DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I..
+! LDFLAGS =
+! LIBS = -ldl -lsocket -lnsl
+ curl_OBJECTS = main.o hugehelp.o urlglob.o
+ curl_LDFLAGS =
+! CFLAGS = -g -O2
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+--- 97,107 ----
+
+
+ DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I..
+! LDFLAGS = -L/homes/qradlsg/openssl-0.9.4
+! LIBS = -lssl -lcrypto -ldl -lsocket -lnsl
+ curl_OBJECTS = main.o hugehelp.o urlglob.o
+ curl_LDFLAGS =
+! CFLAGS = -g -O2 -Wall
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+diff -cr curl-6.3.1-org/src/Makefile.in curl-6.3.1/src/Makefile.in
+*** curl-6.3.1-org/src/Makefile.in Wed Dec 8 13:38:21 1999
+--- curl-6.3.1/src/Makefile.in Thu Dec 9 14:40:07 1999
+***************
+*** 101,107 ****
+ LIBS = @LIBS@
+ curl_OBJECTS = main.o hugehelp.o urlglob.o
+ curl_LDFLAGS =
+! CFLAGS = @CFLAGS@
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+--- 101,107 ----
+ LIBS = @LIBS@
+ curl_OBJECTS = main.o hugehelp.o urlglob.o
+ curl_LDFLAGS =
+! CFLAGS = @CFLAGS@ -Wall
+ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ CCLD = $(CC)
+ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+Only in curl-6.3.1/src: Makefile.in~
+Only in curl-6.3.1/src: config-win32.h
+Only in curl-6.3.1/src: config-win32.h~
+Only in curl-6.3.1/src: config.h
+Only in curl-6.3.1/src: config.h.in
+Only in curl-6.3.1/src: config.h.in~
+Only in curl-6.3.1/src: curl
+Only in curl-6.3.1/src: hugehelp.c
+Binary files curl-6.3.1-org/src/hugehelp.o and curl-6.3.1/src/hugehelp.o differ
+diff -cr curl-6.3.1-org/src/main.c curl-6.3.1/src/main.c
+*** curl-6.3.1-org/src/main.c Sat Oct 30 17:45:12 1999
+--- curl-6.3.1/src/main.c Thu Dec 9 14:50:12 1999
+***************
+*** 45,53 ****
+ #include <sys/stat.h>
+ #include <ctype.h>
+
+! #include "curl/setup.h"
+! #include "curl/curl.h"
+! #include "curl/mprintf.h"
+ #include "../lib/getdate.h"
+ #ifdef GLOBURL
+ #include "urlglob.h"
+--- 45,52 ----
+ #include <sys/stat.h>
+ #include <ctype.h>
+
+! #include <curl/curl.h>
+! #include <curl/mprintf.h>
+ #include "../lib/getdate.h"
+ #ifdef GLOBURL
+ #include "urlglob.h"
+***************
+*** 54,71 ****
+ #define CURLseparator "--_curl_--"
+ #define MIMEseparator "_curl_"
+ #endif
+ #include "version.h"
+
+! #ifdef WIN32
+ #include <io.h>
+! #else
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+- #endif
+
+ extern void hugehelp(void);
+- extern void ProgressMode(int);
+
+ static void helpf(char *fmt, ...)
+ {
+--- 53,73 ----
+ #define CURLseparator "--_curl_--"
+ #define MIMEseparator "_curl_"
+ #endif
++
++ /* This is now designed to have its own local setup.h */
++ #include "setup.h"
++
+ #include "version.h"
+
+! #ifdef HAVE_IO_H /* typical win32 habit */
+ #include <io.h>
+! #endif
+!
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+
+ extern void hugehelp(void);
+
+ static void helpf(char *fmt, ...)
+ {
+***************
+*** 173,178 ****
+--- 175,181 ----
+ bool crlf;
+ char *cookiefile;
+ char *httprequest;
++ bool progressmode;
+
+ FILE *errors; /* if stderr redirect is requested */
+
+***************
+*** 412,419 ****
+ else
+ config->errors = stdout;
+ break;
+! case '#': /* 19990617 larsa */
+! ProgressMode(1);
+ break;
+ case '2':
+ /* SSL version 2 */
+--- 415,422 ----
+ else
+ config->errors = stdout;
+ break;
+! case '#': /* added 19990617 larsa */
+! config->progressmode ^= CURL_PROGRESS_BAR;
+ break;
+ case '2':
+ /* SSL version 2 */
+***************
+*** 833,839 ****
+ int infilesize=-1; /* -1 means unknown */
+ bool stillflags=TRUE;
+
+! int res;
+ int i;
+ struct Configurable config;
+
+--- 836,842 ----
+ int infilesize=-1; /* -1 means unknown */
+ bool stillflags=TRUE;
+
+! int res=URG_OK;
+ int i;
+ struct Configurable config;
+
+***************
+*** 937,943 ****
+ printf("Content-Type: multipart/mixed; boundary=%s\n\n", MIMEseparator);
+ #endif
+ }
+! for (i = 0; url = next_url(urls); ++i) {
+ if (outfiles)
+ config.outfile = strdup(outfiles);
+ #endif
+--- 940,946 ----
+ printf("Content-Type: multipart/mixed; boundary=%s\n\n", MIMEseparator);
+ #endif
+ }
+! for (i = 0; (url = next_url(urls)); ++i) {
+ if (outfiles)
+ config.outfile = strdup(outfiles);
+ #endif
+***************
+*** 1105,1116 ****
+ URGTAG_CRLF, config.crlf,
+ URGTAG_QUOTE, config.quote,
+ URGTAG_WRITEHEADER, headerfilep,
+-
+ URGTAG_COOKIEFILE, config.cookiefile,
+ URGTAG_SSLVERSION, config.ssl_version,
+ URGTAG_TIMECONDITION, config.timecond,
+ URGTAG_TIMEVALUE, config.condtime,
+ URGTAG_HTTPREQUEST, config.httprequest,
+ URGTAG_DONE); /* always terminate the list of tags */
+ if(!config.errors)
+ config.errors = stderr;
+--- 1108,1119 ----
+ URGTAG_CRLF, config.crlf,
+ URGTAG_QUOTE, config.quote,
+ URGTAG_WRITEHEADER, headerfilep,
+ URGTAG_COOKIEFILE, config.cookiefile,
+ URGTAG_SSLVERSION, config.ssl_version,
+ URGTAG_TIMECONDITION, config.timecond,
+ URGTAG_TIMEVALUE, config.condtime,
+ URGTAG_HTTPREQUEST, config.httprequest,
++ URGTAG_PROGRESSMODE, config.progressmode,
+ URGTAG_DONE); /* always terminate the list of tags */
+ if(!config.errors)
+ config.errors = stderr;
+Only in curl-6.3.1/src: main.c~
+Binary files curl-6.3.1-org/src/main.o and curl-6.3.1/src/main.o differ
+Only in curl-6.3.1/src: setup.h
+Only in curl-6.3.1/src: setup.h~
+Only in curl-6.3.1/src: stamp-h2
+diff -cr curl-6.3.1-org/src/urlglob.c curl-6.3.1/src/urlglob.c
+*** curl-6.3.1-org/src/urlglob.c Thu Oct 14 00:28:43 1999
+--- curl-6.3.1/src/urlglob.c Wed Dec 8 16:55:55 1999
+***************
+*** 41,46 ****
+--- 41,47 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++ #include <ctype.h>
+ #include <curl/curl.h>
+ #include "urlglob.h"
+
+***************
+*** 117,123 ****
+ - num range with leading zeros: e.g. "001-999]"
+ expression is checked for well-formedness and collected until the next ']'
+ */
+- char* buf = glob_buffer;
+ URLPattern *pat;
+ char *c;
+
+--- 118,123 ----
+***************
+*** 125,131 ****
+ /* patterns 0,1,2,... correspond to size=1,3,5,... */
+ ++glob_expand->size;
+
+! if (isalpha(*pattern)) { /* character range detected */
+ pat->type = UPTCharRange;
+ if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c, &pat->content.CharRange.max_c) != 2 ||
+ pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
+--- 125,131 ----
+ /* patterns 0,1,2,... correspond to size=1,3,5,... */
+ ++glob_expand->size;
+
+! if (isalpha((int)*pattern)) { /* character range detected */
+ pat->type = UPTCharRange;
+ if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c, &pat->content.CharRange.max_c) != 2 ||
+ pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
+***************
+*** 139,145 ****
+ return (pat->content.CharRange.max_c - pat->content.CharRange.min_c + 1) *
+ glob_word(pattern + 4, pos + 4);
+ }
+! if (isdigit(*pattern)) { /* numeric range detected */
+ pat->type = UPTNumRange;
+ pat->content.NumRange.padlength = 0;
+ if (sscanf(pattern, "%d-%d]", &pat->content.NumRange.min_n, &pat->content.NumRange.max_n) != 2 ||
+--- 139,145 ----
+ return (pat->content.CharRange.max_c - pat->content.CharRange.min_c + 1) *
+ glob_word(pattern + 4, pos + 4);
+ }
+! if (isdigit((int)*pattern)) { /* numeric range detected */
+ pat->type = UPTNumRange;
+ pat->content.NumRange.padlength = 0;
+ if (sscanf(pattern, "%d-%d]", &pat->content.NumRange.min_n, &pat->content.NumRange.max_n) != 2 ||
+***************
+*** 150,156 ****
+ }
+ if (*pattern == '0') { /* leading zero specified */
+ c = pattern;
+! while (isdigit(*c++))
+ ++pat->content.NumRange.padlength; /* padding length is set for all instances
+ of this pattern */
+ }
+--- 150,156 ----
+ }
+ if (*pattern == '0') { /* leading zero specified */
+ c = pattern;
+! while (isdigit((int)*c++))
+ ++pat->content.NumRange.padlength; /* padding length is set for all instances
+ of this pattern */
+ }
+***************
+*** 296,302 ****
+
+ while (*filename != '\0') {
+ if (*filename == '#') {
+! if (!isdigit(*++filename) ||
+ *filename == '0') { /* only '#1' ... '#9' allowed */
+ printf("illegal matching expression\n");
+ exit(URG_URL_MALFORMAT);
+--- 296,302 ----
+
+ while (*filename != '\0') {
+ if (*filename == '#') {
+! if (!isdigit((int)*++filename) ||
+ *filename == '0') { /* only '#1' ... '#9' allowed */
+ printf("illegal matching expression\n");
+ exit(URG_URL_MALFORMAT);
+Only in curl-6.3.1/src: urlglob.c~
+Binary files curl-6.3.1-org/src/urlglob.o and curl-6.3.1/src/urlglob.o differ
diff --git a/curl_63_form.patch b/curl_63_form.patch
new file mode 100644
index 000000000..03738dbc0
--- /dev/null
+++ b/curl_63_form.patch
@@ -0,0 +1,92 @@
+*** /homes/qradlsg/curl-org/lib/formdata.c Thu Oct 14 00:27:12 1999
+--- formdata.c Mon Nov 22 16:55:20 1999
+***************
+*** 41,47 ****
+ /*
+ Debug the form generator stand-alone by compiling this source file with:
+
+! 'make formdata'
+
+ run the 'formdata' executable and make sure the output is ok!
+
+--- 41,47 ----
+ /*
+ Debug the form generator stand-alone by compiling this source file with:
+
+! gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -o formdata -I../include formdata.c
+
+ run the 'formdata' executable and make sure the output is ok!
+
+***************
+*** 313,320 ****
+ if(!length)
+ length = strlen((char *)line);
+
+! newform->line = (char *)malloc(length);
+! memcpy(newform->line, line, length);
+ newform->length = length;
+
+ if(*formp) {
+--- 313,320 ----
+ if(!length)
+ length = strlen((char *)line);
+
+! newform->line = (char *)malloc(length+1);
+! memcpy(newform->line, line, length+1);
+ newform->length = length;
+
+ if(*formp) {
+***************
+*** 499,504 ****
+--- 499,505 ----
+ size += AddFormDataf(&form,
+ "\r\n--%s--",
+ fileboundary);
++ free(fileboundary);
+ }
+
+ } while((post=post->next)); /* for each field */
+***************
+*** 511,518 ****
+ *sizep = size;
+
+ free(boundary);
+- if(fileboundary)
+- free(fileboundary);
+
+ return firstform;
+ }
+--- 512,517 ----
+***************
+*** 572,577 ****
+--- 571,583 ----
+
+ form->data = form->data->next; /* advance */
+
++ if(!gotsize && form->data) {
++ /* If we got an empty line and we have more data, we proceed to the next
++ line immediately to avoid returning zero before we've reached the end.
++ This is the bug reported November 22 1999 on curl 6.3. (Daniel) */
++ gotsize = FormReader(buffer, size, nitems, mydata);
++ }
++
+ return gotsize;
+ }
+
+***************
+*** 615,621 ****
+ FormInit(&formread, form);
+
+ while(nread = FormReader(buffer, 1, sizeof(buffer), (FILE *)&formread)) {
+! fwrite(buffer, nread, 1, stdout);
+ }
+
+ fprintf(stderr, "size: %d\n", size);
+--- 621,627 ----
+ FormInit(&formread, form);
+
+ while(nread = FormReader(buffer, 1, sizeof(buffer), (FILE *)&formread)) {
+! fwrite(buffer, nread, 1, stderr);
+ }
+
+ fprintf(stderr, "size: %d\n", size);
diff --git a/curl_63_partialdl.patch b/curl_63_partialdl.patch
new file mode 100644
index 000000000..9df65e232
--- /dev/null
+++ b/curl_63_partialdl.patch
@@ -0,0 +1,106 @@
+*** /homes/qradlsg/curl-org/lib/download.c Thu Nov 11 08:57:12 1999
+--- lib/download.c Mon Nov 22 08:33:13 1999
+***************
+*** 455,461 ****
+ #endif
+ }
+ }
+!
+ ProgressShow (data, bytecount, start, now, TRUE);
+
+ *bytecountp = bytecount;
+--- 455,464 ----
+ #endif
+ }
+ }
+! if(contentlength && (bytecount != contentlength)) {
+! failf(data, "transfer closed with %d bytes remaining", contentlength-bytecount);
+! return URG_PARTIAL_FILE;
+! }
+ ProgressShow (data, bytecount, start, now, TRUE);
+
+ *bytecountp = bytecount;
+*** /homes/qradlsg/curl-org/include/curl/curl.h Thu Nov 11 21:58:02 1999
+--- include/curl/curl.h Mon Nov 22 08:33:59 1999
+***************
+*** 159,165 ****
+ URG_FTP_CANT_GET_HOST,
+ URG_FTP_CANT_RECONNECT,
+ URG_FTP_COULDNT_SET_BINARY,
+! URG_FTP_PARTIAL_FILE,
+ URG_FTP_COULDNT_RETR_FILE,
+ URG_FTP_WRITE_ERROR,
+ URG_FTP_QUOTE_ERROR,
+--- 159,165 ----
+ URG_FTP_CANT_GET_HOST,
+ URG_FTP_CANT_RECONNECT,
+ URG_FTP_COULDNT_SET_BINARY,
+! URG_PARTIAL_FILE,
+ URG_FTP_COULDNT_RETR_FILE,
+ URG_FTP_WRITE_ERROR,
+ URG_FTP_QUOTE_ERROR,
+***************
+*** 197,202 ****
+--- 197,205 ----
+ URL_LAST
+ } UrgError;
+
++ /* This is just to make older programs not break: */
++ #define URG_FTP_PARTIAL_FILE URG_PARTIAL_FILE
++
+ #define URGTAG_DONE -1
+ #define URGTAG_LAST -1
+ #define URGTAG_END -1
+*** /homes/qradlsg/curl-org/lib/ftp.c Sat Oct 30 17:43:25 1999
+--- lib/ftp.c Mon Nov 22 08:34:27 1999
+***************
+*** 707,713 ****
+ if((-1 != data->infilesize) && (data->infilesize != *bytecountp)) {
+ failf(data, "Wrote only partial file (%d out of %d bytes)",
+ *bytecountp, data->infilesize);
+! return URG_FTP_PARTIAL_FILE;
+ }
+ }
+ else {
+--- 707,713 ----
+ if((-1 != data->infilesize) && (data->infilesize != *bytecountp)) {
+ failf(data, "Wrote only partial file (%d out of %d bytes)",
+ *bytecountp, data->infilesize);
+! return URG_PARTIAL_FILE;
+ }
+ }
+ else {
+***************
+*** 908,914 ****
+ if(size <= 0) {
+ failf(data, "Offset (%d) was beyond file size (%d)",
+ data->resume_from, data->resume_from+size);
+! return URG_FTP_PARTIAL_FILE;
+ }
+ }
+ #endif
+--- 908,914 ----
+ if(size <= 0) {
+ failf(data, "Offset (%d) was beyond file size (%d)",
+ data->resume_from, data->resume_from+size);
+! return URG_PARTIAL_FILE;
+ }
+ }
+ #endif
+***************
+*** 929,935 ****
+
+ if((-1 != size) && (size != *bytecountp)) {
+ failf(data, "Received only partial file");
+! return URG_FTP_PARTIAL_FILE;
+ }
+ else if(0 == *bytecountp) {
+ failf(data, "No data was received!");
+--- 929,935 ----
+
+ if((-1 != size) && (size != *bytecountp)) {
+ failf(data, "Received only partial file");
+! return URG_PARTIAL_FILE;
+ }
+ else if(0 == *bytecountp) {
+ failf(data, "No data was received!");
diff --git a/head b/head
new file mode 100644
index 000000000..827f81719
--- /dev/null
+++ b/head
@@ -0,0 +1,7 @@
+HTTP/1.1 200 OK
+Server: Microsoft-IIS/4.0
+Date: Thu, 02 Dec 1999 23:15:03 GMT
+Content-Type: text/html
+Set-Cookie: ASPSESSIONIDGQQQGGPD=HEDEOJCAIDADIKKLCFIFEJAJ; path=/
+Cache-control: private
+
diff --git a/include/README b/include/README
new file mode 100644
index 000000000..fc9ea9137
--- /dev/null
+++ b/include/README
@@ -0,0 +1,15 @@
+ _ _ ____ _
+ ___| | | | _ \| |
+ / __| | | | |_) | |
+ | (__| |_| | _ <| |___
+ \___|\___/|_| \_\_____|
+
+Include files for libcurl, external users.
+
+They're all placed in the curl subdirectory here for better fit in any kind
+of environment. You should include files from here using...
+
+ #include <curl/curl.h>
+
+... style and point the compiler's include path to the directory holding the
+curl subdirectory. It makes it more likely to survice future modifications.
diff --git a/include/curl/curl.beos-patch b/include/curl/curl.beos-patch
new file mode 100644
index 000000000..67bab368e
--- /dev/null
+++ b/include/curl/curl.beos-patch
@@ -0,0 +1,46 @@
+Index: include/curl/curl.h
+===================================================================
+RCS file: /cvs/curl/curl/include/curl/curl.h,v
+retrieving revision 1.5
+diff -u -r1.5 curl.h
+--- curl.h 1999/11/23 08:22:42 1.5
++++ curl.h 1999/11/24 16:19:11
+@@ -365,9 +365,13 @@
+ TIMECOND_LAST
+ } TimeCond;
+
++#ifdef __BEOS__
++#include <support/SupportDefs.h>
++#else
+ #ifndef __cplusplus /* (rabe) */
+ typedef char bool;
+ #endif /* (rabe) */
++#endif
+
+ /**********************************************************************
+ *
+Index: include/curl/setup.h
+===================================================================
+RCS file: /cvs/curl/curl/include/curl/setup.h,v
+retrieving revision 1.2
+diff -u -r1.2 setup.h
+--- setup.h 1999/10/17 11:18:34 1.2
++++ setup.h 1999/11/24 16:19:11
+@@ -139,10 +139,17 @@
+ #define DOT_CHAR "_"
+
+ #else
++#ifdef __BEOS__
++#define sclose(x) closesocket(x)
++#define sread(x,y,z) recv(x,y,z,0)
++#define swrite(x,y,z) send(x,y,z,0)
++#define myalarm(x) alarm(x)
++#else
+ #define sclose(x) close(x)
+ #define sread(x,y,z) read(x,y,z)
+ #define swrite(x,y,z) write(x,y,z)
+ #define myalarm(x) alarm(x)
++#endif
+
+ #define PATH_CHAR ":"
+ #define DIR_CHAR "/"
diff --git a/include/curl/curl.h b/include/curl/curl.h
new file mode 100644
index 000000000..a74625dbd
--- /dev/null
+++ b/include/curl/curl.h
@@ -0,0 +1,434 @@
+#ifndef __URL_H
+#define __URL_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+
+#define CONF_DEFAULT 0
+#define CONF_PROXY (1<<0) /* set if proxy is in use */
+#define CONF_PORT (1<<1) /* set if different port than protcol-defines is
+ used */
+#define CONF_HTTP (1<<2) /* http get */
+#define CONF_GOPHER (1<<3) /* gopher get */
+#define CONF_FTP (1<<4) /* ftp get (binary mode) */
+#define CONF_VERBOSE (1<<5) /* talk a lot */
+
+#define CONF_TELNET (1<<6)
+
+#define CONF_HEADER (1<<8) /* throw the header out too */
+#define CONF_USERPWD (1<<9) /* user+passwd has been specified */
+#define CONF_NOPROGRESS (1<<10) /* shut off the progress meter (auto)
+ see also _MUTE */
+#define CONF_NOBODY (1<<11) /* use HEAD to get http document */
+#define CONF_FAILONERROR (1<<12) /* Makes urlget() fail with a return code
+ WITHOUT writing anything to the output if
+ a return code >=300 is returned from the
+ server. */
+#define CONF_RANGE (1<<13) /* Byte-range request, specified parameter is set */
+#define CONF_UPLOAD (1<<14) /* this is an upload, only supported for ftp
+ currently */
+
+#define CONF_POST (1<<15) /* HTTP POST method */
+
+/* When getting an FTP directory, this switch makes the listing only show file
+ names and nothing else. Makes machine parsing of the output possible. This
+ enforces the NLST command to the ftp server, compared to the otherwise
+ used: LIST. */
+#define CONF_FTPLISTONLY (1<<16)
+
+/* Set the referer string */
+#define CONF_REFERER (1<<17)
+#define CONF_PROXYUSERPWD (1<<18) /* Proxy user+passwd has been specified */
+
+/* For FTP, use PORT instead of PASV! */
+#define CONF_FTPPORT (1<<19)
+
+/* FTP: Append instead of overwrite on upload! */
+#define CONF_FTPAPPEND (1<<20)
+
+#define CONF_HTTPS (1<<21) /* Use SSLeay for encrypted communication */
+
+#define CONF_NETRC (1<<22) /* read user+password from .netrc */
+
+#define CONF_FOLLOWLOCATION (1<<23) /* get the page that the Location: tells
+ us to get */
+
+#define CONF_FTPASCII (1<<24) /* use TYPE A for transfer */
+
+#define CONF_HTTPPOST (1<<25) /* this causes a multipart/form-data
+ HTTP POST */
+#define CONF_NOPROT (1<<26) /* host name specified without protocol */
+
+#define CONF_PUT (1<<27) /* PUT the input file */
+
+#define CONF_MUTE (1<<28) /* force NOPROGRESS */
+
+#define CONF_DICT (1<<29) /* DICT:// protocol */
+
+#define CONF_FILE (1<<30) /* FILE:// protocol */
+
+#define CONF_LDAP (1<<31) /* LDAP:// protocol */
+
+#ifdef MULTIDOC
+struct MoreDoc {
+ struct MoreDoc *next; /* next entry in the list */
+ char *path; /* pointer to allocated path */
+ FILE *store; /* where to put the doc */
+};
+#endif
+
+struct HttpHeader {
+ struct HttpHeader *next; /* next entry in the list */
+ char *header; /* pointer to allocated line without newline */
+};
+
+struct HttpPost {
+ struct HttpPost *next; /* next entry in the list */
+ char *name; /* pointer to allocated name */
+ char *contents; /* pointer to allocated data contents */
+ char *contenttype; /* Content-Type */
+ struct HttpPost *more; /* if one field name has more than one file, this
+ link should link to following files */
+ long flags; /* as defined below */
+#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
+};
+
+
+/* All possible error codes from this version of urlget(). Future versions
+ may return other values, stay prepared. */
+
+typedef enum {
+ URG_OK = 0,
+ URG_UNSUPPORTED_PROTOCOL,
+ URG_FAILED_INIT,
+ URG_URL_MALFORMAT,
+ URG_URL_MALFORMAT_USER,
+ URG_COULDNT_RESOLVE_PROXY,
+ URG_COULDNT_RESOLVE_HOST,
+ URG_COULDNT_CONNECT,
+ URG_FTP_WEIRD_SERVER_REPLY,
+ URG_FTP_ACCESS_DENIED,
+ URG_FTP_USER_PASSWORD_INCORRECT,
+ URG_FTP_WEIRD_PASS_REPLY,
+ URG_FTP_WEIRD_USER_REPLY,
+ URG_FTP_WEIRD_PASV_REPLY,
+ URG_FTP_WEIRD_227_FORMAT,
+ URG_FTP_CANT_GET_HOST,
+ URG_FTP_CANT_RECONNECT,
+ URG_FTP_COULDNT_SET_BINARY,
+ URG_PARTIAL_FILE,
+ URG_FTP_COULDNT_RETR_FILE,
+ URG_FTP_WRITE_ERROR,
+ URG_FTP_QUOTE_ERROR,
+ URG_HTTP_NOT_FOUND,
+ URG_WRITE_ERROR,
+
+ URG_MALFORMAT_USER, /* the user name is illegally specified */
+ URG_FTP_COULDNT_STOR_FILE, /* failed FTP upload */
+ URG_READ_ERROR, /* could open/read from file */
+
+ URG_OUT_OF_MEMORY,
+ URG_OPERATION_TIMEOUTED, /* the timeout time was reached */
+ URG_FTP_COULDNT_SET_ASCII, /* TYPE A failed */
+
+ URG_FTP_PORT_FAILED, /* FTP PORT operation failed */
+
+ URG_FTP_COULDNT_USE_REST, /* the REST command failed */
+ URG_FTP_COULDNT_GET_SIZE, /* the SIZE command failed */
+
+ URG_HTTP_RANGE_ERROR, /* The RANGE "command" didn't seem to work */
+
+ URG_HTTP_POST_ERROR,
+
+ URG_SSL_CONNECT_ERROR, /* something was wrong when connecting with SSL */
+
+ URG_FTP_BAD_DOWNLOAD_RESUME, /* couldn't resume download */
+
+ URG_FILE_COULDNT_READ_FILE,
+
+ URG_LDAP_CANNOT_BIND,
+ URG_LDAP_SEARCH_FAILED,
+ URG_LIBRARY_NOT_FOUND,
+ URG_FUNCTION_NOT_FOUND,
+
+ URL_LAST
+} UrgError;
+
+/* This is just to make older programs not break: */
+#define URG_FTP_PARTIAL_FILE URG_PARTIAL_FILE
+
+#define URGTAG_DONE -1
+#define URGTAG_LAST -1
+#define URGTAG_END -1
+
+#define URLGET_ERROR_SIZE 256
+
+/* maximum URL length we deal with */
+#define URL_MAX_LENGTH 4096
+#define URL_MAX_LENGTH_TXT "4095"
+
+/* name is uppercase URGTAG_<name>,
+ type is one of the defined URGTYPE_<type>
+ number is unique identifier */
+#define T(name,type,number) URGTAG_ ## name = URGTYPE_ ## type + number
+
+/* long may be 32 or 64 bits, but we should never depend on anything else
+ but 32 */
+#define URGTYPE_LONG 0
+#define URGTYPE_OBJECTPOINT 10000
+#define URGTYPE_FUNCTIONPOINT 20000
+
+typedef enum {
+ URGTAG_NOTHING, /* the first unused */
+
+ /* This is the FILE * the regular output should be written to. */
+ T(FILE, OBJECTPOINT, 1),
+
+ /* The full URL to get/put */
+ T(URL, OBJECTPOINT, 2),
+
+ /* Port number to connect to, if other than default. Specify the CONF_PORT
+ flag in the URGTAG_FLAGS to activate this */
+ T(PORT, LONG, 3),
+
+ /* Name of proxy to use. Specify the CONF_PROXY flag in the URGTAG_FLAGS to
+ activate this */
+ T(PROXY, OBJECTPOINT, 4),
+
+ /* Name and password to use when fetching. Specify the CONF_USERPWD flag in
+ the URGTAG_FLAGS to activate this */
+ T(USERPWD, OBJECTPOINT, 5),
+
+ /* Name and password to use with Proxy. Specify the CONF_PROXYUSERPWD
+ flag in the URGTAG_FLAGS to activate this */
+ T(PROXYUSERPWD, OBJECTPOINT, 6),
+
+ /* Range to get, specified as an ASCII string. Specify the CONF_RANGE flag
+ in the URGTAG_FLAGS to activate this */
+ T(RANGE, OBJECTPOINT, 7),
+
+ /* Configuration flags */
+ T(FLAGS, LONG, 8),
+
+ /* Specified file stream to upload from (use as input): */
+ T(INFILE, OBJECTPOINT, 9),
+
+ /* Buffer to receive error messages in, must be at least URLGET_ERROR_SIZE
+ bytes big. If this is not used, error messages go to stderr instead: */
+ T(ERRORBUFFER, OBJECTPOINT, 10),
+
+ /* Function that will be called to store the output (instead of fwrite). The
+ parameters will use fwrite() syntax, make sure to follow them. */
+ T(WRITEFUNCTION, FUNCTIONPOINT, 11),
+
+ /* Function that will be called to read the input (instead of fread). The
+ parameters will use fread() syntax, make sure to follow them. */
+ T(READFUNCTION, FUNCTIONPOINT, 12),
+
+ /* Time-out the read operation after this amount of seconds */
+ T(TIMEOUT, LONG, 13),
+
+ /* If the URGTAG_INFILE is used, this can be used to inform urlget about how
+ large the file being sent really is. That allows better error checking
+ and better verifies that the upload was succcessful. -1 means unknown
+ size. */
+ T(INFILESIZE, LONG, 14),
+
+ /* POST input fields. */
+ T(POSTFIELDS, OBJECTPOINT, 15),
+
+ /* Set the referer page (needed by some CGIs) */
+ T(REFERER, OBJECTPOINT, 16),
+
+ /* Set the FTP PORT string (interface name, named or numerical IP address)
+ Use i.e '-' to use default address. */
+ T(FTPPORT, OBJECTPOINT, 17),
+
+ /* Set the User-Agent string (examined by some CGIs) */
+ T(USERAGENT, OBJECTPOINT, 18),
+
+ /* If the download receives less than "low speed limit" bytes/second
+ * during "low speed time" seconds, the operations is aborted.
+ * You could i.e if you have a pretty high speed connection, abort if
+ * it is less than 2000 bytes/sec during 20 seconds.
+ */
+
+ /* Set the "low speed limit" */
+ T(LOW_SPEED_LIMIT, LONG , 19),
+
+ /* Set the "low speed time" */
+ T(LOW_SPEED_TIME, LONG, 20),
+
+ /* Set the continuation offset */
+ T(RESUME_FROM, LONG, 21),
+
+ /* Set cookie in request: */
+ T(COOKIE, OBJECTPOINT, 22),
+
+ /* This points to a linked list of headers, struct HttpHeader kind */
+ T(HTTPHEADER, OBJECTPOINT, 23),
+
+ /* This points to a linked list of post entries, struct HttpPost */
+ T(HTTPPOST, OBJECTPOINT, 24),
+
+ /* name of the file keeping your private SSL-certificate */
+ T(SSLCERT, OBJECTPOINT, 25),
+
+ /* password for the SSL-certificate */
+ T(SSLCERTPASSWD, OBJECTPOINT, 26),
+
+ /* send TYPE parameter? */
+ T(CRLF, LONG, 27),
+
+ /* send linked-list of QUOTE commands */
+ T(QUOTE, OBJECTPOINT, 28),
+
+ /* send FILE * to store headers to */
+ T(WRITEHEADER, OBJECTPOINT, 29),
+
+#ifdef MULTIDOC
+ /* send linked list of MoreDoc structs */
+ T(MOREDOCS, OBJECTPOINT, 30),
+#endif
+
+ /* point to a file to read the initial cookies from, also enables
+ "cookie awareness" */
+ T(COOKIEFILE, OBJECTPOINT, 31),
+
+ /* What version to specifly try to use.
+ 3 = SSLv3, 2 = SSLv2, all else makes it try v3 first then v2 */
+ T(SSLVERSION, LONG, 32),
+
+ /* What kind of HTTP time condition to use, see defines */
+ T(TIMECONDITION, LONG, 33),
+
+ /* Time to use with the above condition. Specified in number of seconds
+ since 1 Jan 1970 */
+ T(TIMEVALUE, LONG, 34),
+
+ /* HTTP request, for odd commands like DELETE, TRACE and others */
+ /* OBSOLETE DEFINE, left for tradition only */
+ T(HTTPREQUEST, OBJECTPOINT, 35),
+
+ /* Custom request, for customizing the get command like
+ HTTP: DELETE, TRACE and others
+ FTP: to use a different list command
+ */
+ T(CUSTOMREQUEST, OBJECTPOINT, 35),
+
+ /* HTTP request, for odd commands like DELETE, TRACE and others */
+ T(STDERR, OBJECTPOINT, 36),
+
+ /* Progress mode sets alternative progress mode displays, the only
+ one defined today is 1 which makes the #-style progress bar. */
+ T(PROGRESSMODE, LONG, 37),
+
+ URGTAG_LASTENTRY /* the last unusued */
+} UrgTag;
+
+#define CURL_PROGRESS_STATS 0 /* default progress display */
+#define CURL_PROGRESS_BAR 1
+
+typedef enum {
+ TIMECOND_NONE,
+
+ TIMECOND_IFMODSINCE,
+ TIMECOND_IFUNMODSINCE,
+ TIMECOND_LASTMOD,
+
+ TIMECOND_LAST
+} TimeCond;
+
+#ifdef __BEOS__
+#include <support/SupportDefs.h>
+#else
+#ifndef __cplusplus /* (rabe) */
+typedef char bool;
+#endif /* (rabe) */
+#endif
+
+/**********************************************************************
+ *
+ * >>> urlget() interface #defines changed in v5! <<<
+ *
+ * You enter parameters as tags. Tags are specified as a pair of parameters.
+ * The first parameter in a pair is the tag identifier, telling urlget what
+ * kind of tag it is, and the second is the data. The tags may come in any
+ * order but MUST ALWAYS BE TERMINATED with an ending URGTAG_DONE (which
+ * needs no data).
+ *
+ * _Very_ simple example:
+ *
+ * curl_urlget(URGTAG_URL, "http://www.fts.frontec.se/~dast/", URGTAG_DONE);
+ *
+ ***********************************************************************/
+
+UrgError curl_urlget(UrgTag, ...);
+
+/* external form function */
+int curl_FormParse(char *string,
+ struct HttpPost **httppost,
+ struct HttpPost **last_post);
+
+/* Unix and Win32 getenv function call */
+char *curl_GetEnv(char *variable);
+
+/* returns ascii string of the libcurl version */
+char *curl_version(void);
+
+/* This is the version number */
+#define LIBCURL_VERSION "6.3.1"
+
+/* linked-list structure for QUOTE */
+struct curl_slist {
+ char *data;
+ struct curl_slist *next;
+};
+
+struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
+void curl_slist_free_all(struct curl_slist *list);
+
+#endif /* __URLGET_H */
diff --git a/include/curl/getdate.h b/include/curl/getdate.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/include/curl/getdate.h
diff --git a/include/curl/mprintf.h b/include/curl/mprintf.h
new file mode 100644
index 000000000..65c64f439
--- /dev/null
+++ b/include/curl/mprintf.h
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $Id$
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Triacle.
+ *
+ * The Initial Developers of the Original Code are Bjorn Reese and
+ * Daniel Stenberg.
+ *
+ * Portions created by Initial Developers are
+ *
+ * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ *************************************************************************
+ *
+ * Preliminary documentation
+ *
+ * printf conversions:
+ *
+ * conversion ::= '%%' | '%' [position] ( number | float | string )
+ * position ::= digits '$'
+ * number ::= [number-flags] ( 'd' | 'i' | 'o' | 'x' | 'X' | 'u')
+ * number-flags ::= 'h' | 'l' | 'L' ...
+ * float ::= [float-flags] ( 'f' | 'e' | 'E' | 'g' | 'G' )
+ * string ::= [string-flags] 's'
+ * string-flags ::= padding | '#'
+ * digits ::= (digit)+
+ * digit ::= 0-9
+ *
+ * c
+ * p
+ * n
+ *
+ * qualifiers
+ *
+ * - : left adjustment
+ * + : show sign
+ * SPACE : padding
+ * # : alterative
+ * . : precision
+ * * : width
+ * 0 : padding / size
+ * 1-9 : size
+ * h : short
+ * l : long
+ * ll : longlong
+ * L : long double
+ * Z : long / longlong
+ * q : longlong
+ *
+ ************************************************************************/
+
+#ifndef H_MPRINTF
+#define H_MPRINTF
+
+#include <stdarg.h>
+
+int mprintf(const char *format, ...);
+int mfprintf(FILE *fd, const char *format, ...);
+int msprintf(char *buffer, const char *format, ...);
+int msnprintf(char *buffer, size_t maxlength, const char *format, ...);
+int mvprintf(const char *format, va_list args);
+int mvfprintf(FILE *fd, const char *format, va_list args);
+int mvsprintf(char *buffer, const char *format, va_list args);
+int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
+char *maprintf(const char *format, ...);
+char *mvaprintf(const char *format, va_list args);
+
+#ifdef _MPRINTF_REPLACE
+# define printf mprintf
+# define fprintf mfprintf
+# define sprintf msprintf
+# define snprintf msnprintf
+# define vprintf mvprintf
+# define vfprintf mvfprintf
+# define vsprintf mvsprintf
+# define vsnprintf mvsnprintf
+#endif
+
+#endif /* H_MPRINTF */
diff --git a/include/curl/stdcheaders.h b/include/curl/stdcheaders.h
new file mode 100644
index 000000000..3027b86e9
--- /dev/null
+++ b/include/curl/stdcheaders.h
@@ -0,0 +1,53 @@
+#ifndef __STDC_HEADERS_H
+#define __STDC_HEADERS_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+size_t fread (void *, size_t, size_t, FILE *);
+size_t fwrite (const void *, size_t, size_t, FILE *);
+
+int strcasecmp(const char *, const char *);
+int strncasecmp(const char *, const char *, size_t);
+
+#endif
diff --git a/install-sh b/install-sh
new file mode 100755
index 000000000..e8436696c
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,250 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 000000000..303df5359
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,282 @@
+# Generated automatically from Makefile.in by configure.
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = ..
+prefix = /usr/local
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+mandir = ${prefix}/man
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/curl
+pkglibdir = $(libdir)/curl
+pkgincludedir = $(includedir)/curl
+
+top_builddir = ..
+
+ACLOCAL = aclocal
+AUTOCONF = autoconf
+AUTOMAKE = automake
+AUTOHEADER = autoheader
+
+INSTALL = .././install-sh -c
+INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+transform = s,x,x,
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = sparc-sun-solaris2.6
+host_triplet = sparc-sun-solaris2.6
+CC = gcc
+MAKEINFO = makeinfo
+NROFF = /bin/nroff
+PACKAGE = curl
+PERL = /usr/local/bin/perl
+RANLIB = ranlib
+VERSION = 6.3.1
+YACC = bison -y
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+noinst_LIBRARIES = libcurl.a
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+
+INCLUDES = -I$(top_srcdir)/include
+
+libcurl_a_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h progress.h upload.c cookie.c formdata.h http.c sendf.c upload.h cookie.h ftp.c http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h dict.h getdate.c if2ip.h speedcheck.h urldata.h download.c getdate.h ldap.c ssluse.c version.c download.h getenv.c ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c telnet.h
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h ../src/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+
+DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I.. -I../src
+CPPFLAGS = -I/home/dast/include/openssl -I/home/dast/include
+LDFLAGS =
+LIBS = -lssl -lcrypto -ldl -lsocket -lnsl -L/home/dast/lib
+libcurl_a_LIBADD =
+libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
+formdata.o upload.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
+speedcheck.o getdate.o download.o ldap.o ssluse.o version.o getenv.o \
+escape.o mprintf.o telnet.o getpass.o netrc.o
+AR = ar
+CFLAGS = -g -O2
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(libcurl_a_SOURCES)
+OBJECTS = $(libcurl_a_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
+ -rm -f libcurl.a
+ $(AR) cru libcurl.a $(libcurl_a_OBJECTS) $(libcurl_a_LIBADD)
+ $(RANLIB) libcurl.a
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = lib
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
+ mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
+ mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-noinstLIBRARIES distclean-compile \
+ distclean-tags distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
+$(srcdir)/getdate.c: getdate.y
+ cd $(srcdir) && \
+ $(YACC) $(YFLAGS) getdate.y; \
+ mv -f y.tab.c getdate.c
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 000000000..ca83f8627
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,31 @@
+#
+# $Id$
+#
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+noinst_LIBRARIES = libcurl.a
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+
+INCLUDES = -I$(top_srcdir)/include
+
+libcurl_a_SOURCES = \
+arpa_telnet.h file.c getpass.h netrc.h timeval.c \
+base64.c file.h hostip.c progress.c timeval.h \
+base64.h formdata.c hostip.h progress.h upload.c \
+cookie.c formdata.h http.c sendf.c upload.h \
+cookie.h ftp.c http.h sendf.h url.c \
+dict.c ftp.h if2ip.c speedcheck.c url.h \
+dict.h getdate.c if2ip.h speedcheck.h urldata.h \
+download.c getdate.h ldap.c ssluse.c version.c \
+download.h getenv.c ldap.h ssluse.h \
+escape.c getenv.h mprintf.c telnet.c \
+escape.h getpass.c netrc.c telnet.h
+
+# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
+$(srcdir)/getdate.c: getdate.y
+ cd $(srcdir) && \
+ $(YACC) $(YFLAGS) getdate.y; \
+ mv -f y.tab.c getdate.c
diff --git a/lib/Makefile.in b/lib/Makefile.in
new file mode 100644
index 000000000..eb39e2a2b
--- /dev/null
+++ b/lib/Makefile.in
@@ -0,0 +1,282 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+MAKEINFO = @MAKEINFO@
+NROFF = @NROFF@
+PACKAGE = @PACKAGE@
+PERL = @PERL@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+noinst_LIBRARIES = libcurl.a
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+
+INCLUDES = -I$(top_srcdir)/include
+
+libcurl_a_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h progress.h upload.c cookie.c formdata.h http.c sendf.c upload.h cookie.h ftp.c http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h dict.h getdate.c if2ip.h speedcheck.h urldata.h download.c getdate.h ldap.c ssluse.c version.c download.h getenv.c ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c telnet.h
+
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h ../src/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I../src
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libcurl_a_LIBADD =
+libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
+formdata.o upload.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
+speedcheck.o getdate.o download.o ldap.o ssluse.o version.o getenv.o \
+escape.o mprintf.o telnet.o getpass.o netrc.o
+AR = ar
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(libcurl_a_SOURCES)
+OBJECTS = $(libcurl_a_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
+ -rm -f libcurl.a
+ $(AR) cru libcurl.a $(libcurl_a_OBJECTS) $(libcurl_a_LIBADD)
+ $(RANLIB) libcurl.a
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = lib
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(LIBRARIES)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
+ mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
+ mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-noinstLIBRARIES distclean-compile \
+ distclean-tags distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
+$(srcdir)/getdate.c: getdate.y
+ cd $(srcdir) && \
+ $(YACC) $(YFLAGS) getdate.y; \
+ mv -f y.tab.c getdate.c
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lib/Makefile.m32 b/lib/Makefile.m32
new file mode 100644
index 000000000..00aa77650
--- /dev/null
+++ b/lib/Makefile.m32
@@ -0,0 +1,67 @@
+#############################################################
+## Makefile for building libcurl.a with MingW32 (GCC-2.95) and
+## optionally OpenSSL (0.9.4)
+## Use: make -f Makefile.m32
+##
+## Comments to: Troy Engel <tengel@sonic.net> or
+## Joern Hartroth <hartroth@acm.org>
+
+CC = gcc
+AR = ar
+RANLIB = ranlib
+OPENSSL_PATH = ../../openssl-0.9.4
+
+########################################################
+## Nothing more to do below this line!
+
+INCLUDES = -I. -I.. -I../include
+CFLAGS = -g -O2
+ifdef SSL
+ INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
+ CFLAGS += -DUSE_SSLEAY
+endif
+COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
+
+libcurl_a_LIBRARIES = libcurl.a
+
+libcurl_a_SOURCES = base64.c getenv.c if2ip.h progress.h upload.h \
+base64.h getenv.h mprintf.c setup.h url.c download.c getpass.c \
+mprintf.h ssluse.c url.h download.h hostip.c netrc.c ssluse.h \
+urldata.h formdata.c hostip.h netrc.h stdcheaders.h formdata.h \
+if2ip.c progress.c upload.c sendf.c sendf.h speedcheck.c speedcheck.h \
+ftp.c ftp.h getpass.c getpass.h version.c timeval.c timeval.h cookie.c \
+cookie.h escape.c escape.h getdate.c getdate.h dict.h dict.c http.c \
+http.h telnet.c telnet.h file.c file.h ldap.c ldap.h
+
+libcurl_a_OBJECTS = base64.o getenv.o mprintf.o url.o download.o \
+getpass.o ssluse.o hostip.o netrc.o formdata.o if2ip.o progress.o \
+upload.o sendf.o speedcheck.o ftp.o getpass.o version.o timeval.o \
+cookie.o escape.o getdate.o dict.o http.o telnet.o file.o ldap.o
+
+LIBRARIES = $(libcurl_a_LIBRARIES)
+SOURCES = $(libcurl_a_SOURCES)
+OBJECTS = $(libcurl_a_OBJECTS)
+
+
+all: libcurl.a
+
+libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
+ -@erase libcurl.a
+ $(AR) cru libcurl.a $(libcurl_a_OBJECTS)
+ $(RANLIB) libcurl.a
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+clean:
+ -@erase $(libcurl_a_OBJECTS)
+
+distrib: clean
+ -@erase $(libcurl_a_LIBRARIES)
+
diff --git a/lib/Makefile.vc6 b/lib/Makefile.vc6
new file mode 100644
index 000000000..e7db08e56
--- /dev/null
+++ b/lib/Makefile.vc6
@@ -0,0 +1,315 @@
+#############################################################
+## Makefile for building libcurl.lib with MSVC6
+## Use: nmake -f makefile.vc6 [release | release-ssl | debug]
+## (default is release)
+##
+## Comments to: Troy Engel <tengel@sonic.net>
+
+PROGRAM_NAME = libcurl.lib
+OPENSSL_PATH = ../../openssl-0.9.3a
+
+########################################################
+## Nothing more to do below this line!
+
+## Release
+CCR = cl.exe /ML /O2 /D "NDEBUG"
+LINKR = link.exe -lib
+
+## Debug
+CCD = cl.exe /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
+LINKD = link.exe -lib
+
+## SSL Release
+CCRS = cl.exe /ML /O2 /D "NDEBUG" /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
+LINKRS = link.exe -lib /LIBPATH:$(OPENSSL_PATH)/out32dll
+
+CFLAGS = /nologo /W3 /GX /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c
+LFLAGS = /nologo /out:$(PROGRAM_NAME)
+LINKLIBS = kernel32.lib wsock32.lib
+LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
+
+RELEASE_OBJS= \
+ base64r.obj \
+ cookier.obj \
+ downloadr.obj \
+ escaper.obj \
+ formdatar.obj \
+ ftpr.obj \
+ httpr.obj \
+ dictr.obj \
+ telnetr.obj \
+ getdater.obj \
+ getenvr.obj \
+ getpassr.obj \
+ hostipr.obj \
+ if2ipr.obj \
+ mprintfr.obj \
+ netrcr.obj \
+ progressr.obj \
+ sendfr.obj \
+ speedcheckr.obj \
+ ssluser.obj \
+ timevalr.obj \
+ uploadr.obj \
+ urlr.obj \
+ filer.obj \
+ versionr.obj
+
+DEBUG_OBJS= \
+ base64d.obj \
+ cookied.obj \
+ downloadd.obj \
+ escaped.obj \
+ formdatad.obj \
+ ftpd.obj \
+ httpd.obj \
+ dictd.obj \
+ telnetd.obj \
+ getdated.obj \
+ getenvd.obj \
+ getpassd.obj \
+ hostipd.obj \
+ if2ipd.obj \
+ mprintfd.obj \
+ netrcd.obj \
+ progressd.obj \
+ sendfd.obj \
+ speedcheckd.obj \
+ sslused.obj \
+ timevald.obj \
+ uploadd.obj \
+ urld.obj \
+ filed.obj \
+ versiond.obj
+
+RELEASE_SSL_OBJS= \
+ base64rs.obj \
+ cookiers.obj \
+ downloadrs.obj \
+ escapers.obj \
+ formdatars.obj \
+ ftprs.obj \
+ httprs.obj \
+ dictrs.obj \
+ telnetrs.obj \
+ getdaters.obj \
+ getenvrs.obj \
+ getpassrs.obj \
+ hostiprs.obj \
+ if2iprs.obj \
+ mprintfrs.obj \
+ netrcrs.obj \
+ progressrs.obj \
+ sendfrs.obj \
+ speedcheckrs.obj \
+ sslusers.obj \
+ timevalrs.obj \
+ uploadrs.obj \
+ urlrs.obj \
+ filers.obj \
+ versionrs.obj
+
+LINK_OBJS= \
+ base64.obj \
+ cookie.obj \
+ download.obj \
+ escape.obj \
+ formdata.obj \
+ ftp.obj \
+ http.obj \
+ dict.obj \
+ telnet.obj \
+ getdate.obj \
+ getenv.obj \
+ getpass.obj \
+ hostip.obj \
+ if2ip.obj \
+ mprintf.obj \
+ netrc.obj \
+ progress.obj \
+ sendf.obj \
+ speedcheck.obj \
+ ssluse.obj \
+ timeval.obj \
+ upload.obj \
+ url.obj \
+ file.obj \
+ version.obj
+
+all : release
+
+release: $(RELEASE_OBJS)
+ $(LINKR) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
+
+debug: $(DEBUG_OBJS)
+ $(LINKD) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
+
+release-ssl: $(RELEASE_SSL_OBJS)
+ $(LINKRS) $(LFLAGS) $(LINKLIBS) $(LINKSLIBS) $(LINK_OBJS)
+
+
+## Release
+base64r.obj: base64.c
+ $(CCR) $(CFLAGS) base64.c
+cookier.obj: cookie.c
+ $(CCR) $(CFLAGS) cookie.c
+downloadr.obj: download.c
+ $(CCR) $(CFLAGS) download.c
+escaper.obj: escape.c
+ $(CCR) $(CFLAGS) escape.c
+formdatar.obj: formdata.c
+ $(CCR) $(CFLAGS) formdata.c
+ftpr.obj: ftp.c
+ $(CCR) $(CFLAGS) ftp.c
+httpr.obj: http.c
+ $(CCR) $(CFLAGS) http.c
+dictr.obj: dict.c
+ $(CCR) $(CFLAGS) dict.c
+telnetr.obj: telnet.c
+ $(CCR) $(CFLAGS) telnet.c
+getdater.obj: getdate.c
+ $(CCR) $(CFLAGS) getdate.c
+getenvr.obj: getenv.c
+ $(CCR) $(CFLAGS) getenv.c
+getpassr.obj: getpass.c
+ $(CCR) $(CFLAGS) getpass.c
+hostipr.obj: hostip.c
+ $(CCR) $(CFLAGS) hostip.c
+if2ipr.obj: if2ip.c
+ $(CCR) $(CFLAGS) if2ip.c
+mprintfr.obj: mprintf.c
+ $(CCR) $(CFLAGS) mprintf.c
+netrcr.obj: netrc.c
+ $(CCR) $(CFLAGS) netrc.c
+progressr.obj: progress.c
+ $(CCR) $(CFLAGS) progress.c
+sendfr.obj: sendf.c
+ $(CCR) $(CFLAGS) sendf.c
+speedcheckr.obj: speedcheck.c
+ $(CCR) $(CFLAGS) speedcheck.c
+ssluser.obj: ssluse.c
+ $(CCR) $(CFLAGS) ssluse.c
+timevalr.obj: timeval.c
+ $(CCR) $(CFLAGS) timeval.c
+uploadr.obj: upload.c
+ $(CCR) $(CFLAGS) upload.c
+urlr.obj: url.c
+ $(CCR) $(CFLAGS) url.c
+filer.obj: file.c
+ $(CCR) $(CFLAGS) file.c
+versionr.obj: version.c
+ $(CCR) $(CFLAGS) version.c
+
+## Debug
+base64d.obj: base64.c
+ $(CCD) $(CFLAGS) base64.c
+cookied.obj: cookie.c
+ $(CCD) $(CFLAGS) cookie.c
+downloadd.obj: download.c
+ $(CCD) $(CFLAGS) download.c
+escaped.obj: escape.c
+ $(CCD) $(CFLAGS) escape.c
+formdatad.obj: formdata.c
+ $(CCD) $(CFLAGS) formdata.c
+ftpd.obj: ftp.c
+ $(CCD) $(CFLAGS) ftp.c
+httpd.obj: http.c
+ $(CCD) $(CFLAGS) http.c
+dictd.obj: dict.c
+ $(CCD) $(CFLAGS) dict.c
+telnetd.obj: telnet.c
+ $(CCD) $(CFLAGS) telnet.c
+getdated.obj: getdate.c
+ $(CCD) $(CFLAGS) getdate.c
+getenvd.obj: getenv.c
+ $(CCD) $(CFLAGS) getenv.c
+getpassd.obj: getpass.c
+ $(CCD) $(CFLAGS) getpass.c
+hostipd.obj: hostip.c
+ $(CCD) $(CFLAGS) hostip.c
+if2ipd.obj: if2ip.c
+ $(CCD) $(CFLAGS) if2ip.c
+mprintfd.obj: mprintf.c
+ $(CCD) $(CFLAGS) mprintf.c
+netrcd.obj: netrc.c
+ $(CCD) $(CFLAGS) netrc.c
+progressd.obj: progress.c
+ $(CCD) $(CFLAGS) progress.c
+sendfd.obj: sendf.c
+ $(CCD) $(CFLAGS) sendf.c
+speedcheckd.obj: speedcheck.c
+ $(CCD) $(CFLAGS) speedcheck.c
+sslused.obj: ssluse.c
+ $(CCD) $(CFLAGS) ssluse.c
+timevald.obj: timeval.c
+ $(CCD) $(CFLAGS) timeval.c
+uploadd.obj: upload.c
+ $(CCD) $(CFLAGS) upload.c
+urld.obj: url.c
+ $(CCD) $(CFLAGS) url.c
+filed.obj: file.c
+ $(CCD) $(CFLAGS) file.c
+versiond.obj: version.c
+ $(CCD) $(CFLAGS) version.c
+
+
+## Release SSL
+base64rs.obj: base64.c
+ $(CCRS) $(CFLAGS) base64.c
+cookiers.obj: cookie.c
+ $(CCRS) $(CFLAGS) cookie.c
+downloadrs.obj: download.c
+ $(CCRS) $(CFLAGS) download.c
+escapers.obj: escape.c
+ $(CCRS) $(CFLAGS) escape.c
+formdatars.obj: formdata.c
+ $(CCRS) $(CFLAGS) formdata.c
+ftprs.obj: ftp.c
+ $(CCRS) $(CFLAGS) ftp.c
+httprs.obj: http.c
+ $(CCRS) $(CFLAGS) http.c
+dictrs.obj: dict.c
+ $(CCRS) $(CFLAGS) dict.c
+telnetrs.obj: telnet.c
+ $(CCRS) $(CFLAGS) telnet.c
+getdaters.obj: getdate.c
+ $(CCRS) $(CFLAGS) getdate.c
+getenvrs.obj: getenv.c
+ $(CCRS) $(CFLAGS) getenv.c
+getpassrs.obj: getpass.c
+ $(CCRS) $(CFLAGS) getpass.c
+hostiprs.obj: hostip.c
+ $(CCRS) $(CFLAGS) hostip.c
+if2iprs.obj: if2ip.c
+ $(CCRS) $(CFLAGS) if2ip.c
+mprintfrs.obj: mprintf.c
+ $(CCRS) $(CFLAGS) mprintf.c
+netrcrs.obj: netrc.c
+ $(CCRS) $(CFLAGS) netrc.c
+progressrs.obj: progress.c
+ $(CCRS) $(CFLAGS) progress.c
+sendfrs.obj: sendf.c
+ $(CCRS) $(CFLAGS) sendf.c
+speedcheckrs.obj: speedcheck.c
+ $(CCRS) $(CFLAGS) speedcheck.c
+sslusers.obj: ssluse.c
+ $(CCRS) $(CFLAGS) ssluse.c
+timevalrs.obj: timeval.c
+ $(CCRS) $(CFLAGS) timeval.c
+uploadrs.obj: upload.c
+ $(CCRS) $(CFLAGS) upload.c
+urlrs.obj: url.c
+ $(CCRS) $(CFLAGS) url.c
+filers.obj: file.c
+ $(CCRS) $(CFLAGS) file.c
+versionrs.obj: version.c
+ $(CCRS) $(CFLAGS) version.c
+
+clean:
+ -@erase *.obj
+ -@erase vc60.idb
+ -@erase vc60.pch
+
+distrib: clean
+ -@erase $(PROGRAM_NAME)
+
diff --git a/lib/arpa_telnet.h b/lib/arpa_telnet.h
new file mode 100644
index 000000000..25085b89a
--- /dev/null
+++ b/lib/arpa_telnet.h
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)telnet.h 8.2 (Berkeley) 12/15/93
+ */
+
+#ifndef _ARPA_TELNET_H
+#define _ARPA_TELNET_H
+
+/*
+ * Definitions for the TELNET protocol.
+ */
+#define IAC 255 /* interpret as command: */
+#define DONT 254 /* you are not to use option */
+#define DO 253 /* please, you use option */
+#define WONT 252 /* I won't use option */
+#define WILL 251 /* I will use option */
+#define SB 250 /* interpret as subnegotiation */
+#define GA 249 /* you may reverse the line */
+#define EL 248 /* erase the current line */
+#define EC 247 /* erase the current character */
+#define AYT 246 /* are you there */
+#define AO 245 /* abort output--but let prog finish */
+#define IP 244 /* interrupt process--permanently */
+#define BREAK 243 /* break */
+#define DM 242 /* data mark--for connect. cleaning */
+#define NOP 241 /* nop */
+#define SE 240 /* end sub negotiation */
+#define EOR 239 /* end of record (transparent mode) */
+#define ABORT 238 /* Abort process */
+#define SUSP 237 /* Suspend process */
+#define xEOF 236 /* End of file: EOF is already used... */
+
+#define SYNCH 242 /* for telfunc calls */
+
+#ifdef TELCMDS
+char *telcmds[] = {
+ "EOF", "SUSP", "ABORT", "EOR",
+ "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
+ "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
+};
+#else
+extern char *telcmds[];
+#endif
+
+#define TELCMD_FIRST xEOF
+#define TELCMD_LAST IAC
+#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
+ (unsigned int)(x) >= TELCMD_FIRST)
+#define TELCMD(x) telcmds[(x)-TELCMD_FIRST]
+
+/* telnet options */
+#define TELOPT_BINARY 0 /* 8-bit data path */
+#define TELOPT_ECHO 1 /* echo */
+#define TELOPT_RCP 2 /* prepare to reconnect */
+#define TELOPT_SGA 3 /* suppress go ahead */
+#define TELOPT_NAMS 4 /* approximate message size */
+#define TELOPT_STATUS 5 /* give status */
+#define TELOPT_TM 6 /* timing mark */
+#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
+#define TELOPT_NAOL 8 /* negotiate about output line width */
+#define TELOPT_NAOP 9 /* negotiate about output page size */
+#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */
+#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
+#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */
+#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
+#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
+#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
+#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
+#define TELOPT_XASCII 17 /* extended ascic character set */
+#define TELOPT_LOGOUT 18 /* force logout */
+#define TELOPT_BM 19 /* byte macro */
+#define TELOPT_DET 20 /* data entry terminal */
+#define TELOPT_SUPDUP 21 /* supdup protocol */
+#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */
+#define TELOPT_SNDLOC 23 /* send location */
+#define TELOPT_TTYPE 24 /* terminal type */
+#define TELOPT_EOR 25 /* end or record */
+#define TELOPT_TUID 26 /* TACACS user identification */
+#define TELOPT_OUTMRK 27 /* output marking */
+#define TELOPT_TTYLOC 28 /* terminal location number */
+#define TELOPT_3270REGIME 29 /* 3270 regime */
+#define TELOPT_X3PAD 30 /* X.3 PAD */
+#define TELOPT_NAWS 31 /* window size */
+#define TELOPT_TSPEED 32 /* terminal speed */
+#define TELOPT_LFLOW 33 /* remote flow control */
+#define TELOPT_LINEMODE 34 /* Linemode option */
+#define TELOPT_XDISPLOC 35 /* X Display Location */
+#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */
+#define TELOPT_AUTHENTICATION 37/* Authenticate */
+#define TELOPT_ENCRYPT 38 /* Encryption option */
+#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */
+#define TELOPT_EXOPL 255 /* extended-options-list */
+
+
+#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
+#ifdef TELOPTS
+char *telopts[NTELOPTS+1] = {
+ "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
+ "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
+ "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
+ "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
+ "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
+ "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
+ "TACACS UID", "OUTPUT MARKING", "TTYLOC",
+ "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
+ "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
+ "ENCRYPT", "NEW-ENVIRON",
+ 0,
+};
+#define TELOPT_FIRST TELOPT_BINARY
+#define TELOPT_LAST TELOPT_NEW_ENVIRON
+#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST)
+#define TELOPT(x) telopts[(x)-TELOPT_FIRST]
+#endif
+
+/* sub-option qualifiers */
+#define TELQUAL_IS 0 /* option is... */
+#define TELQUAL_SEND 1 /* send option */
+#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
+#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
+#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
+
+#define LFLOW_OFF 0 /* Disable remote flow control */
+#define LFLOW_ON 1 /* Enable remote flow control */
+#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
+#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
+
+/*
+ * LINEMODE suboptions
+ */
+
+#define LM_MODE 1
+#define LM_FORWARDMASK 2
+#define LM_SLC 3
+
+#define MODE_EDIT 0x01
+#define MODE_TRAPSIG 0x02
+#define MODE_ACK 0x04
+#define MODE_SOFT_TAB 0x08
+#define MODE_LIT_ECHO 0x10
+
+#define MODE_MASK 0x1f
+
+/* Not part of protocol, but needed to simplify things... */
+#define MODE_FLOW 0x0100
+#define MODE_ECHO 0x0200
+#define MODE_INBIN 0x0400
+#define MODE_OUTBIN 0x0800
+#define MODE_FORCE 0x1000
+
+#define SLC_SYNCH 1
+#define SLC_BRK 2
+#define SLC_IP 3
+#define SLC_AO 4
+#define SLC_AYT 5
+#define SLC_EOR 6
+#define SLC_ABORT 7
+#define SLC_EOF 8
+#define SLC_SUSP 9
+#define SLC_EC 10
+#define SLC_EL 11
+#define SLC_EW 12
+#define SLC_RP 13
+#define SLC_LNEXT 14
+#define SLC_XON 15
+#define SLC_XOFF 16
+#define SLC_FORW1 17
+#define SLC_FORW2 18
+
+#define NSLC 18
+
+/*
+ * For backwards compatability, we define SLC_NAMES to be the
+ * list of names if SLC_NAMES is not defined.
+ */
+#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
+ "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
+ "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
+#ifdef SLC_NAMES
+char *slc_names[] = {
+ SLC_NAMELIST
+};
+#else
+extern char *slc_names[];
+#define SLC_NAMES SLC_NAMELIST
+#endif
+
+#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
+#define SLC_NAME(x) slc_names[x]
+
+#define SLC_NOSUPPORT 0
+#define SLC_CANTCHANGE 1
+#define SLC_VARIABLE 2
+#define SLC_DEFAULT 3
+#define SLC_LEVELBITS 0x03
+
+#define SLC_FUNC 0
+#define SLC_FLAGS 1
+#define SLC_VALUE 2
+
+#define SLC_ACK 0x80
+#define SLC_FLUSHIN 0x40
+#define SLC_FLUSHOUT 0x20
+
+#define OLD_ENV_VAR 1
+#define OLD_ENV_VALUE 0
+#define NEW_ENV_VAR 0
+#define NEW_ENV_VALUE 1
+#define ENV_ESC 2
+#define ENV_USERVAR 3
+
+/*
+ * AUTHENTICATION suboptions
+ */
+
+/*
+ * Who is authenticating who ...
+ */
+#define AUTH_WHO_CLIENT 0 /* Client authenticating server */
+#define AUTH_WHO_SERVER 1 /* Server authenticating client */
+#define AUTH_WHO_MASK 1
+
+/*
+ * amount of authentication done
+ */
+#define AUTH_HOW_ONE_WAY 0
+#define AUTH_HOW_MUTUAL 2
+#define AUTH_HOW_MASK 2
+
+#define AUTHTYPE_NULL 0
+#define AUTHTYPE_KERBEROS_V4 1
+#define AUTHTYPE_KERBEROS_V5 2
+#define AUTHTYPE_SPX 3
+#define AUTHTYPE_MINK 4
+#define AUTHTYPE_CNT 5
+
+#define AUTHTYPE_TEST 99
+
+#ifdef AUTH_NAMES
+char *authtype_names[] = {
+ "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
+};
+#else
+extern char *authtype_names[];
+#endif
+
+#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
+#define AUTHTYPE_NAME(x) authtype_names[x]
+
+/*
+ * ENCRYPTion suboptions
+ */
+#define ENCRYPT_IS 0 /* I pick encryption type ... */
+#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
+#define ENCRYPT_REPLY 2 /* Initial setup response */
+#define ENCRYPT_START 3 /* Am starting to send encrypted */
+#define ENCRYPT_END 4 /* Am ending encrypted */
+#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
+#define ENCRYPT_REQEND 6 /* Request you send encrypting */
+#define ENCRYPT_ENC_KEYID 7
+#define ENCRYPT_DEC_KEYID 8
+#define ENCRYPT_CNT 9
+
+#define ENCTYPE_ANY 0
+#define ENCTYPE_DES_CFB64 1
+#define ENCTYPE_DES_OFB64 2
+#define ENCTYPE_CNT 3
+
+#ifdef ENCRYPT_NAMES
+char *encrypt_names[] = {
+ "IS", "SUPPORT", "REPLY", "START", "END",
+ "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
+ 0,
+};
+char *enctype_names[] = {
+ "ANY", "DES_CFB64", "DES_OFB64", 0,
+};
+#else
+extern char *encrypt_names[];
+extern char *enctype_names[];
+#endif
+
+
+#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
+#define ENCRYPT_NAME(x) encrypt_names[x]
+
+#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
+#define ENCTYPE_NAME(x) enctype_names[x]
+#endif /* _ARPA_TELNET_H */
diff --git a/lib/base64.c b/lib/base64.c
new file mode 100644
index 000000000..8758af1ef
--- /dev/null
+++ b/lib/base64.c
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+
+/* ---- Base64 Encoding --- */
+static char table64[]=
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+void base64Encode(char *intext, char *output)
+{
+ unsigned char ibuf[3];
+ unsigned char obuf[4];
+ int i;
+ int inputparts;
+
+ while(*intext) {
+ for (i = inputparts = 0; i < 3; i++) {
+ if(*intext) {
+ inputparts++;
+ ibuf[i] = *intext;
+ intext++;
+ }
+ else
+ ibuf[i] = 0;
+ }
+
+ obuf [0] = (ibuf [0] & 0xFC) >> 2;
+ obuf [1] = ((ibuf [0] & 0x03) << 4) | ((ibuf [1] & 0xF0) >> 4);
+ obuf [2] = ((ibuf [1] & 0x0F) << 2) | ((ibuf [2] & 0xC0) >> 6);
+ obuf [3] = ibuf [2] & 0x3F;
+
+ switch(inputparts) {
+ case 1: /* only one byte read */
+ sprintf(output, "%c%c==",
+ table64[obuf[0]],
+ table64[obuf[1]]);
+ break;
+ case 2: /* two bytes read */
+ sprintf(output, "%c%c%c=",
+ table64[obuf[0]],
+ table64[obuf[1]],
+ table64[obuf[2]]);
+ break;
+ default:
+ sprintf(output, "%c%c%c%c",
+ table64[obuf[0]],
+ table64[obuf[1]],
+ table64[obuf[2]],
+ table64[obuf[3]] );
+ break;
+ }
+ output += 4;
+ }
+ *output=0;
+}
+/* ---- End of Base64 Encoding ---- */
diff --git a/lib/base64.h b/lib/base64.h
new file mode 100644
index 000000000..460974331
--- /dev/null
+++ b/lib/base64.h
@@ -0,0 +1,44 @@
+#ifndef __BASE64_H
+#define __BASE64_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+void base64Encode(char *intext, char *output);
+#endif
diff --git a/lib/cookie.c b/lib/cookie.c
new file mode 100644
index 000000000..dde335042
--- /dev/null
+++ b/lib/cookie.c
@@ -0,0 +1,457 @@
+
+/***
+
+
+RECEIVING COOKIE INFORMATION
+============================
+
+struct CookieInfo *cookie_init(char *file);
+
+ Inits a cookie struct to store data in a local file. This is always
+ called before any cookies are set.
+
+int cookies_set(struct CookieInfo *cookie, char *cookie_line);
+
+ The 'cookie_line' parameter is a full "Set-cookie:" line as
+ received from a server.
+
+ The function need to replace previously stored lines that this new
+ line superceeds.
+
+ It may remove lines that are expired.
+
+ It should return an indication of success/error.
+
+
+SENDING COOKIE INFORMATION
+==========================
+
+struct Cookies *cookie_getlist(struct CookieInfo *cookie,
+ char *host, char *path, bool secure);
+
+ For a given host and path, return a linked list of cookies that
+ the client should send to the server if used now. The secure
+ boolean informs the cookie if a secure connection is achieved or
+ not.
+
+ It shall only return cookies that haven't expired.
+
+
+Example set of cookies:
+
+ Set-cookie: PRODUCTINFO=webxpress; domain=.fidelity.com; path=/; secure
+ Set-cookie: PERSONALIZE=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;
+ domain=.fidelity.com; path=/ftgw; secure
+ Set-cookie: FidHist=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;
+ domain=.fidelity.com; path=/; secure
+ Set-cookie: FidOrder=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;
+ domain=.fidelity.com; path=/; secure
+ Set-cookie: DisPend=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;
+ domain=.fidelity.com; path=/; secure
+ Set-cookie: FidDis=none;expires=Monday, 13-Jun-1988 03:04:55 GMT;
+ domain=.fidelity.com; path=/; secure
+ Set-cookie:
+ Session_Key@6791a9e0-901a-11d0-a1c8-9b012c88aa77=none;expires=Monday,
+ 13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure
+****/
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "cookie.h"
+#include "setup.h"
+#include "getdate.h"
+
+/****************************************************************************
+ *
+ * cookie_add()
+ *
+ * Add a single cookie line to the cookie keeping object.
+ *
+ ***************************************************************************/
+
+struct Cookie *cookie_add(struct CookieInfo *c,
+ bool httpheader, /* TRUE if HTTP header-style line */
+ char *lineptr) /* first non-space of the line */
+{
+ struct Cookie *clist;
+ char what[MAX_COOKIE_LINE];
+ char name[MAX_NAME];
+ char *ptr;
+ char *semiptr;
+ struct Cookie *co;
+ time_t now = time(NULL);
+ bool replace_old = FALSE;
+
+ /* First, alloc and init a new struct for it */
+ co = (struct Cookie *)malloc(sizeof(struct Cookie));
+ if(!co)
+ return NULL; /* bail out if we're this low on memory */
+
+ /* clear the whole struct first */
+ memset(co, 0, sizeof(struct Cookie));
+
+ if(httpheader) {
+ /* This line was read off a HTTP-header */
+
+ semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
+ ptr = lineptr;
+ while(semiptr) {
+ *semiptr='\0'; /* zero terminate for a while */
+ /* we have a <what>=<this> pair or a 'secure' word here */
+ if(strchr(ptr, '=')) {
+ if(2 == sscanf(ptr, "%" MAX_NAME_TXT "[^=]=%"
+ MAX_COOKIE_LINE_TXT "[^\r\n]",
+ name, what)) {
+ /* this is a legal <what>=<this> pair */
+ if(strequal("path", name)) {
+ co->path=strdup(what);
+ }
+ else if(strequal("domain", name)) {
+ co->domain=strdup(what);
+ }
+ else if(strequal("expires", name)) {
+ co->expirestr=strdup(what);
+ co->expires = get_date(what, &now);
+ }
+ else if(!co->name) {
+ co->name = strdup(name);
+ co->value = strdup(what);
+ }
+ else
+ ;/* this is the second (or more) name we don't know
+ about! */
+ }
+ else {
+ /* this is an "illegal" <what>=<this> pair */
+ }
+ }
+ else {
+ if(sscanf(ptr, "%" MAX_COOKIE_LINE_TXT "[^\r\n]",
+ what)) {
+ if(strequal("secure", what))
+ co->secure = TRUE;
+ else
+ ; /* unsupported keyword without assign! */
+ }
+ }
+ *semiptr=';'; /* put the semicolon back */
+ ptr=semiptr+1;
+ while(ptr && *ptr && isspace((int)*ptr))
+ ptr++;
+ semiptr=strchr(ptr, ';'); /* now, find the next semicolon */
+ }
+ }
+ else {
+ /* This line is NOT a HTTP header style line, we do offer support for
+ reading the odd netscape cookies-file format here */
+ char *firstptr;
+ int fields;
+
+ if(lineptr[0]=='#') {
+ /* don't even try the comments */
+ free(co);
+ return NULL;
+ }
+ /* strip off the possible end-of-line characters */
+ if(ptr=strchr(lineptr, '\r'))
+ *ptr=0; /* clear it */
+ if(ptr=strchr(lineptr, '\n'))
+ *ptr=0; /* clear it */
+
+ firstptr=strtok(lineptr, "\t"); /* first tokenize it on the TAB */
+
+ /* Here's a quick check to eliminate normal HTTP-headers from this */
+ if(!firstptr || strchr(firstptr, ':')) {
+ free(co);
+ return NULL;
+ }
+
+ /* Now loop through the fields and init the struct we already have
+ allocated */
+ for(ptr=firstptr, fields=0; ptr; ptr=strtok(NULL, "\t"), fields++) {
+ switch(fields) {
+ case 0:
+ co->domain = strdup(ptr);
+ break;
+ case 1:
+ /* what _is_ this field for? */
+ break;
+ case 2:
+ co->path = strdup(ptr);
+ break;
+ case 3:
+ co->secure = strequal(ptr, "TRUE");
+ break;
+ case 4:
+ co->expires = atoi(ptr);
+ break;
+ case 5:
+ co->name = strdup(ptr);
+ break;
+ case 6:
+ co->value = strdup(ptr);
+ break;
+ }
+ }
+
+ if(7 != fields) {
+ /* we did not find the sufficient number of fields to recognize this
+ as a valid line, abort and go home */
+
+ if(co->domain)
+ free(co->domain);
+ if(co->path)
+ free(co->path);
+ if(co->name)
+ free(co->name);
+ if(co->value)
+ free(co->value);
+
+ free(co);
+ return NULL;
+ }
+
+ }
+
+ /* now, we have parsed the incoming line, we must now check if this
+ superceeds an already existing cookie, which it may if the previous have
+ the same domain and path as this */
+
+ clist = c->cookies;
+ replace_old = FALSE;
+ while(clist) {
+ if(strequal(clist->name, co->name)) {
+ /* the names are identical */
+
+ if(clist->domain && co->domain) {
+ if(strequal(clist->domain, co->domain))
+ replace_old=TRUE;
+ }
+ else if(!clist->domain && !co->domain)
+ replace_old = TRUE;
+
+ if(replace_old) {
+ /* the domains were identical */
+
+ if(clist->path && co->path) {
+ if(strequal(clist->path, co->path)) {
+ replace_old = TRUE;
+ }
+ else
+ replace_old = FALSE;
+ }
+ else if(!clist->path && !co->path)
+ replace_old = TRUE;
+ else
+ replace_old = FALSE;
+
+ }
+
+ if(replace_old) {
+ co->next = clist->next; /* get the next-pointer first */
+
+ /* then free all the old pointers */
+ if(clist->name)
+ free(clist->name);
+ if(clist->value)
+ free(clist->value);
+ if(clist->domain)
+ free(clist->domain);
+ if(clist->path)
+ free(clist->path);
+ if(clist->expirestr)
+ free(clist->expirestr);
+
+ *clist = *co; /* then store all the new data */
+ }
+
+ }
+ clist = clist->next;
+ }
+
+ if(!replace_old) {
+
+ /* first, point to our "next" */
+ co->next = c->cookies;
+ /* then make ourselves first in the list */
+ c->cookies = co;
+ }
+ return co;
+}
+
+/*****************************************************************************
+ *
+ * cookie_init()
+ *
+ * Inits a cookie struct to read data from a local file. This is always
+ * called before any cookies are set. File may be NULL.
+ *
+ ****************************************************************************/
+struct CookieInfo *cookie_init(char *file)
+{
+ char line[MAX_COOKIE_LINE];
+ struct CookieInfo *c;
+ FILE *fp;
+
+ c = (struct CookieInfo *)malloc(sizeof(struct CookieInfo));
+ if(!c)
+ return NULL; /* failed to get memory */
+ memset(c, 0, sizeof(struct CookieInfo));
+ c->filename = strdup(file?file:"none"); /* copy the name just in case */
+
+ fp = file?fopen(file, "r"):NULL;
+ if(fp) {
+ while(fgets(line, MAX_COOKIE_LINE, fp)) {
+ if(strnequal("Set-Cookie:", line, 11)) {
+ /* This is a cookie line, get it! */
+ char *lineptr=&line[11];
+ while(*lineptr && isspace((int)*lineptr))
+ lineptr++;
+
+ cookie_add(c, TRUE, lineptr);
+ }
+ else {
+ /* This might be a netscape cookie-file line, get it! */
+ char *lineptr=line;
+ while(*lineptr && isspace((int)*lineptr))
+ lineptr++;
+
+ cookie_add(c, FALSE, lineptr);
+ }
+ }
+ fclose(fp);
+ }
+
+ return c;
+}
+
+/*****************************************************************************
+ *
+ * cookie_getlist()
+ *
+ * For a given host and path, return a linked list of cookies that the
+ * client should send to the server if used now. The secure boolean informs
+ * the cookie if a secure connection is achieved or not.
+ *
+ * It shall only return cookies that haven't expired.
+ *
+ ****************************************************************************/
+
+struct Cookie *cookie_getlist(struct CookieInfo *c,
+ char *host, char *path, bool secure)
+{
+ struct Cookie *newco;
+ struct Cookie *co;
+ time_t now = time(NULL);
+ int hostlen=strlen(host);
+ int domlen;
+
+ struct Cookie *mainco=NULL;
+
+ if(!c || !c->cookies)
+ return NULL; /* no cookie struct or no cookies in the struct */
+
+ co = c->cookies;
+
+ while(co) {
+ /* only process this cookie if it is not expired or had no expire
+ date AND that if the cookie requires we're secure we must only
+ continue if we are! */
+ if( (co->expires<=0 || (co->expires> now)) &&
+ (co->secure?secure:TRUE) ) {
+
+ /* now check if the domain is correct */
+ domlen=co->domain?strlen(co->domain):0;
+ if(!co->domain ||
+ ((domlen<hostlen) &&
+ strequal(host+(hostlen-domlen), co->domain)) ) {
+ /* the right part of the host matches the domain stuff in the
+ cookie data */
+
+ /* now check the left part of the path with the cookies path
+ requirement */
+ if(!co->path ||
+ strnequal(path, co->path, strlen(co->path))) {
+
+ /* and now, we know this is a match and we should create an
+ entry for the return-linked-list */
+
+ newco = (struct Cookie *)malloc(sizeof(struct Cookie));
+ if(newco) {
+ /* first, copy the whole source cookie: */
+ memcpy(newco, co, sizeof(struct Cookie));
+
+ /* then modify our next */
+ newco->next = mainco;
+
+ /* point the main to us */
+ mainco = newco;
+ }
+ }
+ }
+ }
+ co = co->next;
+ }
+
+ return mainco; /* return the new list */
+}
+
+
+/*****************************************************************************
+ *
+ * cookie_freelist()
+ *
+ * Free a list previously returned by cookie_getlist();
+ *
+ ****************************************************************************/
+
+void cookie_freelist(struct Cookie *co)
+{
+ struct Cookie *next;
+ if(co) {
+ while(co) {
+ next = co->next;
+ free(co); /* we only free the struct since the "members" are all
+ just copied! */
+ co = next;
+ }
+ }
+}
+
+/*****************************************************************************
+ *
+ * cookie_cleanup()
+ *
+ * Free a "cookie object" previous created with cookie_init().
+ *
+ ****************************************************************************/
+void cookie_cleanup(struct CookieInfo *c)
+{
+ struct Cookie *co;
+ struct Cookie *next;
+ if(c) {
+ if(c->filename)
+ free(c->filename);
+ co = c->cookies;
+
+ while(co) {
+ if(co->name)
+ free(co->name);
+ if(co->value)
+ free(co->value);
+ if(co->domain)
+ free(co->domain);
+ if(co->path)
+ free(co->path);
+ if(co->expirestr)
+ free(co->expirestr);
+
+ next = co->next;
+ free(co);
+ co = next;
+ }
+ }
+}
+
diff --git a/lib/cookie.h b/lib/cookie.h
new file mode 100644
index 000000000..466844a5d
--- /dev/null
+++ b/lib/cookie.h
@@ -0,0 +1,45 @@
+#ifndef __COOKIE_H
+#define __COOKIE_H
+
+#include <stdio.h>
+#ifdef WIN32
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
+#include <curl/curl.h>
+
+struct Cookie {
+ struct Cookie *next; /* next in the chain */
+ char *name; /* <this> = value */
+ char *value; /* name = <this> */
+ char *path; /* path = <this> */
+ char *domain; /* domain = <this> */
+ time_t expires; /* expires = <this> */
+ char *expirestr; /* the plain text version */
+ bool secure; /* whether the 'secure' keyword was used */
+};
+
+struct CookieInfo {
+ /* linked list of cookies we know of */
+ struct Cookie *cookies;
+
+ char *filename; /* file we read from/write to */
+};
+
+/* This is the maximum line length we accept for a cookie line */
+#define MAX_COOKIE_LINE 2048
+#define MAX_COOKIE_LINE_TXT "2047"
+
+/* This is the maximum length of a cookie name we deal with: */
+#define MAX_NAME 256
+#define MAX_NAME_TXT "255"
+
+struct Cookie *cookie_add(struct CookieInfo *, bool, char *);
+struct CookieInfo *cookie_init(char *);
+struct Cookie *cookie_getlist(struct CookieInfo *, char *, char *, bool);
+void cookie_freelist(struct Cookie *);
+void cookie_cleanup(struct CookieInfo *);
+
+#endif
diff --git a/lib/dict.c b/lib/dict.c
new file mode 100644
index 000000000..e26437022
--- /dev/null
+++ b/lib/dict.c
@@ -0,0 +1,245 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#include <time.h>
+#include <io.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "download.h"
+#include "sendf.h"
+
+#include "progress.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+
+UrgError dict(struct UrlData *data, char *path, long *bytecount)
+{
+ int nth;
+ char *word;
+ char *ppath;
+ char *database = NULL;
+ char *strategy = NULL;
+ char *nthdef = NULL; /* This is not part of the protocol, but required
+ by RFC 2229 */
+ UrgError result=URG_OK;
+
+ if(data->conf & CONF_USERPWD) {
+ /* AUTH is missing */
+ }
+
+ if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
+ strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
+ strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
+
+ word = strchr(path, ':');
+ if (word) {
+ word++;
+ database = strchr(word, ':');
+ if (database) {
+ *database++ = (char)0;
+ strategy = strchr(database, ':');
+ if (strategy) {
+ *strategy++ = (char)0;
+ nthdef = strchr(strategy, ':');
+ if (nthdef) {
+ *nthdef++ = (char)0;
+ }
+ }
+ }
+ }
+
+ if ((word == NULL) || (*word == (char)0)) {
+ failf(data, "lookup word is missing\n");
+ }
+ if ((database == NULL) || (*database == (char)0)) {
+ database = "!";
+ }
+ if ((strategy == NULL) || (*strategy == (char)0)) {
+ strategy = ".";
+ }
+ if ((nthdef == NULL) || (*nthdef == (char)0)) {
+ nth = 0;
+ }
+ else {
+ nth = atoi(nthdef);
+ }
+
+ sendf(data->firstsocket, data,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
+ "MATCH "
+ "%s " /* database */
+ "%s " /* strategy */
+ "%s\n" /* word */
+ "QUIT\n",
+
+ database,
+ strategy,
+ word
+ );
+
+ result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+
+ if(result)
+ return result;
+
+ }
+ else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
+ strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
+ strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
+
+ word = strchr(path, ':');
+ if (word) {
+ word++;
+ database = strchr(word, ':');
+ if (database) {
+ *database++ = (char)0;
+ nthdef = strchr(database, ':');
+ if (nthdef) {
+ *nthdef++ = (char)0;
+ }
+ }
+ }
+
+ if ((word == NULL) || (*word == (char)0)) {
+ failf(data, "lookup word is missing\n");
+ }
+ if ((database == NULL) || (*database == (char)0)) {
+ database = "!";
+ }
+ if ((nthdef == NULL) || (*nthdef == (char)0)) {
+ nth = 0;
+ }
+ else {
+ nth = atoi(nthdef);
+ }
+
+ sendf(data->firstsocket, data,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
+ "DEFINE "
+ "%s " /* database */
+ "%s\n" /* word */
+ "QUIT\n",
+
+ database,
+ word
+ );
+
+ result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+
+ if(result)
+ return result;
+
+ }
+ else {
+
+ ppath = strchr(path, '/');
+ if (ppath) {
+ int i;
+
+ ppath++;
+ for (i = 0; (i < URL_MAX_LENGTH) && (ppath[i]); i++) {
+ if (ppath[i] == ':')
+ ppath[i] = ' ';
+ }
+ sendf(data->firstsocket, data,
+ "CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
+ "%s\n"
+ "QUIT\n",
+ ppath);
+
+ result = Download(data, data->firstsocket, -1, FALSE, bytecount);
+
+ if(result)
+ return result;
+
+ }
+ }
+
+ ProgressEnd(data);
+ return URG_OK;
+}
diff --git a/lib/dict.h b/lib/dict.h
new file mode 100644
index 000000000..edff0c434
--- /dev/null
+++ b/lib/dict.h
@@ -0,0 +1,45 @@
+#ifndef __DICT_H
+#define __DICT_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError dict(struct UrlData *data, char *path, long *bytecountp);
+
+#endif
diff --git a/lib/download.c b/lib/download.c
new file mode 100644
index 000000000..fb0cb60ea
--- /dev/null
+++ b/lib/download.c
@@ -0,0 +1,484 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "setup.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+
+#ifdef __BEOS__
+#include <net/socket.h>
+#endif
+
+#ifdef WIN32
+#if !defined( __GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#endif
+#include <time.h> /* for the time_t typedef! */
+
+#if defined(__GNUC__) && defined(TIME_WITH_SYS_TIME)
+#include <sys/time.h>
+#endif
+
+#endif
+
+#include "progress.h"
+#include "speedcheck.h"
+#include "sendf.h"
+
+#ifdef USE_ZLIB
+#include <zlib.h>
+#endif
+
+#define MAX(x,y) ((x)>(y)?(x):(y))
+
+/* --- download a stream from a socket --- */
+
+/* This newly edited version of Download() was brought to us by the friendly
+ Mark Butler <butlerm@xmission.com>. Re-indented with the indent command. */
+
+UrgError
+Download (struct UrlData *data,
+ int sockfd, /* socket to read from */
+ int size, /* -1 if unknown at this point */
+ bool getheader, /* TRUE if header parsing is wanted */
+ long *bytecountp /* return number of bytes read */
+)
+{
+ char *buf = data->buffer;
+ size_t nread;
+ int bytecount = 0;
+ long contentlength=0;
+ struct timeval start = tvnow();
+ struct timeval now = start;
+ bool header = TRUE;
+ int headerline = 0; /* counts header lines to better track the first one */
+
+ char *hbufp; /* points at *end* of header line */
+ int hbuflen = 0;
+ char *str; /* within buf */
+ char *str_start; /* within buf */
+ char *end_ptr; /* within buf */
+ char *p; /* within headerbuff */
+ bool content_range = FALSE; /* set TRUE if Content-Range: was found */
+ int offset = 0; /* possible resume offset read from the
+ Content-Range: header */
+ int code = 0; /* error code from the 'HTTP/1.? XXX' line */
+#ifdef USE_ZLIB
+ gzFile gzfile=NULL;
+#endif
+
+ /* for the low speed checks: */
+ UrgError urg;
+ time_t timeofdoc=0;
+ long bodywrites=0;
+
+ char newurl[URL_MAX_LENGTH]; /* buffer for Location: URL */
+
+ hbufp = data->headerbuff;
+
+ myalarm (0); /* switch off the alarm-style timeout */
+
+ now = tvnow();
+ start = now;
+
+ if (!getheader) {
+ header = FALSE;
+ ProgressInit (data, size);
+ }
+ {
+ fd_set readfd;
+ fd_set keepfd;
+ struct timeval interval;
+ bool keepon = TRUE;
+
+ /* timeout every X second
+ - makes a better progressmeter (i.e even when no data is read, the
+ meter can be updated and reflect reality)
+ - allows removal of the alarm() crap
+ - variable timeout is easier
+ */
+
+ FD_ZERO (&readfd); /* clear it */
+ FD_SET (sockfd, &readfd);
+
+ keepfd = readfd;
+#ifdef USE_ZLIB
+ gzfile = gzdopen(sockfd, "rb");
+#endif
+ while (keepon) {
+ readfd = keepfd; /* set this every lap in the loop */
+ interval.tv_sec = 2;
+ interval.tv_usec = 0;
+
+ switch (select (sockfd + 1, &readfd, NULL, NULL, &interval)) {
+ case -1: /* error, stop reading */
+ keepon = FALSE;
+ continue;
+ case 0: /* timeout */
+ break;
+ default: /* read! */
+#ifdef USE_SSLEAY
+ if (data->use_ssl) {
+ nread = SSL_read (data->ssl, buf, BUFSIZE - 1);
+ }
+ else {
+#endif
+#ifdef USE_ZLIB
+ nread = gzread(gzfile, buf, BUFSIZE -1 );
+#else
+ nread = sread (sockfd, buf, BUFSIZE - 1);
+#endif
+#ifdef USE_SSLEAY
+ }
+#endif /* USE_SSLEAY */
+
+ /* NULL terminate, allowing string ops to be used */
+ if (0 < (signed int) nread)
+ buf[nread] = 0;
+
+ /* if we receive 0 or less here, the server closed the connection and
+ we bail out from this! */
+ else if (0 >= (signed int) nread) {
+ keepon = FALSE;
+ break;
+ }
+
+ str = buf; /* Default buffer to use when we write the
+ buffer, it may be changed in the flow below
+ before the actual storing is done. */
+
+ /* Since this is a two-state thing, we check if we are parsing
+ headers at the moment or not. */
+
+ if (header) {
+ /* we are in parse-the-header-mode */
+
+ /* header line within buffer loop */
+ do {
+ int hbufp_index;
+
+ str_start = str; /* str_start is start of line within buf */
+
+ end_ptr = strchr (str_start, '\n');
+
+ if (!end_ptr) {
+ /* no more complete header lines within buffer */
+ /* copy what is remaining into headerbuff */
+ int str_length = (int)strlen(str);
+
+ if (hbuflen + (int)str_length >= data->headersize) {
+ char *newbuff;
+ long newsize=MAX((hbuflen+str_length)*3/2,
+ data->headersize*2);
+ hbufp_index = hbufp - data->headerbuff;
+ newbuff = (char *)realloc(data->headerbuff, newsize);
+ if(!newbuff) {
+ failf (data, "Failed to alloc memory for big header!");
+ return URG_READ_ERROR;
+ }
+ data->headersize=newsize;
+ data->headerbuff = newbuff;
+ hbufp = data->headerbuff + hbufp_index;
+ }
+ strcpy (hbufp, str);
+ hbufp += strlen (str);
+ hbuflen += strlen (str);
+ break; /* read more and try again */
+ }
+
+ str = end_ptr + 1; /* move just past new line */
+
+ if (hbuflen + (str - str_start) >= data->headersize) {
+ char *newbuff;
+ long newsize=MAX((hbuflen+(str-str_start))*3/2,
+ data->headersize*2);
+ hbufp_index = hbufp - data->headerbuff;
+ newbuff = (char *)realloc(data->headerbuff, newsize);
+ if(!newbuff) {
+ failf (data, "Failed to alloc memory for big header!");
+ return URG_READ_ERROR;
+ }
+ data->headersize= newsize;
+ data->headerbuff = newbuff;
+ hbufp = data->headerbuff + hbufp_index;
+ }
+
+ /* copy to end of line */
+ strncpy (hbufp, str_start, str - str_start);
+ hbufp += str - str_start;
+ hbuflen += str - str_start;
+ *hbufp = 0;
+
+ p = data->headerbuff;
+
+ /* we now have a full line that p points to */
+ if (('\n' == *p) || ('\r' == *p)) {
+ /* Zero-length line means end of header! */
+ if (-1 != size) /* if known */
+ size += bytecount; /* we append the already read size */
+
+
+ if ('\r' == *p)
+ p++; /* pass the \r byte */
+ if ('\n' == *p)
+ p++; /* pass the \n byte */
+
+ ProgressInit (data, size); /* init progress meter */
+ header = FALSE; /* no more header to parse! */
+
+ /* now, only output this if the header AND body are requested: */
+ if ((data->conf & (CONF_HEADER | CONF_NOBODY)) == CONF_HEADER) {
+ if((p - data->headerbuff) !=
+ data->fwrite (data->headerbuff, 1,
+ p - data->headerbuff, data->out)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ }
+ if(data->writeheader) {
+ /* obviously, the header is requested to be written to
+ this file: */
+ if((p - data->headerbuff) !=
+ fwrite (data->headerbuff, 1, p - data->headerbuff,
+ data->writeheader)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ }
+ break; /* exit header line loop */
+ }
+
+ if (!headerline++) {
+ /* This is the first header, it MUST be the error code line
+ or else we consiser this to be the body right away! */
+ if (sscanf (p, " HTTP/1.%*c %3d", &code)) {
+ /* 404 -> URL not found! */
+ if (
+ ( ((data->conf & CONF_FOLLOWLOCATION) && (code >= 400)) ||
+ !(data->conf & CONF_FOLLOWLOCATION) && (code >= 300))
+ && (data->conf & CONF_FAILONERROR)) {
+ /* If we have been told to fail hard on HTTP-errors,
+ here is the check for that: */
+ /* serious error, go home! */
+ failf (data, "The requested file was not found");
+ return URG_HTTP_NOT_FOUND;
+ }
+ }
+ else {
+ header = FALSE; /* this is not a header line */
+ break;
+ }
+ }
+ /* check for Content-Length: header lines to get size */
+ if (strnequal("Content-Length", p, 14) &&
+ sscanf (p+14, ": %ld", &contentlength))
+ size = contentlength;
+ else if (strnequal("Content-Range", p, 13) &&
+ sscanf (p+13, ": bytes %d-", &offset)) {
+ if (data->resume_from == offset) {
+ /* we asked for a resume and we got it */
+ content_range = TRUE;
+ }
+ }
+ else if(data->cookies &&
+ strnequal("Set-Cookie: ", p, 11)) {
+ cookie_add(data->cookies, TRUE, &p[12]);
+ }
+ else if(strnequal("Last-Modified:", p, strlen("Last-Modified:")) &&
+ data->timecondition) {
+ time_t secs=time(NULL);
+ timeofdoc = get_date(p+strlen("Last-Modified:"), &secs);
+ }
+ else if ((code >= 300 && code < 400) &&
+ (data->conf & CONF_FOLLOWLOCATION) &&
+ strnequal("Location", p, 8) &&
+ sscanf (p+8, ": %" URL_MAX_LENGTH_TXT "s", newurl)) {
+ /* this is the URL that the server advices us to get
+ instead */
+ data->newurl = strdup (newurl);
+ }
+
+ if (data->conf & CONF_HEADER) {
+ if(hbuflen != data->fwrite (p, 1, hbuflen, data->out)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ }
+ if(data->writeheader) {
+ /* the header is requested to be written to this file */
+ if(hbuflen != fwrite (p, 1, hbuflen, data->writeheader)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ }
+
+ /* reset hbufp pointer && hbuflen */
+ hbufp = data->headerbuff;
+ hbuflen = 0;
+ }
+ while (*str); /* header line within buffer */
+
+ /* We might have reached the end of the header part here, but
+ there might be a non-header part left in the end of the read
+ buffer. */
+
+ if (!header) {
+ /* the next token and forward is not part of
+ the header! */
+
+ /* we subtract the remaining header size from the buffer */
+ nread -= (str - buf);
+ }
+
+ } /* end if header mode */
+
+ /* This is not an 'else if' since it may be a rest from the header
+ parsing, where the beginning of the buffer is headers and the end
+ is non-headers. */
+ if (str && !header && (nread > 0)) {
+
+ if(0 == bodywrites) {
+ /* These checks are only made the first time we are about to
+ write a chunk of the body */
+ if(data->conf&CONF_HTTP) {
+ /* HTTP-only checks */
+ if (data->resume_from && !content_range ) {
+ /* we wanted to resume a download, although the server doesn't
+ seem to support this */
+ failf (data, "HTTP server doesn't seem to support byte ranges. Cannot resume.");
+ return URG_HTTP_RANGE_ERROR;
+ }
+ else if (data->newurl) {
+ /* abort after the headers if "follow Location" is set */
+ infof (data, "Follow to new URL: %s\n", data->newurl);
+ return URG_OK;
+ }
+ else if(data->timecondition && !data->range) {
+ /* A time condition has been set AND no ranges have been
+ requested. This seems to be what chapter 13.3.4 of RFC 2616
+ defines to be the correct action for a HTTP/1.1 client */
+ if((timeofdoc > 0) && (data->timevalue > 0)) {
+ switch(data->timecondition) {
+ case TIMECOND_IFMODSINCE:
+ default:
+ if(timeofdoc < data->timevalue) {
+ infof(data, "The requested document is not new enough");
+ return URG_OK;
+ }
+ break;
+ case TIMECOND_IFUNMODSINCE:
+ if(timeofdoc > data->timevalue) {
+ infof(data, "The requested document is not old enough");
+ return URG_OK;
+ }
+ break;
+ } /* switch */
+ } /* two valid time strings */
+ } /* we have a time condition */
+ } /* this is HTTP */
+ } /* this is the first time we write a body part */
+ bodywrites++;
+
+ if(data->maxdownload &&
+ (bytecount + nread > data->maxdownload)) {
+ nread = data->maxdownload - bytecount;
+ if(nread < 0 ) /* this should be unusual */
+ nread = 0;
+ keepon = FALSE; /* we're done now! */
+ }
+
+ bytecount += nread;
+
+ if (nread != data->fwrite (str, 1, nread, data->out)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+
+ }
+ break;
+ }
+ now = tvnow();
+ if (!header) {
+ ProgressShow (data, bytecount, start, now, FALSE);
+ }
+ urg = speedcheck (data, now);
+ if (urg)
+ return urg;
+
+ if (data->timeout && (tvdiff (now, start) > data->timeout)) {
+ failf (data, "Operation timed out with %d out of %d bytes received",
+ bytecount, size);
+ return URG_OPERATION_TIMEOUTED;
+ }
+#ifdef MULTIDOC
+ if(contentlength && bytecount >= contentlength) {
+ /* we're done with this download, now stop it */
+ break;
+ }
+#endif
+ }
+ }
+ if(contentlength && (bytecount != contentlength)) {
+ failf(data, "transfer closed with %d bytes remaining", contentlength-bytecount);
+ return URG_PARTIAL_FILE;
+ }
+ ProgressShow (data, bytecount, start, now, TRUE);
+
+ *bytecountp = bytecount;
+
+#ifdef USE_ZLIB
+ gzclose(gzfile);
+#endif
+ return URG_OK;
+}
+
+
diff --git a/lib/download.h b/lib/download.h
new file mode 100644
index 000000000..e8ca82add
--- /dev/null
+++ b/lib/download.h
@@ -0,0 +1,50 @@
+#ifndef __DOWNLOAD_H
+#define __DOWNLOAD_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError
+Download (struct UrlData *data,
+ int sockfd, /* socket to read from */
+ int size, /* -1 if unknown at this point */
+ bool getheader, /* TRUE if header parsing is wanted */
+ long *bytecountp /* return number of bytes read */
+);
+
+#endif
diff --git a/lib/escape.c b/lib/escape.c
new file mode 100644
index 000000000..68000cd71
--- /dev/null
+++ b/lib/escape.c
@@ -0,0 +1,111 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* Escape and unescape URL encoding in strings. The functions return a new
+ * allocated string or NULL if an error occurred. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char *curl_escape(char *string)
+{
+ int alloc=strlen(string);
+ char *ns = malloc(alloc);
+ unsigned char in;
+ int newlen = alloc;
+ int index=0;
+
+ while(*string) {
+ in = *string;
+ if(' ' == in)
+ ns[index++] = '+';
+ else if(!(in >= 'a' && in <= 'z') &&
+ !(in >= 'A' && in <= 'Z') &&
+ !(in >= '0' && in <= '9')) {
+ /* encode it */
+ newlen += 2; /* the size grows with two, since this'll become a %XX */
+ if(newlen > alloc) {
+ alloc *= 2;
+ ns = realloc(ns, alloc);
+ if(!ns)
+ return NULL;
+ }
+ sprintf(&ns[index], "%%%02X", in);
+ index+=3;
+ }
+ else {
+ /* just copy this */
+ ns[index++]=in;
+ }
+ string++;
+ }
+ ns[index]=0; /* terminate it */
+ return ns;
+}
+
+char *curl_unescape(char *string)
+{
+ int alloc = strlen(string);
+ char *ns = malloc(alloc);
+ unsigned char in;
+ int index=0;
+ int hex;
+
+
+ while(*string) {
+ in = *string;
+ if('+' == in)
+ in = ' ';
+ else if('%' == in) {
+ /* encoded part */
+ if(sscanf(string+1, "%02X", &hex)) {
+ in = hex;
+ string+=2;
+ }
+ }
+
+ ns[index++] = in;
+ string++;
+ }
+ ns[index]=0; /* terminate it */
+ return ns;
+
+}
diff --git a/lib/escape.h b/lib/escape.h
new file mode 100644
index 000000000..bca4d8bd9
--- /dev/null
+++ b/lib/escape.h
@@ -0,0 +1,49 @@
+#ifndef __ESCAPE_H
+#define __ESCAPE_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+/* Escape and unescape URL encoding in strings. The functions return a new
+ * allocated string or NULL if an error occurred. */
+
+char *curl_escape(char *string);
+char *curl_unescape(char *string);
+
+#endif
diff --git a/lib/file.c b/lib/file.c
new file mode 100644
index 000000000..b5d198e57
--- /dev/null
+++ b/lib/file.c
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1999.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#include <time.h>
+#include <io.h>
+#include <fcntl.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "progress.h"
+#include "sendf.h"
+#include "escape.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+
+UrgError file(struct UrlData *data, char *path, long *bytecountp)
+{
+ /* This implementation ignores the host name in conformance with
+ RFC 1738. Only local files (reachable via the standard file system)
+ are supported. This means that files on remotely mounted directories
+ (via NFS, Samba, NT sharing) can be accessed through a file:// URL
+ */
+
+ struct stat statbuf;
+ size_t expected_size=-1;
+ size_t nread;
+ char *buf = data->buffer;
+ int bytecount = 0;
+ struct timeval start = tvnow();
+ struct timeval now = start;
+ int fd;
+ char *actual_path = curl_unescape(path);
+
+#ifdef WIN32
+ int i;
+
+ /* change path separators from '/' to '\\' for Windows */
+ for (i=0; actual_path[i] != '\0'; ++i)
+ if (actual_path[i] == '/')
+ actual_path[i] = '\\';
+
+ fd = open(actual_path, O_RDONLY | O_BINARY); /* no CR/LF translation! */
+#else
+ fd = open(actual_path, O_RDONLY);
+#endif
+ free(actual_path);
+
+ if(fd == -1) {
+ failf(data, "Couldn't open file %s", path);
+ return URG_FILE_COULDNT_READ_FILE;
+ }
+ if( -1 != fstat(fd, &statbuf)) {
+ /* we could stat it, then read out the size */
+ expected_size = statbuf.st_size;
+ }
+
+ /* The following is a shortcut implementation of file reading
+ this is both more efficient than the former call to download() and
+ it avoids problems with select() and recv() on file descriptors
+ in Winsock */
+ ProgressInit (data, expected_size);
+ while (1) {
+ nread = read(fd, buf, BUFSIZE-1);
+
+ if (0 <= nread)
+ buf[nread] = 0;
+
+ if (nread <= 0)
+ break;
+ bytecount += nread;
+ /* NOTE: The following call to fwrite does CR/LF translation on
+ Windows systems if the target is stdout. Use -O or -o parameters
+ to prevent CR/LF translation (this then goes to a binary mode
+ file descriptor). */
+ if(nread != data->fwrite (buf, 1, nread, data->out)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ now = tvnow();
+ ProgressShow (data, bytecount, start, now, FALSE);
+ }
+ now = tvnow();
+ ProgressShow (data, bytecount, start, now, TRUE);
+
+ close(fd);
+
+ return URG_OK;
+}
diff --git a/lib/file.h b/lib/file.h
new file mode 100644
index 000000000..eeaeef4f4
--- /dev/null
+++ b/lib/file.h
@@ -0,0 +1,45 @@
+#ifndef __FILE_H
+#define __FILE_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError file(struct UrlData *data, char *path, long *bytecountp);
+
+#endif
diff --git a/lib/formdata b/lib/formdata
new file mode 100755
index 000000000..dc8e9e803
--- /dev/null
+++ b/lib/formdata
Binary files differ
diff --git a/lib/formdata.c b/lib/formdata.c
new file mode 100644
index 000000000..eff0212e4
--- /dev/null
+++ b/lib/formdata.c
@@ -0,0 +1,617 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/*
+ Debug the form generator stand-alone by compiling this source file with:
+
+ gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -o formdata -I../include formdata.c
+
+ run the 'formdata' executable and make sure the output is ok!
+
+ try './formdata "name=Daniel" "poo=noo" "foo=bar"' and similarly
+
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include <time.h>
+
+#include "setup.h"
+#include <curl/curl.h>
+#include "formdata.h"
+
+/* Length of the random boundary string. The risk of this being used
+ in binary data is very close to zero, 64^32 makes
+ 6277101735386680763835789423207666416102355444464034512896
+ combinations... */
+#define BOUNDARY_LENGTH 32
+
+/* What kind of Content-Type to use on un-specified files with unrecognized
+ extensions. */
+#define HTTPPOST_CONTENTTYPE_DEFAULT "text/plain"
+
+/* This is a silly duplicate of the function in main.c to enable this source
+ to compile stand-alone for better debugging */
+static void GetStr(char **string,
+ char *value)
+{
+ if(*string)
+ free(*string);
+ *string = strdup(value);
+}
+
+/***************************************************************************
+ *
+ * FormParse()
+ *
+ * Reads a 'name=value' paramter and builds the appropriate linked list.
+ *
+ * Specify files to upload with 'name=@filename'. Supports specified
+ * given Content-Type of the files. Such as ';type=<content-type>'.
+ *
+ * You may specify more than one file for a single name (field). Specify
+ * multiple files by writing it like:
+ *
+ * 'name=@filename,filename2,filename3'
+ *
+ * If you want content-types specified for each too, write them like:
+ *
+ * 'name=@filename;type=image/gif,filename2,filename3'
+ *
+ ***************************************************************************/
+
+int curl_FormParse(char *input,
+ struct HttpPost **httppost,
+ struct HttpPost **last_post)
+{
+ return FormParse(input, httppost, last_post);
+}
+
+#define FORM_FILE_SEPARATOR ','
+#define FORM_TYPE_SEPARATOR ';'
+
+int FormParse(char *input,
+ struct HttpPost **httppost,
+ struct HttpPost **last_post)
+{
+ /* nextarg MUST be a string in the format 'name=contents' and we'll
+ build a linked list with the info */
+ char name[256];
+ char contents[1024]="";
+ char major[128];
+ char minor[128];
+ long flags = 0;
+ char *contp;
+ char *type = NULL;
+ char *prevtype = NULL;
+ char *sep;
+ char *sep2;
+ struct HttpPost *post;
+ struct HttpPost *subpost; /* a sub-node */
+ unsigned int i;
+
+ if(1 <= sscanf(input, "%255[^ =] = %1023[^\n]", name, contents)) {
+ /* the input was using the correct format */
+ contp = contents;
+
+ if('@' == contp[0]) {
+ /* we use the @-letter to indicate file name(s) */
+
+ flags = HTTPPOST_FILENAME;
+ contp++;
+
+ post=NULL;
+
+ do {
+ /* since this was a file, it may have a content-type specifier
+ at the end too */
+
+ sep=strchr(contp, FORM_TYPE_SEPARATOR);
+ sep2=strchr(contp, FORM_FILE_SEPARATOR);
+
+ /* pick the closest */
+ if(sep2 && (sep2 < sep)) {
+ sep = sep2;
+
+ /* no type was specified! */
+ }
+ if(sep) {
+
+ /* if we got here on a comma, don't do much */
+ if(FORM_FILE_SEPARATOR != *sep)
+ type = strstr(sep+1, "type=");
+ else
+ type=NULL;
+
+ *sep=0; /* terminate file name at separator */
+
+ if(type) {
+ type += strlen("type=");
+
+ if(2 != sscanf(type, "%127[^/]/%127[^,\n]",
+ major, minor)) {
+ fprintf(stderr, "Illegally formatted content-type field!\n");
+ return 2; /* illegal content-type syntax! */
+ }
+ /* now point beyond the content-type specifier */
+ sep = type + strlen(major)+strlen(minor)+1;
+
+ /* find the following comma */
+ sep=strchr(sep, FORM_FILE_SEPARATOR);
+ }
+ }
+ else {
+ type=NULL;
+ sep=strchr(contp, FORM_FILE_SEPARATOR);
+ }
+ if(sep) {
+ /* the next file name starts here */
+ *sep =0;
+ sep++;
+ }
+ if(!type) {
+ /*
+ * No type was specified, we scan through a few well-known
+ * extensions and pick the first we match!
+ */
+ struct ContentType {
+ char *extension;
+ char *type;
+ };
+ static struct ContentType ctts[]={
+ {".gif", "image/gif"},
+ {".jpg", "image/jpeg"},
+ {".jpeg", "image/jpeg"},
+ {".txt", "text/plain"},
+ {".html", "text/plain"}
+ };
+
+ if(prevtype)
+ /* default to the previously set/used! */
+ type = prevtype;
+ else
+ /* It seems RFC1867 defines no Content-Type to default to
+ text/plain so we don't actually need to set this: */
+ type = HTTPPOST_CONTENTTYPE_DEFAULT;
+
+ for(i=0; i<sizeof(ctts)/sizeof(ctts[0]); i++) {
+ if(strlen(contp) >= strlen(ctts[i].extension)) {
+ if(strequal(contp +
+ strlen(contp) - strlen(ctts[i].extension),
+ ctts[i].extension)) {
+ type = ctts[i].type;
+ break;
+ }
+ }
+ }
+ /* we have a type by now */
+ }
+
+ if(NULL == post) {
+ /* For the first file name, we allocate and initiate the main list
+ node */
+
+ post = (struct HttpPost *)malloc(sizeof(struct HttpPost));
+ if(post) {
+ memset(post, 0, sizeof(struct HttpPost));
+ GetStr(&post->name, name); /* get the name */
+ GetStr(&post->contents, contp); /* get the contents */
+ post->flags = flags;
+ if(type) {
+ GetStr(&post->contenttype, type); /* get type */
+ prevtype=post->contenttype; /* point to the allocated string! */
+ }
+ /* make the previous point to this */
+ if(*last_post)
+ (*last_post)->next = post;
+ else
+ (*httppost) = post;
+
+ (*last_post) = post;
+ }
+
+ }
+ else {
+ /* we add a file name to the previously allocated node, known as
+ 'post' now */
+ subpost =(struct HttpPost *)malloc(sizeof(struct HttpPost));
+ if(subpost) {
+ memset(subpost, 0, sizeof(struct HttpPost));
+ GetStr(&subpost->name, name); /* get the name */
+ GetStr(&subpost->contents, contp); /* get the contents */
+ subpost->flags = flags;
+ if(type) {
+ GetStr(&subpost->contenttype, type); /* get type */
+ prevtype=subpost->contenttype; /* point to the allocated string! */
+ }
+ /* now, point our 'more' to the original 'more' */
+ subpost->more = post->more;
+
+ /* then move the original 'more' to point to ourselves */
+ post->more = subpost;
+ }
+ }
+ contp = sep; /* move the contents pointer to after the separator */
+ } while(sep && *sep); /* loop if there's another file name */
+ }
+ else {
+ post = (struct HttpPost *)malloc(sizeof(struct HttpPost));
+ if(post) {
+ memset(post, 0, sizeof(struct HttpPost));
+ GetStr(&post->name, name); /* get the name */
+ GetStr(&post->contents, contp); /* get the contents */
+ post->flags = 0;
+
+ /* make the previous point to this */
+ if(*last_post)
+ (*last_post)->next = post;
+ else
+ (*httppost) = post;
+
+ (*last_post) = post;
+ }
+
+ }
+
+ }
+ else {
+ fprintf(stderr, "Illegally formatted input field!\n");
+ return 1;
+ }
+ return 0;
+}
+
+static int AddFormData(struct FormData **formp,
+ void *line,
+ long length)
+{
+ struct FormData *newform = (struct FormData *)
+ malloc(sizeof(struct FormData));
+ newform->next = NULL;
+
+ /* we make it easier for plain strings: */
+ if(!length)
+ length = strlen((char *)line);
+
+ newform->line = (char *)malloc(length+1);
+ memcpy(newform->line, line, length+1);
+ newform->length = length;
+
+ if(*formp) {
+ (*formp)->next = newform;
+ *formp = newform;
+ }
+ else
+ *formp = newform;
+
+ return length;
+}
+
+
+static int AddFormDataf(struct FormData **formp,
+ char *fmt, ...)
+{
+ char s[1024];
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(s, fmt, ap);
+ va_end(ap);
+
+ return AddFormData(formp, s, 0);
+}
+
+
+char *MakeFormBoundary(void)
+{
+ char *retstring;
+ static int randomizer=0; /* this is just so that two boundaries within
+ the same form won't be identical */
+ int i;
+
+ static char table64[]=
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ retstring = (char *)malloc(BOUNDARY_LENGTH);
+
+ if(!retstring)
+ return NULL; /* failed */
+
+ srand(time(NULL)+randomizer++); /* seed */
+
+ strcpy(retstring, "curl"); /* bonus commercials 8*) */
+
+ for(i=4; i<(BOUNDARY_LENGTH-1); i++) {
+ retstring[i] = table64[rand()%64];
+ }
+ retstring[BOUNDARY_LENGTH-1]=0; /* zero terminate */
+
+ return retstring;
+}
+
+
+void FormFree(struct FormData *form)
+{
+ struct FormData *next;
+ do {
+ next=form->next; /* the following form line */
+ free(form->line); /* free the line */
+ free(form); /* free the struct */
+
+ } while(form=next); /* continue */
+}
+
+struct FormData *getFormData(struct HttpPost *post,
+ int *sizep)
+{
+ struct FormData *form = NULL;
+ struct FormData *firstform;
+
+ struct HttpPost *file;
+
+ int size =0;
+ char *boundary;
+ char *fileboundary=NULL;
+
+ if(!post)
+ return NULL; /* no input => no output! */
+
+ boundary = MakeFormBoundary();
+
+ /* Make the first line of the output */
+ AddFormDataf(&form,
+ "Content-Type: multipart/form-data;"
+ " boundary=%s\r\n",
+ boundary);
+ /* we DO NOT count that line since that'll be part of the header! */
+
+ firstform = form;
+
+ do {
+
+ /* boundary */
+ size += AddFormDataf(&form, "\r\n--%s\r\n", boundary);
+
+ size += AddFormDataf(&form,
+ "Content-Disposition: form-data; name=\"%s\"",
+ post->name);
+
+ if(post->more) {
+ /* If used, this is a link to more file names, we must then do
+ the magic to include several files with the same field name */
+
+ fileboundary = MakeFormBoundary();
+
+ size += AddFormDataf(&form,
+ "\r\nContent-Type: multipart/mixed,"
+ " boundary=%s\r\n",
+ fileboundary);
+ }
+
+ file = post;
+
+ do {
+ if(post->more) {
+ /* if multiple-file */
+ size += AddFormDataf(&form,
+ "\r\n--%s\r\nContent-Disposition: attachment; filename=\"%s\"",
+ fileboundary, file->contents);
+ }
+ else if(post->flags & HTTPPOST_FILENAME) {
+ size += AddFormDataf(&form,
+ "; filename=\"%s\"",
+ post->contents);
+ }
+
+ if(file->contenttype) {
+ /* we have a specified type */
+ size += AddFormDataf(&form,
+ "\r\nContent-Type: %s",
+ file->contenttype);
+ }
+ if(file->contenttype &&
+ !strnequal("text/", file->contenttype, 5)) {
+ /* this is not a text content, mention our binary encoding */
+ size += AddFormDataf(&form,
+ "\r\nContent-Transfer-Encoding: binary");
+ }
+
+
+ size += AddFormDataf(&form,
+ "\r\n\r\n");
+
+ if(post->flags & HTTPPOST_FILENAME) {
+ /* we should include the contents from the specified file */
+ FILE *fileread;
+ char buffer[1024];
+ int nread;
+
+ fileread = strequal("-", file->contents)?stdin:
+ /* binary read for win32 crap */
+ fopen(file->contents, "rb");
+ if(fileread) {
+ while((nread = fread(buffer, 1, 1024, fileread))) {
+ size += AddFormData(&form,
+ buffer,
+ nread);
+ }
+ if(fileread != stdin)
+ fclose(fileread);
+ }
+ else {
+ size += AddFormDataf(&form, "[File wasn't found by client]");
+ }
+ }
+ else {
+ /* include the contents we got */
+ size += AddFormDataf(&form,
+ post->contents);
+ }
+ } while((file = file->more)); /* for each specified file for this field */
+
+ if(post->more) {
+ /* this was a multiple-file inclusion, make a termination file
+ boundary: */
+ size += AddFormDataf(&form,
+ "\r\n--%s--",
+ fileboundary);
+ free(fileboundary);
+ }
+
+ } while((post=post->next)); /* for each field */
+
+ /* end-boundary for everything */
+ size += AddFormDataf(&form,
+ "\r\n--%s--\r\n",
+ boundary);
+
+ *sizep = size;
+
+ free(boundary);
+
+ return firstform;
+}
+
+int FormInit(struct Form *form, struct FormData *formdata )
+{
+ form->data = formdata;
+ form->sent = 0;
+
+ if(!formdata)
+ return 1; /* error */
+
+ return 0;
+}
+
+/* fread() emulation */
+int FormReader(char *buffer,
+ size_t size,
+ size_t nitems,
+ FILE *mydata)
+{
+ struct Form *form;
+ int wantedsize;
+ int gotsize;
+
+ form=(struct Form *)mydata;
+
+ wantedsize = size * nitems;
+
+ if(!form->data)
+ return 0; /* nothing, error, empty */
+
+ do {
+
+ if( (form->data->length - form->sent ) > wantedsize ) {
+
+ memcpy(buffer, form->data->line + form->sent, wantedsize);
+
+ form->sent += wantedsize;
+
+ return wantedsize;
+ }
+
+ memcpy(buffer,
+ form->data->line + form->sent,
+ gotsize = (form->data->length - form->sent) );
+
+ form->sent = 0;
+
+ form->data = form->data->next; /* advance */
+
+ } while(!gotsize && form->data);
+ /* If we got an empty line and we have more data, we proceed to the next
+ line immediately to avoid returning zero before we've reached the end.
+ This is the bug reported November 22 1999 on curl 6.3. (Daniel) */
+
+ return gotsize;
+}
+
+
+#ifdef _FORM_DEBUG
+
+int main(int argc, char **argv)
+{
+#if 0
+ char *testargs[]={
+ "name1 = data in number one",
+ "name2 = number two data",
+ "test = @upload"
+ };
+#endif
+ int i;
+ char *nextarg;
+ struct HttpPost *httppost=NULL;
+ struct HttpPost *last_post=NULL;
+ struct HttpPost *post;
+ int size;
+ int nread;
+ char buffer[4096];
+
+ struct FormData *form;
+ struct Form formread;
+
+ for(i=1; i<argc; i++) {
+
+ if( FormParse( argv[i],
+ &httppost,
+ &last_post)) {
+ fprintf(stderr, "Illegally formatted input field: '%s'!\n",
+ argv[i]);
+ return 1;
+ }
+ }
+
+ form=getFormData(httppost, &size);
+
+ FormInit(&formread, form);
+
+ while(nread = FormReader(buffer, 1, sizeof(buffer), (FILE *)&formread)) {
+ fwrite(buffer, nread, 1, stderr);
+ }
+
+ fprintf(stderr, "size: %d\n", size);
+
+ return 0;
+}
+
+#endif
diff --git a/lib/formdata.h b/lib/formdata.h
new file mode 100644
index 000000000..6b08a05b4
--- /dev/null
+++ b/lib/formdata.h
@@ -0,0 +1,103 @@
+#ifndef __FORMDATA_H
+#define __FORMDATA_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rafael Sagula <sagula@inf.ufrgs.br>
+ * Sampo Kellomaki <sampo@iki.fi>
+ * Linas Vepstas <linas@linas.org>
+ * Bjorn Reese <breese@imada.ou.dk>
+ * Johan Anderson <johan@homemail.com>
+ * Kjell Ericson <Kjell.Ericson@haxx.nu>
+ * Troy Engel <tengel@palladium.net>
+ * Ryan Nelson <ryan@inch.com>
+ * Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ * $Log$
+ * Revision 1.1 1999-12-29 14:21:22 bagder
+ * Initial revision
+ *
+ * Revision 1.4 1999/09/06 06:59:40 dast
+ * Changed email info
+ *
+ * Revision 1.3 1999/08/13 07:34:47 dast
+ * Changed the URL in the header
+ *
+ * Revision 1.2 1999/07/30 12:59:47 dast
+ * FormFree() was added to properly cleanup after a form was posted.
+ *
+ * Revision 1.1.1.1 1999/03/11 22:23:34 dast
+ * Imported sources
+ *
+ ****************************************************************************/
+/* plain and simple linked list with lines to send */
+struct FormData {
+ struct FormData *next;
+ char *line;
+ long length;
+};
+
+struct Form {
+ struct FormData *data; /* current form line to send */
+ int sent; /* number of bytes of the current line that has already
+ been sent in a previous invoke */
+};
+
+int FormParse(char *string,
+ struct HttpPost **httppost,
+ struct HttpPost **last_post);
+
+int FormInit(struct Form *form, struct FormData *formdata );
+
+struct FormData *getFormData(struct HttpPost *post,
+ int *size);
+
+/* fread() emulation */
+int FormReader(char *buffer,
+ size_t size,
+ size_t nitems,
+ FILE *mydata);
+
+char *MakeFormBoundary(void);
+
+void FormFree(struct FormData *);
+
+#endif
diff --git a/lib/ftp.c b/lib/ftp.c
new file mode 100644
index 000000000..d62891298
--- /dev/null
+++ b/lib/ftp.c
@@ -0,0 +1,1046 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "setup.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#else /* some kind of unix */
+#include <sys/socket.h>
+#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#include <sys/utsname.h>
+#include <netdb.h>
+#endif
+
+#if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__)
+#include <errno.h>
+#endif
+
+
+#include <curl/curl.h>
+#include "urldata.h"
+#include "sendf.h"
+
+#include "if2ip.h"
+#include "hostip.h"
+#include "progress.h"
+#include "upload.h"
+#include "download.h"
+
+
+/* returns last node in linked list */
+static struct curl_slist *slist_get_last(struct curl_slist *list)
+{
+ struct curl_slist *item;
+
+ /* if caller passed us a NULL, return now */
+ if (!list)
+ return NULL;
+
+ /* loop through to find the last item */
+ item = list;
+ while (item->next) {
+ item = item->next;
+ }
+ return item;
+}
+
+/* append a struct to the linked list. It always retunrs the address of the
+ * first record, so that you can sure this function as an initialization
+ * function as well as an append function. If you find this bothersome,
+ * then simply create a separate _init function and call it appropriately from
+ * within the proram. */
+struct curl_slist *curl_slist_append(struct curl_slist *list, char *data)
+{
+ struct curl_slist *last;
+ struct curl_slist *new_item;
+
+ new_item = (struct curl_slist *) malloc(sizeof(struct curl_slist));
+ if (new_item) {
+ new_item->next = NULL;
+ new_item->data = strdup(data);
+ }
+ else {
+ fprintf(stderr, "Cannot allocate memory for QUOTE list.\n");
+ exit(-1);
+ }
+
+ if (list) {
+ last = slist_get_last(list);
+ last->next = new_item;
+ return list;
+ }
+
+ /* if this is the first item, then new_item *is* the list */
+ return new_item;
+}
+
+/* be nice and clean up resources */
+void curl_slist_free_all(struct curl_slist *list)
+{
+ struct curl_slist *next;
+ struct curl_slist *item;
+
+ if (!list)
+ return;
+
+ item = list;
+ do {
+ next = item->next;
+
+ if (item->data) {
+ free(item->data);
+ }
+ free(item);
+ item = next;
+ } while (next);
+}
+
+
+static UrgError AllowServerConnect(struct UrlData *data,
+ int sock)
+{
+ fd_set rdset;
+ struct timeval dt;
+
+ FD_ZERO(&rdset);
+
+ FD_SET(sock, &rdset);
+
+ /* we give the server 10 seconds to connect to us */
+ dt.tv_sec = 10;
+ dt.tv_usec = 0;
+
+ switch ( select(sock+1, &rdset, NULL, NULL, &dt)) {
+ case -1: /* error */
+ /* let's die here */
+ failf(data, "Error while waiting for server connect");
+ return URG_FTP_PORT_FAILED;
+ case 0: /* timeout */
+ /* let's die here */
+ failf(data, "Timeout while waiting for server connect");
+ return URG_FTP_PORT_FAILED;
+ default:
+ /* we have received data here */
+ {
+ int s;
+ size_t size = sizeof(struct sockaddr_in);
+ struct sockaddr_in add;
+
+ getsockname(sock, (struct sockaddr *) &add, (int *)&size);
+ s=accept(sock, (struct sockaddr *) &add, (int *)&size);
+
+ if( -1 == s) {
+ /* DIE! */
+ failf(data, "Error accept()ing server connect");
+ return URG_FTP_PORT_FAILED;
+ }
+ infof(data, "Connection accepted from server\n");
+
+ data->secondarysocket = s;
+ }
+ break;
+ }
+ return URG_OK;
+}
+
+
+/* --- parse FTP server responses --- */
+
+#define lastline(line) (isdigit((int)line[0]) && isdigit((int)line[1]) && \
+ isdigit((int)line[2]) && (' ' == line[3]))
+
+static int GetLastResponse(int sockfd, char *buf,
+ struct UrlData *data)
+{
+ int nread;
+ int read_rc=1;
+ char *ptr;
+ do {
+ ptr=buf;
+
+ /* get us a full line, terminated with a newline */
+ for(nread=0;
+ (nread<BUFSIZE) && read_rc;
+ nread++, ptr++) {
+#ifdef USE_SSLEAY
+ if (data->use_ssl) {
+ read_rc = SSL_read(data->ssl, ptr, 1);
+ }
+ else {
+#endif
+ read_rc = sread(sockfd, ptr, 1);
+#ifdef USE_SSLEAY
+ }
+#endif /* USE_SSLEAY */
+ if (*ptr == '\n')
+ break;
+ }
+ *ptr=0; /* zero terminate */
+
+ if(data->conf & CONF_VERBOSE) {
+ fputs("< ", data->err);
+ fwrite(buf, 1, nread, data->err);
+ fputs("\n", data->err);
+ }
+ } while(read_rc &&
+ (nread<4 || !lastline(buf)) );
+ return nread;
+}
+
+/* -- who are we? -- */
+char *getmyhost(void)
+{
+ static char myhost[256];
+#if !defined(WIN32) && !defined(HAVE_UNAME) && !defined(HAVE_GETHOSTNAME)
+ /* We have no means of finding the local host name! */
+ strcpy(myhost, "localhost");
+#endif
+#if defined(WIN32) || !defined(HAVE_UNAME)
+ gethostname(myhost, 256);
+#else
+ struct utsname ugnm;
+
+ if (uname(&ugnm) < 0)
+ return "localhost";
+
+ (void) strncpy(myhost, ugnm.nodename, 255);
+ myhost[255] = '\0';
+#endif
+ return myhost;
+}
+
+#if 0
+/*
+ * URLfix()
+ *
+ * This function returns a string converted FROM the input URL format to a
+ * format that is more likely usable for the remote server. That is, all
+ * special characters (found as %XX-codes) will be eascaped with \<letter>.
+ */
+
+static char *URLfix(char *string)
+{
+ /* The length of the new string can't be longer than twice the original
+ string, if all letters are '+'... */
+ int alloc = strlen(string)*2;
+ char *ns = malloc(alloc);
+ unsigned char in;
+ int index=0;
+ int hex;
+
+ while(*string) {
+ in = *string;
+ switch(in) {
+ case '+':
+ ns[index++] = '\\';
+ ns[index++] = ' ';
+ string++;
+ continue;
+
+ case '%':
+ /* encoded part */
+ if(sscanf(string+1, "%02X", &hex)) {
+ ns[index++] = '\\';
+ ns[index++] = hex;
+ string+=3;
+ continue;
+ }
+ /* FALLTHROUGH */
+ default:
+ ns[index++] = in;
+ string++;
+ }
+ }
+ ns[index]=0; /* terminate it */
+ return ns;
+}
+#endif
+
+static
+UrgError _ftp(struct UrlData *data,
+ long *bytecountp,
+ char *ftpuser,
+ char *ftppasswd,
+ char *ppath)
+{
+ /* this is FTP and no proxy */
+ size_t nread;
+ UrgError result;
+ char *buf = data->buffer; /* this is our buffer */
+ /* for the ftp PORT mode */
+ int portsock=-1;
+ struct sockaddr_in serv_addr;
+
+ struct curl_slist *qitem; /* QUOTE item */
+
+ /* The first thing we do is wait for the "220*" line: */
+ nread = GetLastResponse(data->firstsocket, buf, data);
+ if(strncmp(buf, "220", 3)) {
+ failf(data, "This doesn't seem like a nice ftp-server response");
+ return URG_FTP_WEIRD_SERVER_REPLY;
+ }
+
+ /* send USER */
+ sendf(data->firstsocket, data, "USER %s\r\n", ftpuser);
+
+ /* wait for feedback */
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(!strncmp(buf, "530", 3)) {
+ /* 530 User ... access denied
+ (the server denies to log the specified user) */
+ failf(data, "Access denied: %s", &buf[4]);
+ return URG_FTP_ACCESS_DENIED;
+ }
+ else if(!strncmp(buf, "331", 3)) {
+ /* 331 Password required for ...
+ (the server requires to send the user's password too) */
+ sendf(data->firstsocket, data, "PASS %s\r\n", ftppasswd);
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(!strncmp(buf, "530", 3)) {
+ /* 530 Login incorrect.
+ (the username and/or the password are incorrect) */
+ failf(data, "the username and/or the password are incorrect");
+ return URG_FTP_USER_PASSWORD_INCORRECT;
+ }
+ else if(!strncmp(buf, "230", 3)) {
+ /* 230 User ... logged in.
+ (user successfully logged in) */
+
+ infof(data, "We have successfully logged in\n");
+ }
+ else {
+ failf(data, "Odd return code after PASS");
+ return URG_FTP_WEIRD_PASS_REPLY;
+ }
+ }
+ else if(! strncmp(buf, "230", 3)) {
+ /* 230 User ... logged in.
+ (the user logged in without password) */
+ infof(data, "We have successfully logged in\n");
+ }
+ else {
+ failf(data, "Odd return code after USER");
+ return URG_FTP_WEIRD_USER_REPLY;
+ }
+
+ /* Send any QUOTE strings? */
+ if(data->quote) {
+ qitem = data->quote;
+ /* Send all QUOTE strings in same order as on command-line */
+ while (qitem) {
+ /* Send string */
+ if (qitem->data) {
+ sendf(data->firstsocket, data, "%s\r\n", qitem->data);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if (buf[0] != '2') {
+ failf(data, "QUOT string not accepted: %s",
+ qitem->data);
+ return URG_FTP_QUOTE_ERROR;
+ }
+ }
+ qitem = qitem->next;
+ }
+ }
+
+ /* If we have selected NOBODY, it means that we only want file information.
+ Which in FTP can't be much more than the file size! */
+ if(data->conf & CONF_NOBODY) {
+ /* The SIZE command is _not_ RFC 959 specified, and therefor many servers
+ may not support it! It is however the only way we have to get a file's
+ size! */
+ int filesize;
+ sendf(data->firstsocket, data, "SIZE %s\r\n", ppath);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "213", 3)) {
+ failf(data, "Couldn't get file size: %s", buf+4);
+ return URG_FTP_COULDNT_GET_SIZE;
+ }
+ /* get the size from the ascii string: */
+ filesize = atoi(buf+4);
+
+ sprintf(buf, "Content-Length: %d\n", filesize);
+
+ if(strlen(buf) != data->fwrite(buf, 1, strlen(buf), data->out)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ if(data->writeheader) {
+ /* the header is requested to be written to this file */
+ if(strlen(buf) != fwrite (buf, 1, strlen(buf), data->writeheader)) {
+ failf (data, "Failed writing output");
+ return URG_WRITE_ERROR;
+ }
+ }
+ return URG_OK;
+ }
+
+ /* We have chosen to use the PORT command */
+ if(data->conf & CONF_FTPPORT) {
+ struct sockaddr_in sa;
+ struct hostent *h=NULL;
+ size_t size;
+ unsigned short porttouse;
+
+ char *myhost=NULL;
+
+ if(data->ftpport) {
+ myhost = if2ip(data->ftpport);
+ if(myhost) {
+ h = GetHost(data, myhost);
+ }
+ else {
+ if(strlen(data->ftpport)>1)
+ h = GetHost(data, data->ftpport);
+ if(h)
+ myhost=data->ftpport;
+ }
+ }
+ if(!myhost) {
+ myhost = getmyhost();
+ h=GetHost(data, myhost);
+ }
+ infof(data, "We connect from %s\n", myhost);
+
+ if ( h ) {
+ if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) {
+ memset((char *)&sa, 0, sizeof(sa));
+ memcpy((char *)&sa.sin_addr,
+ h->h_addr,
+ h->h_length);
+ sa.sin_family = AF_INET;
+ sa.sin_addr.s_addr = INADDR_ANY;
+ sa.sin_port = 0;
+ size = sizeof(sa);
+
+ if(bind(portsock, (struct sockaddr *)&sa, size) >= 0) {
+ /* we succeeded to bind */
+ struct sockaddr_in add;
+ size = sizeof(add);
+
+ if(getsockname(portsock, (struct sockaddr *) &add,
+ (int *)&size)<0) {
+ failf(data, "getsockname() failed");
+ return URG_FTP_PORT_FAILED;
+ }
+ porttouse = ntohs(add.sin_port);
+
+ if ( listen(portsock, 1) < 0 ) {
+ failf(data, "listen(2) failed on socket");
+ return URG_FTP_PORT_FAILED;
+ }
+ }
+ else {
+ failf(data, "bind(2) failed on socket");
+ return URG_FTP_PORT_FAILED;
+ }
+ }
+ else {
+ failf(data, "socket(2) failed (%s)");
+ return URG_FTP_PORT_FAILED;
+ }
+ }
+ else {
+ failf(data, "could't find my own IP address (%s)", myhost);
+ return URG_FTP_PORT_FAILED;
+ }
+ {
+ struct in_addr in;
+ unsigned short ip[5];
+ (void) memcpy(&in.s_addr, *h->h_addr_list, sizeof (in.s_addr));
+ sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu",
+ &ip[0], &ip[1], &ip[2], &ip[3]);
+ sendf(data->firstsocket, data, "PORT %d,%d,%d,%d,%d,%d\n",
+ ip[0], ip[1], ip[2], ip[3],
+ porttouse >> 8,
+ porttouse & 255);
+ }
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "200", 3)) {
+ failf(data, "Server does not grok PORT, try without it!");
+ return URG_FTP_PORT_FAILED;
+ }
+ }
+ else { /* we use the PASV command */
+
+ sendf(data->firstsocket, data, "PASV\r\n");
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "227", 3)) {
+ failf(data, "Odd return code after PASV");
+ return URG_FTP_WEIRD_PASV_REPLY;
+ }
+ else {
+ int ip[4];
+ int port[2];
+ unsigned short newport;
+ char newhost[32];
+ struct hostent *he;
+ char *str=buf;
+
+ /*
+ * New 227-parser June 3rd 1999.
+ * It now scans for a sequence of six comma-separated numbers and
+ * will take them as IP+port indicators.
+ *
+ * Found reply-strings include:
+ * "227 Entering Passive Mode (127,0,0,1,4,51)"
+ * "227 Data transfer will passively listen to 127,0,0,1,4,51"
+ * "227 Entering passive mode. 127,0,0,1,4,51"
+ */
+
+ while(*str) {
+ if (6 == sscanf(str, "%d,%d,%d,%d,%d,%d",
+ &ip[0], &ip[1], &ip[2], &ip[3],
+ &port[0], &port[1]))
+ break;
+ str++;
+ }
+ if(!*str) {
+ failf(data, "Couldn't interpret this 227-reply: %s", buf);
+ return URG_FTP_WEIRD_227_FORMAT;
+ }
+ sprintf(newhost, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
+ he = GetHost(data, newhost);
+ if(!he) {
+ failf(data, "Can't resolve new host %s", newhost);
+ return URG_FTP_CANT_GET_HOST;
+ }
+
+
+ newport = (port[0]<<8) + port[1];
+ data->secondarysocket = socket(AF_INET, SOCK_STREAM, 0);
+
+ memset((char *) &serv_addr, '\0', sizeof(serv_addr));
+ memcpy((char *)&(serv_addr.sin_addr), he->h_addr, he->h_length);
+ serv_addr.sin_family = he->h_addrtype;
+ serv_addr.sin_port = htons(newport);
+
+ if(data->conf & CONF_VERBOSE) {
+ struct in_addr in;
+#if 1
+ struct hostent * answer;
+
+ unsigned long address;
+#if defined(HAVE_INET_ADDR) || defined(WIN32)
+ address = inet_addr(newhost);
+ answer = gethostbyaddr((char *) &address, sizeof(address),
+ AF_INET);
+#else
+ answer = NULL;
+#endif
+ (void) memcpy(&in.s_addr, *he->h_addr_list, sizeof (in.s_addr));
+ infof(data, "Connecting to %s (%s) port %u\n",
+ answer?answer->h_name:newhost, inet_ntoa(in), newport);
+#else
+ (void) memcpy(&in.s_addr, *he->h_addr_list, sizeof (in.s_addr));
+ infof(data, "Connecting to %s (%s) port %u\n",
+ he->h_name, inet_ntoa(in), newport);
+#endif
+ }
+
+ if (connect(data->secondarysocket, (struct sockaddr *) &serv_addr,
+ sizeof(serv_addr)) < 0) {
+ switch(errno) {
+#ifdef ECONNREFUSED
+ /* this should be made nicer */
+ case ECONNREFUSED:
+ failf(data, "Connection refused by ftp server");
+ break;
+#endif
+#ifdef EINTR
+ case EINTR:
+ failf(data, "Connection timeouted to ftp server");
+ break;
+#endif
+ default:
+ failf(data, "Can't connect to ftp server");
+ break;
+ }
+ return URG_FTP_CANT_RECONNECT;
+ }
+ }
+
+ }
+ /* we have the (new) data connection ready */
+
+ if(data->conf & CONF_UPLOAD) {
+
+ /* Set type to binary (unless specified ASCII) */
+ sendf(data->firstsocket, data, "TYPE %s\r\n",
+ (data->conf&CONF_FTPASCII)?"A":"I");
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "200", 3)) {
+ failf(data, "Couldn't set %s mode",
+ (data->conf&CONF_FTPASCII)?"ASCII":"binary");
+ return (data->conf&CONF_FTPASCII)? URG_FTP_COULDNT_SET_ASCII:
+ URG_FTP_COULDNT_SET_BINARY;
+ }
+
+ if(data->resume_from) {
+ /* we're about to continue the uploading of a file */
+ /* 1. get already existing file's size. We use the SIZE
+ command for this which may not exist in the server!
+ The SIZE command is not in RFC959. */
+
+ /* 2. This used to set REST. But since we can do append, we
+ don't another ftp command. We just skip the source file
+ offset and then we APPEND the rest on the file instead */
+
+ /* 3. pass file-size number of bytes in the source file */
+ /* 4. lower the infilesize counter */
+ /* => transfer as usual */
+
+ if(data->resume_from < 0 ) {
+ /* we could've got a specified offset from the command line,
+ but now we know we didn't */
+
+ sendf(data->firstsocket, data, "SIZE %s\r\n", ppath);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "213", 3)) {
+ failf(data, "Couldn't get file size: %s", buf+4);
+ return URG_FTP_COULDNT_GET_SIZE;
+ }
+
+ /* get the size from the ascii string: */
+ data->resume_from = atoi(buf+4);
+ }
+
+ if(data->resume_from) {
+ /* do we still game? */
+ int passed=0;
+#if 0
+ /* Set resume file transfer offset */
+ infof(data, "Instructs server to resume from offset %d\n",
+ data->resume_from);
+
+ sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "350", 3)) {
+ failf(data, "Couldn't use REST: %s", buf+4);
+ return URG_FTP_COULDNT_USE_REST;
+ }
+#else
+ /* enable append instead */
+ data->conf |= CONF_FTPAPPEND;
+#endif
+ /* Now, let's read off the proper amount of bytes from the
+ input. If we knew it was a proper file we could've just
+ fseek()ed but we only have a stream here */
+ do {
+ int readthisamountnow = (data->resume_from - passed);
+ int actuallyread;
+
+ if(readthisamountnow > BUFSIZE)
+ readthisamountnow = BUFSIZE;
+
+ actuallyread =
+ data->fread(data->buffer, 1, readthisamountnow, data->in);
+
+ passed += actuallyread;
+ if(actuallyread != readthisamountnow) {
+ failf(data, "Could only read %d bytes from the input\n",
+ passed);
+ return URG_FTP_COULDNT_USE_REST;
+ }
+ }
+ while(passed != data->resume_from);
+
+ /* now, decrease the size of the read */
+ if(data->infilesize>0) {
+ data->infilesize -= data->resume_from;
+
+ if(data->infilesize <= 0) {
+ infof(data, "File already completely uploaded\n");
+ return URG_OK;
+ }
+ }
+ /* we've passed, proceed as normal */
+ }
+ }
+
+ /* Send everything on data->in to the socket */
+ if(data->conf & CONF_FTPAPPEND)
+ /* we append onto the file instead of rewriting it */
+ sendf(data->firstsocket, data, "APPE %s\r\n", ppath);
+ else
+ sendf(data->firstsocket, data, "STOR %s\r\n", ppath);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(atoi(buf)>=400) {
+ failf(data, "Failed FTP upload:%s", buf+3);
+ /* oops, we never close the sockets! */
+ return URG_FTP_COULDNT_STOR_FILE;
+ }
+
+ if(data->conf & CONF_FTPPORT) {
+ result = AllowServerConnect(data, portsock);
+ if( result )
+ return result;
+ }
+
+ *bytecountp=0;
+
+ /* When we know we're uploading a specified file, we can get the file
+ size prior to the actual upload. */
+
+ ProgressInit(data, data->infilesize);
+ result = Upload(data, data->secondarysocket, bytecountp);
+ if(result)
+ return result;
+
+ if((-1 != data->infilesize) && (data->infilesize != *bytecountp)) {
+ failf(data, "Wrote only partial file (%d out of %d bytes)",
+ *bytecountp, data->infilesize);
+ return URG_PARTIAL_FILE;
+ }
+ }
+ else {
+ /* Retrieve file or directory */
+ bool dirlist=FALSE;
+ long downloadsize=-1;
+
+ if(data->conf&CONF_RANGE && data->range) {
+ int from, to;
+ int totalsize=-1;
+ char *ptr;
+ char *ptr2;
+
+ from=strtol(data->range, &ptr, 0);
+ while(ptr && *ptr && (isspace((int)*ptr) || (*ptr=='-')))
+ ptr++;
+ to=strtol(ptr, &ptr2, 0);
+ if(ptr == ptr2) {
+ /* we didn't get any digit */
+ to=-1;
+ }
+ if(-1 == to) {
+ /* X - */
+ data->resume_from = from;
+ }
+ else if(from < 0) {
+ /* -Y */
+ from = 0;
+ to = -from;
+ totalsize = to-from;
+ data->maxdownload = totalsize;
+ }
+ else {
+ /* X- */
+ totalsize = to-from;
+ data->maxdownload = totalsize;
+ }
+ infof(data, "range-download from %d to %d, totally %d bytes\n",
+ from, to, totalsize);
+ }
+
+ if(!ppath[0])
+ /* make sure this becomes a valid name */
+ ppath="./";
+
+ if((data->conf & CONF_FTPLISTONLY) ||
+ ('/' == ppath[strlen(ppath)-1] )) {
+ /* The specified path ends with a slash, and therefore we think this
+ is a directory that is requested, use LIST. But before that we
+ need to set ASCII transfer mode. */
+ dirlist = TRUE;
+
+ /* Set type to ASCII */
+ sendf(data->firstsocket, data, "TYPE A\r\n");
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "200", 3)) {
+ failf(data, "Couldn't set ascii mode");
+ return URG_FTP_COULDNT_SET_ASCII;
+ }
+
+ /* if this output is to be machine-parsed, the NLST command will be
+ better used since the LIST command output is not specified or
+ standard in any way */
+
+ sendf(data->firstsocket, data, "%s %s\r\n",
+ data->customrequest?data->customrequest:
+ (data->conf&CONF_FTPLISTONLY?"NLST":"LIST"),
+ ppath);
+ }
+ else {
+ /* Set type to binary (unless specified ASCII) */
+ sendf(data->firstsocket, data, "TYPE %s\r\n",
+ (data->conf&CONF_FTPASCII)?"A":"I");
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "200", 3)) {
+ failf(data, "Couldn't set %s mode",
+ (data->conf&CONF_FTPASCII)?"ASCII":"binary");
+ return (data->conf&CONF_FTPASCII)? URG_FTP_COULDNT_SET_ASCII:
+ URG_FTP_COULDNT_SET_BINARY;
+ }
+
+ if(data->resume_from) {
+
+ /* Daniel: (August 4, 1999)
+ *
+ * We start with trying to use the SIZE command to figure out the size
+ * of the file we're gonna get. If we can get the size, this is by far
+ * the best way to know if we're trying to resume beyond the EOF. */
+
+ sendf(data->firstsocket, data, "SIZE %s\r\n", ppath);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "213", 3)) {
+ infof(data, "server doesn't support SIZE: %s", buf+4);
+ /* We couldn't get the size and therefore we can't know if there
+ really is a part of the file left to get, although the server
+ will just close the connection when we start the connection so it
+ won't cause us any harm, just not make us exit as nicely. */
+ }
+ else {
+ int foundsize=atoi(buf+4);
+ /* We got a file size report, so we check that there actually is a
+ part of the file left to get, or else we go home. */
+ if(foundsize <= data->resume_from) {
+ failf(data, "Offset (%d) was beyond file size (%d)",
+ data->resume_from, foundsize);
+ return URG_FTP_BAD_DOWNLOAD_RESUME;
+ }
+ /* Now store the number of bytes we are expected to download */
+ downloadsize = foundsize-data->resume_from;
+ }
+
+ /* Set resume file transfer offset */
+ infof(data, "Instructs server to resume from offset %d\n",
+ data->resume_from);
+
+ sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from);
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(strncmp(buf, "350", 3)) {
+ failf(data, "Couldn't use REST: %s", buf+4);
+ return URG_FTP_COULDNT_USE_REST;
+ }
+ }
+
+ sendf(data->firstsocket, data, "RETR %s\r\n", ppath);
+ }
+
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ if(!strncmp(buf, "150", 3) || !strncmp(buf, "125", 3)) {
+
+ /*
+ A;
+ 150 Opening BINARY mode data connection for /etc/passwd (2241
+ bytes). (ok, the file is being transfered)
+
+ B:
+ 150 Opening ASCII mode data connection for /bin/ls
+
+ C:
+ 150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes).
+
+ D:
+ 150 Opening ASCII mode data connection for /linux/fisk/kpanelrc (0.0.0.0,0) (545 bytes).
+
+ E:
+ 125 Data connection already open; Transfer starting. */
+
+ int size=-1; /* default unknown size */
+
+ if(!dirlist && (-1 == downloadsize)) {
+ /*
+ * It seems directory listings either don't show the size or very
+ * often uses size 0 anyway.
+ * Example D above makes this parsing a little tricky
+ */
+ char *bytes;
+ bytes=strstr(buf, " bytes");
+ if(bytes--) {
+ int index=bytes-buf;
+ /* this is a hint there is size information in there! ;-) */
+ while(--index) {
+ /* scan for the parenthesis and break there */
+ if('(' == *bytes)
+ break;
+ /* if only skip digits, or else we're in deep trouble */
+ if(!isdigit((int)*bytes)) {
+ bytes=NULL;
+ break;
+ }
+ /* one more estep backwards */
+ bytes--;
+ }
+ /* only if we have nothing but digits: */
+ if(bytes++) {
+ /* get the number! */
+ size = atoi(bytes);
+ }
+
+ }
+#if 0
+ if(2 != sscanf(buf, "%*[^(](%d bytes%c", &size, &paren))
+ size=-1;
+#endif
+ }
+ else if(downloadsize > -1)
+ size = downloadsize;
+
+#if 0
+ if((size > -1) && (data->resume_from>0)) {
+ size -= data->resume_from;
+ if(size <= 0) {
+ failf(data, "Offset (%d) was beyond file size (%d)",
+ data->resume_from, data->resume_from+size);
+ return URG_PARTIAL_FILE;
+ }
+ }
+#endif
+
+ if(data->conf & CONF_FTPPORT) {
+ result = AllowServerConnect(data, portsock);
+ if( result )
+ return result;
+ }
+
+ infof(data, "Getting file with size: %d\n", size);
+
+ /* FTP download: */
+ result=Download(data, data->secondarysocket, size, FALSE,
+ bytecountp);
+ if(result)
+ return result;
+
+ if((-1 != size) && (size != *bytecountp)) {
+ failf(data, "Received only partial file");
+ return URG_PARTIAL_FILE;
+ }
+ else if(0 == *bytecountp) {
+ failf(data, "No data was received!");
+ return URG_FTP_COULDNT_RETR_FILE;
+ }
+ }
+ else {
+ failf(data, "%s", buf+4);
+ return URG_FTP_COULDNT_RETR_FILE;
+ }
+
+ }
+ /* end of transfer */
+ ProgressEnd(data);
+
+ /* shut down the socket to inform the server we're done */
+ sclose(data->secondarysocket);
+ data->secondarysocket = -1;
+
+ /* now let's see what the server says about the transfer we
+ just performed: */
+ nread = GetLastResponse(data->firstsocket, buf, data);
+
+ /* 226 Transfer complete */
+ if(strncmp(buf, "226", 3)) {
+ failf(data, "%s", buf+4);
+ return URG_FTP_WRITE_ERROR;
+ }
+
+ return URG_OK;
+}
+
+/* -- deal with the ftp server! -- */
+
+UrgError ftp(struct UrlData *data,
+ long *bytecountp,
+ char *ftpuser,
+ char *ftppasswd,
+ char *urlpath)
+{
+ char *realpath;
+ UrgError retcode;
+
+#if 0
+ realpath = URLfix(urlpath);
+#else
+ realpath = curl_unescape(urlpath);
+#endif
+ if(realpath) {
+ retcode = _ftp(data, bytecountp, ftpuser, ftppasswd, realpath);
+ free(realpath);
+ }
+ else
+ /* then we try the original path */
+ retcode = _ftp(data, bytecountp, ftpuser, ftppasswd, urlpath);
+
+ return retcode;
+}
+
diff --git a/lib/ftp.h b/lib/ftp.h
new file mode 100644
index 000000000..b7d265927
--- /dev/null
+++ b/lib/ftp.h
@@ -0,0 +1,52 @@
+#ifndef __FTP_H
+#define __FTP_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError ftp(struct UrlData *data,
+ long *bytecountp,
+ char *ftpuser,
+ char *ftppasswd,
+ char *ppath);
+
+struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
+void curl_slist_free_all(struct curl_slist *list);
+
+#endif
diff --git a/lib/getdate.c b/lib/getdate.c
new file mode 100644
index 000000000..e3342ff3a
--- /dev/null
+++ b/lib/getdate.c
@@ -0,0 +1,2101 @@
+
+/* A Bison parser, made from getdate.y
+ by GNU Bison version 1.27
+ */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+#define tAGO 257
+#define tDAY 258
+#define tDAY_UNIT 259
+#define tDAYZONE 260
+#define tDST 261
+#define tHOUR_UNIT 262
+#define tID 263
+#define tMERIDIAN 264
+#define tMINUTE_UNIT 265
+#define tMONTH 266
+#define tMONTH_UNIT 267
+#define tSEC_UNIT 268
+#define tSNUMBER 269
+#define tUNUMBER 270
+#define tYEAR_UNIT 271
+#define tZONE 272
+
+#line 1 "getdate.y"
+
+/*
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
+**
+** This code is in the public domain and has no copyright.
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# endif
+#endif
+
+/* Since the code of getdate.y is not included in the Emacs executable
+ itself, there is no need to #define static in this file. Even if
+ the code were included in the Emacs executable, it probably
+ wouldn't do any harm to #undef it here; this will only cause
+ problems if we try to write to a static variable, which I don't
+ think this code needs to do. */
+#ifdef emacs
+# undef static
+#endif
+
+#include <malloc.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_STDLIB_H
+# include <stdlib.h> /* for `free'; used by Bison 1.27 */
+#endif
+
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
+#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+
+/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
+ - Its arg may be any int or unsigned int; it need not be an unsigned char.
+ - It's guaranteed to evaluate its argument exactly once.
+ - It's typically faster.
+ Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
+ only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
+ it's important to use the locale's definition of `digit' even when the
+ host does not conform to Posix. */
+#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+
+#if defined (STDC_HEADERS) || defined (USG)
+# include <string.h>
+#endif
+
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+/* Some old versions of bison generate parsers that use bcopy.
+ That loses on systems that don't provide the function, so we have
+ to redefine it here. */
+#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
+# define bcopy(from, to, len) memcpy ((to), (from), (len))
+#endif
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in the same program. Note that these are only
+ the variables produced by yacc. If other parser generators (bison,
+ byacc, etc) produce additional global names that conflict at link time,
+ then those parser generators need to be fixed instead of adding those
+ names to this list. */
+
+#define yymaxdepth gd_maxdepth
+#define yyparse gd_parse
+#define yylex gd_lex
+#define yyerror gd_error
+#define yylval gd_lval
+#define yychar gd_char
+#define yydebug gd_debug
+#define yypact gd_pact
+#define yyr1 gd_r1
+#define yyr2 gd_r2
+#define yydef gd_def
+#define yychk gd_chk
+#define yypgo gd_pgo
+#define yyact gd_act
+#define yyexca gd_exca
+#define yyerrflag gd_errflag
+#define yynerrs gd_nerrs
+#define yyps gd_ps
+#define yypv gd_pv
+#define yys gd_s
+#define yy_yys gd_yys
+#define yystate gd_state
+#define yytmp gd_tmp
+#define yyv gd_v
+#define yy_yyv gd_yyv
+#define yyval gd_val
+#define yylloc gd_lloc
+#define yyreds gd_reds /* With YYDEBUG defined */
+#define yytoks gd_toks /* With YYDEBUG defined */
+#define yylhs gd_yylhs
+#define yylen gd_yylen
+#define yydefred gd_yydefred
+#define yydgoto gd_yydgoto
+#define yysindex gd_yysindex
+#define yyrindex gd_yyrindex
+#define yygindex gd_yygindex
+#define yytable gd_yytable
+#define yycheck gd_yycheck
+
+static int yylex ();
+static int yyerror ();
+
+#define EPOCH 1970
+#define HOUR(x) ((x) * 60)
+
+#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
+
+/*
+** An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+ const char *name;
+ int type;
+ int value;
+} TABLE;
+
+
+/*
+** Meridian: am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+ MERam, MERpm, MER24
+} MERIDIAN;
+
+
+/*
+** Global variables. We could get rid of most of these by using a good
+** union as the yacc stack. (This routine was originally written before
+** yacc had the %union construct.) Maybe someday; right now we only use
+** the %union very rarely.
+*/
+static const char *yyInput;
+static int yyDayOrdinal;
+static int yyDayNumber;
+static int yyHaveDate;
+static int yyHaveDay;
+static int yyHaveRel;
+static int yyHaveTime;
+static int yyHaveZone;
+static int yyTimezone;
+static int yyDay;
+static int yyHour;
+static int yyMinutes;
+static int yyMonth;
+static int yySeconds;
+static int yyYear;
+static MERIDIAN yyMeridian;
+static int yyRelDay;
+static int yyRelHour;
+static int yyRelMinutes;
+static int yyRelMonth;
+static int yyRelSeconds;
+static int yyRelYear;
+
+
+#line 184 "getdate.y"
+typedef union {
+ int Number;
+ enum _MERIDIAN Meridian;
+} YYSTYPE;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#ifndef const
+#define const
+#endif
+#endif
+#endif
+
+
+
+#define YYFINAL 61
+#define YYFLAG -32768
+#define YYNTBASE 22
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 32)
+
+static const char yytranslate[] = { 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 20, 2, 2, 21, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 19, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18
+};
+
+#if YYDEBUG != 0
+static const short yyprhs[] = { 0,
+ 0, 1, 4, 6, 8, 10, 12, 14, 16, 19,
+ 24, 29, 36, 43, 45, 47, 50, 52, 55, 58,
+ 62, 68, 72, 76, 79, 84, 87, 91, 94, 96,
+ 99, 102, 104, 107, 110, 112, 115, 118, 120, 123,
+ 126, 128, 131, 134, 136, 139, 142, 144, 146, 147
+};
+
+static const short yyrhs[] = { -1,
+ 22, 23, 0, 24, 0, 25, 0, 27, 0, 26,
+ 0, 28, 0, 30, 0, 16, 10, 0, 16, 19,
+ 16, 31, 0, 16, 19, 16, 15, 0, 16, 19,
+ 16, 19, 16, 31, 0, 16, 19, 16, 19, 16,
+ 15, 0, 18, 0, 6, 0, 18, 7, 0, 4,
+ 0, 4, 20, 0, 16, 4, 0, 16, 21, 16,
+ 0, 16, 21, 16, 21, 16, 0, 16, 15, 15,
+ 0, 16, 12, 15, 0, 12, 16, 0, 12, 16,
+ 20, 16, 0, 16, 12, 0, 16, 12, 16, 0,
+ 29, 3, 0, 29, 0, 16, 17, 0, 15, 17,
+ 0, 17, 0, 16, 13, 0, 15, 13, 0, 13,
+ 0, 16, 5, 0, 15, 5, 0, 5, 0, 16,
+ 8, 0, 15, 8, 0, 8, 0, 16, 11, 0,
+ 15, 11, 0, 11, 0, 16, 14, 0, 15, 14,
+ 0, 14, 0, 16, 0, 0, 10, 0
+};
+
+#endif
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+ 200, 201, 204, 207, 210, 213, 216, 219, 222, 228,
+ 234, 243, 249, 261, 264, 267, 273, 277, 281, 287,
+ 291, 309, 315, 321, 325, 330, 334, 341, 349, 352,
+ 355, 358, 361, 364, 367, 370, 373, 376, 379, 382,
+ 385, 388, 391, 394, 397, 400, 403, 408, 441, 445
+};
+#endif
+
+
+#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
+
+static const char * const yytname[] = { "$","error","$undefined.","tAGO","tDAY",
+"tDAY_UNIT","tDAYZONE","tDST","tHOUR_UNIT","tID","tMERIDIAN","tMINUTE_UNIT",
+"tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tYEAR_UNIT","tZONE",
+"':'","','","'/'","spec","item","time","zone","day","date","rel","relunit","number",
+"o_merid", NULL
+};
+#endif
+
+static const short yyr1[] = { 0,
+ 22, 22, 23, 23, 23, 23, 23, 23, 24, 24,
+ 24, 24, 24, 25, 25, 25, 26, 26, 26, 27,
+ 27, 27, 27, 27, 27, 27, 27, 28, 28, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 30, 31, 31
+};
+
+static const short yyr2[] = { 0,
+ 0, 2, 1, 1, 1, 1, 1, 1, 2, 4,
+ 4, 6, 6, 1, 1, 2, 1, 2, 2, 3,
+ 5, 3, 3, 2, 4, 2, 3, 2, 1, 2,
+ 2, 1, 2, 2, 1, 2, 2, 1, 2, 2,
+ 1, 2, 2, 1, 2, 2, 1, 1, 0, 1
+};
+
+static const short yydefact[] = { 1,
+ 0, 17, 38, 15, 41, 44, 0, 35, 47, 0,
+ 48, 32, 14, 2, 3, 4, 6, 5, 7, 29,
+ 8, 18, 24, 37, 40, 43, 34, 46, 31, 19,
+ 36, 39, 9, 42, 26, 33, 45, 0, 30, 0,
+ 0, 16, 28, 0, 23, 27, 22, 49, 20, 25,
+ 50, 11, 0, 10, 0, 49, 21, 13, 12, 0,
+ 0
+};
+
+static const short yydefgoto[] = { 1,
+ 14, 15, 16, 17, 18, 19, 20, 21, 54
+};
+
+static const short yypact[] = {-32768,
+ 0, -19,-32768,-32768,-32768,-32768, -13,-32768,-32768, 30,
+ 15,-32768, 14,-32768,-32768,-32768,-32768,-32768,-32768, 19,
+-32768,-32768, 4,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768, -6,-32768,-32768, 16,-32768, 17,
+ 23,-32768,-32768, 24,-32768,-32768,-32768, 27, 28,-32768,
+-32768,-32768, 29,-32768, 32, -8,-32768,-32768,-32768, 50,
+-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -5
+};
+
+
+#define YYLAST 51
+
+
+static const short yytable[] = { 60,
+ 22, 51, 23, 2, 3, 4, 58, 5, 45, 46,
+ 6, 7, 8, 9, 10, 11, 12, 13, 30, 31,
+ 42, 43, 32, 44, 33, 34, 35, 36, 37, 38,
+ 47, 39, 48, 40, 24, 41, 51, 25, 49, 50,
+ 26, 52, 27, 28, 56, 53, 29, 57, 55, 61,
+ 59
+};
+
+static const short yycheck[] = { 0,
+ 20, 10, 16, 4, 5, 6, 15, 8, 15, 16,
+ 11, 12, 13, 14, 15, 16, 17, 18, 4, 5,
+ 7, 3, 8, 20, 10, 11, 12, 13, 14, 15,
+ 15, 17, 16, 19, 5, 21, 10, 8, 16, 16,
+ 11, 15, 13, 14, 16, 19, 17, 16, 21, 0,
+ 56
+};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/boot/apps/GeekGadgets/share/bison.simple"
+/* This file comes from bison-1.27. */
+
+/* Skeleton output parser for bison,
+ Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+
+ This program 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, or (at your option)
+ any later version.
+
+ This program 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 this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
+#ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#else /* not GNU C. */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
+#include <alloca.h>
+#else /* not sparc */
+/* We think this test detects Watcom and Microsoft C. */
+/* This used to test MSDOS, but that is a bad idea
+ since that symbol is in the user namespace. */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+ instead, just don't use alloca. */
+#include <malloc.h>
+#endif
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+/* I don't know what this was needed for, but it pollutes the namespace.
+ So I turned it off. rms, 2 May 1997. */
+/* #include <malloc.h> */
+ #pragma alloca
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+ and on HPUX 10. Eventually we can turn this on. */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#endif /* __hpux */
+#endif
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
+
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
+
+/* Note: there must be only one dollar sign in this file.
+ It is replaced by the list of actions, each action
+ as one case of the switch. */
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+ This remains here temporarily to ease the
+ transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+#define YYFAIL goto yyerrlab
+#define YYRECOVERING() (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { yychar = (token), yylval = (value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { yyerror ("syntax error: cannot back up"); YYERROR; } \
+while (0)
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+#ifndef YYPURE
+#define YYLEX yylex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#ifdef YYLEX_PARAM
+#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
+#else
+#define YYLEX yylex(&yylval, &yylloc)
+#endif
+#else /* not YYLSP_NEEDED */
+#ifdef YYLEX_PARAM
+#define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+#define YYLEX yylex(&yylval)
+#endif
+#endif /* not YYLSP_NEEDED */
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int yychar; /* the lookahead symbol */
+YYSTYPE yylval; /* the semantic value of the */
+ /* lookahead symbol */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc; /* location data for the lookahead */
+ /* symbol */
+#endif
+
+int yynerrs; /* number of parse errors so far */
+#endif /* not YYPURE */
+
+#if YYDEBUG != 0
+int yydebug; /* nonzero means print parse trace */
+/* Since this is uninitialized, it does not stop multiple parsers
+ from coexisting. */
+#endif
+
+/* YYINITDEPTH indicates the initial size of the parser's stacks */
+
+#ifndef YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH is the maximum size the stacks can grow to
+ (effective only if the built-in stack extension method is used). */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+
+/* Define __yy_memcpy. Note that the size argument
+ should be passed with type unsigned int, because that is what the non-GCC
+ definitions require. With GCC, __builtin_memcpy takes an arg
+ of type size_t, but it can handle unsigned int. */
+
+#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
+#else /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_memcpy (to, from, count)
+ char *to;
+ char *from;
+ unsigned int count;
+{
+ register char *f = from;
+ register char *t = to;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+__yy_memcpy (char *to, char *from, unsigned int count)
+{
+ register char *t = to;
+ register char *f = from;
+ register int i = count;
+
+ while (i-- > 0)
+ *t++ = *f++;
+}
+
+#endif
+#endif
+
+#line 216 "/boot/apps/GeekGadgets/share/bison.simple"
+
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
+
+#ifdef YYPARSE_PARAM
+#ifdef __cplusplus
+#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL
+#else /* not __cplusplus */
+#define YYPARSE_PARAM_ARG YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+#endif /* not __cplusplus */
+#else /* not YYPARSE_PARAM */
+#define YYPARSE_PARAM_ARG
+#define YYPARSE_PARAM_DECL
+#endif /* not YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
+int
+yyparse(YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
+{
+ register int yystate;
+ register int yyn;
+ register short *yyssp;
+ register YYSTYPE *yyvsp;
+ int yyerrstatus; /* number of tokens to shift before error messages enabled */
+ int yychar1 = 0; /* lookahead token as an internal (translated) token number */
+
+ short yyssa[YYINITDEPTH]; /* the state stack */
+ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
+
+ short *yyss = yyssa; /* refer to the stacks thru separate pointers */
+ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
+
+#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK (yyvsp--, yyssp--)
+#endif
+
+ int yystacksize = YYINITDEPTH;
+ int yyfree_stacks = 0;
+
+#ifdef YYPURE
+ int yychar;
+ YYSTYPE yylval;
+ int yynerrs;
+#ifdef YYLSP_NEEDED
+ YYLTYPE yylloc;
+#endif
+#endif
+
+ YYSTYPE yyval; /* the variable used to return */
+ /* semantic values from the action */
+ /* routines */
+
+ int yylen;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Starting parse\n");
+#endif
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss - 1;
+ yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in yystate . */
+/* In all cases, when you get here, the value and location stacks
+ have just been pushed. so pushing a state here evens the stacks. */
+yynewstate:
+
+ *++yyssp = yystate;
+
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ /* Give user a chance to reallocate the stack */
+ /* Use copies of these so that the &'s don't force the real ones into memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+#endif
+
+ /* Get the current used size of the three stacks, in elements. */
+ int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ /* Each stack pointer address is followed by the size of
+ the data in use in that stack, in bytes. */
+#ifdef YYLSP_NEEDED
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yyls1, size * sizeof (*yylsp),
+ &yystacksize);
+#else
+ yyoverflow("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yystacksize);
+#endif
+
+ yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+ yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+ /* Extend the stack our own way. */
+ if (yystacksize >= YYMAXDEPTH)
+ {
+ yyerror("parser stack overflow");
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
+ return 2;
+ }
+ yystacksize *= 2;
+ if (yystacksize > YYMAXDEPTH)
+ yystacksize = YYMAXDEPTH;
+#ifndef YYSTACK_USE_ALLOCA
+ yyfree_stacks = 1;
+#endif
+ yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
+ __yy_memcpy ((char *)yyss, (char *)yyss1,
+ size * (unsigned int) sizeof (*yyssp));
+ yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
+ __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+ size * (unsigned int) sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+ yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+ __yy_memcpy ((char *)yyls, (char *)yyls1,
+ size * (unsigned int) sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + size - 1;
+ yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+ yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+ if (yyssp >= yyss + yystacksize - 1)
+ YYABORT;
+ }
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+ goto yybackup;
+ yybackup:
+
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
+
+ /* First try to decide what to do without reference to lookahead token. */
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
+ if (yychar == YYEMPTY)
+ {
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Reading a token: ");
+#endif
+ yychar = YYLEX;
+ }
+
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
+ {
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Now at end of input.\n");
+#endif
+ }
+ else
+ {
+ yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+ /* Give the individual parser a way to print the precise meaning
+ of a token, for further debugging info. */
+#ifdef YYPRINT
+ YYPRINT (stderr, yychar, yylval);
+#endif
+ fprintf (stderr, ")\n");
+ }
+#endif
+ }
+
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+ goto yydefault;
+
+ yyn = yytable[yyn];
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrlab;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Shift the lookahead token. */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* count tokens shifted since error; after three, turn off error status. */
+ if (yyerrstatus) yyerrstatus--;
+
+ yystate = yyn;
+ goto yynewstate;
+
+/* Do the default action for the current state. */
+yydefault:
+
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+
+/* Do a reduction. yyn is the number of a rule to reduce with. */
+yyreduce:
+ yylen = yyr2[yyn];
+ if (yylen > 0)
+ yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ int i;
+
+ fprintf (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+ fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+ fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
+
+
+ switch (yyn) {
+
+case 3:
+#line 204 "getdate.y"
+{
+ yyHaveTime++;
+ ;
+ break;}
+case 4:
+#line 207 "getdate.y"
+{
+ yyHaveZone++;
+ ;
+ break;}
+case 5:
+#line 210 "getdate.y"
+{
+ yyHaveDate++;
+ ;
+ break;}
+case 6:
+#line 213 "getdate.y"
+{
+ yyHaveDay++;
+ ;
+ break;}
+case 7:
+#line 216 "getdate.y"
+{
+ yyHaveRel++;
+ ;
+ break;}
+case 9:
+#line 222 "getdate.y"
+{
+ yyHour = yyvsp[-1].Number;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 10:
+#line 228 "getdate.y"
+{
+ yyHour = yyvsp[-3].Number;
+ yyMinutes = yyvsp[-1].Number;
+ yySeconds = 0;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 11:
+#line 234 "getdate.y"
+{
+ yyHour = yyvsp[-3].Number;
+ yyMinutes = yyvsp[-1].Number;
+ yyMeridian = MER24;
+ yyHaveZone++;
+ yyTimezone = (yyvsp[0].Number < 0
+ ? -yyvsp[0].Number % 100 + (-yyvsp[0].Number / 100) * 60
+ : - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60));
+ ;
+ break;}
+case 12:
+#line 243 "getdate.y"
+{
+ yyHour = yyvsp[-5].Number;
+ yyMinutes = yyvsp[-3].Number;
+ yySeconds = yyvsp[-1].Number;
+ yyMeridian = yyvsp[0].Meridian;
+ ;
+ break;}
+case 13:
+#line 249 "getdate.y"
+{
+ yyHour = yyvsp[-5].Number;
+ yyMinutes = yyvsp[-3].Number;
+ yySeconds = yyvsp[-1].Number;
+ yyMeridian = MER24;
+ yyHaveZone++;
+ yyTimezone = (yyvsp[0].Number < 0
+ ? -yyvsp[0].Number % 100 + (-yyvsp[0].Number / 100) * 60
+ : - (yyvsp[0].Number % 100 + (yyvsp[0].Number / 100) * 60));
+ ;
+ break;}
+case 14:
+#line 261 "getdate.y"
+{
+ yyTimezone = yyvsp[0].Number;
+ ;
+ break;}
+case 15:
+#line 264 "getdate.y"
+{
+ yyTimezone = yyvsp[0].Number - 60;
+ ;
+ break;}
+case 16:
+#line 268 "getdate.y"
+{
+ yyTimezone = yyvsp[-1].Number - 60;
+ ;
+ break;}
+case 17:
+#line 273 "getdate.y"
+{
+ yyDayOrdinal = 1;
+ yyDayNumber = yyvsp[0].Number;
+ ;
+ break;}
+case 18:
+#line 277 "getdate.y"
+{
+ yyDayOrdinal = 1;
+ yyDayNumber = yyvsp[-1].Number;
+ ;
+ break;}
+case 19:
+#line 281 "getdate.y"
+{
+ yyDayOrdinal = yyvsp[-1].Number;
+ yyDayNumber = yyvsp[0].Number;
+ ;
+ break;}
+case 20:
+#line 287 "getdate.y"
+{
+ yyMonth = yyvsp[-2].Number;
+ yyDay = yyvsp[0].Number;
+ ;
+ break;}
+case 21:
+#line 291 "getdate.y"
+{
+ /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
+ The goal in recognizing YYYY/MM/DD is solely to support legacy
+ machine-generated dates like those in an RCS log listing. If
+ you want portability, use the ISO 8601 format. */
+ if (yyvsp[-4].Number >= 1000)
+ {
+ yyYear = yyvsp[-4].Number;
+ yyMonth = yyvsp[-2].Number;
+ yyDay = yyvsp[0].Number;
+ }
+ else
+ {
+ yyMonth = yyvsp[-4].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ }
+ ;
+ break;}
+case 22:
+#line 309 "getdate.y"
+{
+ /* ISO 8601 format. yyyy-mm-dd. */
+ yyYear = yyvsp[-2].Number;
+ yyMonth = -yyvsp[-1].Number;
+ yyDay = -yyvsp[0].Number;
+ ;
+ break;}
+case 23:
+#line 315 "getdate.y"
+{
+ /* e.g. 17-JUN-1992. */
+ yyDay = yyvsp[-2].Number;
+ yyMonth = yyvsp[-1].Number;
+ yyYear = -yyvsp[0].Number;
+ ;
+ break;}
+case 24:
+#line 321 "getdate.y"
+{
+ yyMonth = yyvsp[-1].Number;
+ yyDay = yyvsp[0].Number;
+ ;
+ break;}
+case 25:
+#line 325 "getdate.y"
+{
+ yyMonth = yyvsp[-3].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ ;
+ break;}
+case 26:
+#line 330 "getdate.y"
+{
+ yyMonth = yyvsp[0].Number;
+ yyDay = yyvsp[-1].Number;
+ ;
+ break;}
+case 27:
+#line 334 "getdate.y"
+{
+ yyMonth = yyvsp[-1].Number;
+ yyDay = yyvsp[-2].Number;
+ yyYear = yyvsp[0].Number;
+ ;
+ break;}
+case 28:
+#line 341 "getdate.y"
+{
+ yyRelSeconds = -yyRelSeconds;
+ yyRelMinutes = -yyRelMinutes;
+ yyRelHour = -yyRelHour;
+ yyRelDay = -yyRelDay;
+ yyRelMonth = -yyRelMonth;
+ yyRelYear = -yyRelYear;
+ ;
+ break;}
+case 30:
+#line 352 "getdate.y"
+{
+ yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 31:
+#line 355 "getdate.y"
+{
+ yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 32:
+#line 358 "getdate.y"
+{
+ yyRelYear += yyvsp[0].Number;
+ ;
+ break;}
+case 33:
+#line 361 "getdate.y"
+{
+ yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 34:
+#line 364 "getdate.y"
+{
+ yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 35:
+#line 367 "getdate.y"
+{
+ yyRelMonth += yyvsp[0].Number;
+ ;
+ break;}
+case 36:
+#line 370 "getdate.y"
+{
+ yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 37:
+#line 373 "getdate.y"
+{
+ yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 38:
+#line 376 "getdate.y"
+{
+ yyRelDay += yyvsp[0].Number;
+ ;
+ break;}
+case 39:
+#line 379 "getdate.y"
+{
+ yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 40:
+#line 382 "getdate.y"
+{
+ yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 41:
+#line 385 "getdate.y"
+{
+ yyRelHour += yyvsp[0].Number;
+ ;
+ break;}
+case 42:
+#line 388 "getdate.y"
+{
+ yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 43:
+#line 391 "getdate.y"
+{
+ yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 44:
+#line 394 "getdate.y"
+{
+ yyRelMinutes += yyvsp[0].Number;
+ ;
+ break;}
+case 45:
+#line 397 "getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 46:
+#line 400 "getdate.y"
+{
+ yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
+ ;
+ break;}
+case 47:
+#line 403 "getdate.y"
+{
+ yyRelSeconds += yyvsp[0].Number;
+ ;
+ break;}
+case 48:
+#line 409 "getdate.y"
+{
+ if (yyHaveTime && yyHaveDate && !yyHaveRel)
+ yyYear = yyvsp[0].Number;
+ else
+ {
+ if (yyvsp[0].Number>10000)
+ {
+ yyHaveDate++;
+ yyDay= (yyvsp[0].Number)%100;
+ yyMonth= (yyvsp[0].Number/100)%100;
+ yyYear = yyvsp[0].Number/10000;
+ }
+ else
+ {
+ yyHaveTime++;
+ if (yyvsp[0].Number < 100)
+ {
+ yyHour = yyvsp[0].Number;
+ yyMinutes = 0;
+ }
+ else
+ {
+ yyHour = yyvsp[0].Number / 100;
+ yyMinutes = yyvsp[0].Number % 100;
+ }
+ yySeconds = 0;
+ yyMeridian = MER24;
+ }
+ }
+ ;
+ break;}
+case 49:
+#line 442 "getdate.y"
+{
+ yyval.Meridian = MER24;
+ ;
+ break;}
+case 50:
+#line 446 "getdate.y"
+{
+ yyval.Meridian = yyvsp[0].Meridian;
+ ;
+ break;}
+}
+ /* the action file gets copied in in place of this dollarsign */
+#line 542 "/boot/apps/GeekGadgets/share/bison.simple"
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+ yylsp++;
+ if (yylen == 0)
+ {
+ yylsp->first_line = yylloc.first_line;
+ yylsp->first_column = yylloc.first_column;
+ yylsp->last_line = (yylsp-1)->last_line;
+ yylsp->last_column = (yylsp-1)->last_column;
+ yylsp->text = 0;
+ }
+ else
+ {
+ yylsp->last_line = (yylsp+yylen-1)->last_line;
+ yylsp->last_column = (yylsp+yylen-1)->last_column;
+ }
+#endif
+
+ /* Now "shift" the result of the reduction.
+ Determine what state that goes to,
+ based on the state we popped back to
+ and the rule number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTBASE];
+
+ goto yynewstate;
+
+yyerrlab: /* here on detecting error */
+
+ if (! yyerrstatus)
+ /* If not already recovering from an error, report this error. */
+ {
+ ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ int size = 0;
+ char *msg;
+ int x, count;
+
+ count = 0;
+ /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
+ for (x = (yyn < 0 ? -yyn : 0);
+ x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ size += strlen(yytname[x]) + 15, count++;
+ msg = (char *) malloc(size + 15);
+ if (msg != 0)
+ {
+ strcpy(msg, "parse error");
+
+ if (count < 5)
+ {
+ count = 0;
+ for (x = (yyn < 0 ? -yyn : 0);
+ x < (sizeof(yytname) / sizeof(char *)); x++)
+ if (yycheck[x + yyn] == x)
+ {
+ strcat(msg, count == 0 ? ", expecting `" : " or `");
+ strcat(msg, yytname[x]);
+ strcat(msg, "'");
+ count++;
+ }
+ }
+ yyerror(msg);
+ free(msg);
+ }
+ else
+ yyerror ("parse error; also virtual memory exceeded");
+ }
+ else
+#endif /* YYERROR_VERBOSE */
+ yyerror("parse error");
+ }
+
+ goto yyerrlab1;
+yyerrlab1: /* here on error raised explicitly by an action */
+
+ if (yyerrstatus == 3)
+ {
+ /* if just tried and failed to reuse lookahead token after an error, discard it. */
+
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+ yychar = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token
+ after shifting the error token. */
+
+ yyerrstatus = 3; /* Each real token shifted decrements this */
+
+ goto yyerrhandle;
+
+yyerrdefault: /* current state does not do anything special for the error token. */
+
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
+ if (yyn) goto yydefault;
+#endif
+
+yyerrpop: /* pop the current state because it cannot handle the error token */
+
+ if (yyssp == yyss) YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+ yylsp--;
+#endif
+
+#if YYDEBUG != 0
+ if (yydebug)
+ {
+ short *ssp1 = yyss - 1;
+ fprintf (stderr, "Error: state stack now");
+ while (ssp1 != yyssp)
+ fprintf (stderr, " %d", *++ssp1);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+yyerrhandle:
+
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
+
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+ else if (yyn == 0)
+ goto yyerrpop;
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+#if YYDEBUG != 0
+ if (yydebug)
+ fprintf(stderr, "Shifting error token, ");
+#endif
+
+ *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ yystate = yyn;
+ goto yynewstate;
+
+ yyacceptlab:
+ /* YYACCEPT comes here. */
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
+ return 0;
+
+ yyabortlab:
+ /* YYABORT comes here. */
+ if (yyfree_stacks)
+ {
+ free (yyss);
+ free (yyvs);
+#ifdef YYLSP_NEEDED
+ free (yyls);
+#endif
+ }
+ return 1;
+}
+#line 451 "getdate.y"
+
+
+/* Include this file down here because bison inserts code above which
+ may define-away `const'. We want the prototype for get_date to have
+ the same signature as the function definition does. */
+#include "getdate.h"
+
+extern struct tm *gmtime ();
+extern struct tm *localtime ();
+extern time_t mktime ();
+
+/* Month and day table. */
+static TABLE const MonthDayTable[] = {
+ { "january", tMONTH, 1 },
+ { "february", tMONTH, 2 },
+ { "march", tMONTH, 3 },
+ { "april", tMONTH, 4 },
+ { "may", tMONTH, 5 },
+ { "june", tMONTH, 6 },
+ { "july", tMONTH, 7 },
+ { "august", tMONTH, 8 },
+ { "september", tMONTH, 9 },
+ { "sept", tMONTH, 9 },
+ { "october", tMONTH, 10 },
+ { "november", tMONTH, 11 },
+ { "december", tMONTH, 12 },
+ { "sunday", tDAY, 0 },
+ { "monday", tDAY, 1 },
+ { "tuesday", tDAY, 2 },
+ { "tues", tDAY, 2 },
+ { "wednesday", tDAY, 3 },
+ { "wednes", tDAY, 3 },
+ { "thursday", tDAY, 4 },
+ { "thur", tDAY, 4 },
+ { "thurs", tDAY, 4 },
+ { "friday", tDAY, 5 },
+ { "saturday", tDAY, 6 },
+ { NULL, 0, 0 }
+};
+
+/* Time units table. */
+static TABLE const UnitsTable[] = {
+ { "year", tYEAR_UNIT, 1 },
+ { "month", tMONTH_UNIT, 1 },
+ { "fortnight", tDAY_UNIT, 14 },
+ { "week", tDAY_UNIT, 7 },
+ { "day", tDAY_UNIT, 1 },
+ { "hour", tHOUR_UNIT, 1 },
+ { "minute", tMINUTE_UNIT, 1 },
+ { "min", tMINUTE_UNIT, 1 },
+ { "second", tSEC_UNIT, 1 },
+ { "sec", tSEC_UNIT, 1 },
+ { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words. */
+static TABLE const OtherTable[] = {
+ { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 },
+ { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 },
+ { "today", tMINUTE_UNIT, 0 },
+ { "now", tMINUTE_UNIT, 0 },
+ { "last", tUNUMBER, -1 },
+ { "this", tMINUTE_UNIT, 0 },
+ { "next", tUNUMBER, 1 },
+ { "first", tUNUMBER, 1 },
+/* { "second", tUNUMBER, 2 }, */
+ { "third", tUNUMBER, 3 },
+ { "fourth", tUNUMBER, 4 },
+ { "fifth", tUNUMBER, 5 },
+ { "sixth", tUNUMBER, 6 },
+ { "seventh", tUNUMBER, 7 },
+ { "eighth", tUNUMBER, 8 },
+ { "ninth", tUNUMBER, 9 },
+ { "tenth", tUNUMBER, 10 },
+ { "eleventh", tUNUMBER, 11 },
+ { "twelfth", tUNUMBER, 12 },
+ { "ago", tAGO, 1 },
+ { NULL, 0, 0 }
+};
+
+/* The timezone table. */
+static TABLE const TimezoneTable[] = {
+ { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
+ { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
+ { "utc", tZONE, HOUR ( 0) },
+ { "wet", tZONE, HOUR ( 0) }, /* Western European */
+ { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
+ { "wat", tZONE, HOUR ( 1) }, /* West Africa */
+ { "at", tZONE, HOUR ( 2) }, /* Azores */
+#if 0
+ /* For completeness. BST is also British Summer, and GST is
+ * also Guam Standard. */
+ { "bst", tZONE, HOUR ( 3) }, /* Brazil Standard */
+ { "gst", tZONE, HOUR ( 3) }, /* Greenland Standard */
+#endif
+#if 0
+ { "nft", tZONE, HOUR (3.5) }, /* Newfoundland */
+ { "nst", tZONE, HOUR (3.5) }, /* Newfoundland Standard */
+ { "ndt", tDAYZONE, HOUR (3.5) }, /* Newfoundland Daylight */
+#endif
+ { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
+ { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
+ { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
+ { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
+ { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
+ { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
+ { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
+ { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
+ { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
+ { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
+ { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
+ { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
+ { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
+ { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
+ { "cat", tZONE, HOUR (10) }, /* Central Alaska */
+ { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
+ { "nt", tZONE, HOUR (11) }, /* Nome */
+ { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
+ { "cet", tZONE, -HOUR (1) }, /* Central European */
+ { "met", tZONE, -HOUR (1) }, /* Middle European */
+ { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
+ { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
+ { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
+ { "fwt", tZONE, -HOUR (1) }, /* French Winter */
+ { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
+ { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
+ { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
+#if 0
+ { "it", tZONE, -HOUR (3.5) },/* Iran */
+#endif
+ { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
+ { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
+#if 0
+ { "ist", tZONE, -HOUR (5.5) },/* Indian Standard */
+#endif
+ { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
+#if 0
+ /* For completeness. NST is also Newfoundland Standard, and SST is
+ * also Swedish Summer. */
+ { "nst", tZONE, -HOUR (6.5) },/* North Sumatra */
+ { "sst", tZONE, -HOUR (7) }, /* South Sumatra, USSR Zone 6 */
+#endif /* 0 */
+ { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
+ { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
+#if 0
+ { "jt", tZONE, -HOUR (7.5) },/* Java (3pm in Cronusland!) */
+#endif
+ { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
+ { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
+#if 0
+ { "cast", tZONE, -HOUR (9.5) },/* Central Australian Standard */
+ { "cadt", tDAYZONE, -HOUR (9.5) },/* Central Australian Daylight */
+#endif
+ { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
+ { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
+ { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
+ { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
+ { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
+ { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
+ { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
+ { NULL, 0, 0 }
+};
+
+/* Military timezone table. */
+static TABLE const MilitaryTable[] = {
+ { "a", tZONE, HOUR ( 1) },
+ { "b", tZONE, HOUR ( 2) },
+ { "c", tZONE, HOUR ( 3) },
+ { "d", tZONE, HOUR ( 4) },
+ { "e", tZONE, HOUR ( 5) },
+ { "f", tZONE, HOUR ( 6) },
+ { "g", tZONE, HOUR ( 7) },
+ { "h", tZONE, HOUR ( 8) },
+ { "i", tZONE, HOUR ( 9) },
+ { "k", tZONE, HOUR ( 10) },
+ { "l", tZONE, HOUR ( 11) },
+ { "m", tZONE, HOUR ( 12) },
+ { "n", tZONE, HOUR (- 1) },
+ { "o", tZONE, HOUR (- 2) },
+ { "p", tZONE, HOUR (- 3) },
+ { "q", tZONE, HOUR (- 4) },
+ { "r", tZONE, HOUR (- 5) },
+ { "s", tZONE, HOUR (- 6) },
+ { "t", tZONE, HOUR (- 7) },
+ { "u", tZONE, HOUR (- 8) },
+ { "v", tZONE, HOUR (- 9) },
+ { "w", tZONE, HOUR (-10) },
+ { "x", tZONE, HOUR (-11) },
+ { "y", tZONE, HOUR (-12) },
+ { "z", tZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
+
+
+
+/* ARGSUSED */
+static int
+yyerror (s)
+ char *s ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
+static int
+ToHour (Hours, Meridian)
+ int Hours;
+ MERIDIAN Meridian;
+{
+ switch (Meridian)
+ {
+ case MER24:
+ if (Hours < 0 || Hours > 23)
+ return -1;
+ return Hours;
+ case MERam:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours;
+ case MERpm:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours + 12;
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
+static int
+ToYear (Year)
+ int Year;
+{
+ if (Year < 0)
+ Year = -Year;
+
+ /* XPG4 suggests that years 00-68 map to 2000-2068, and
+ years 69-99 map to 1969-1999. */
+ if (Year < 69)
+ Year += 2000;
+ else if (Year < 100)
+ Year += 1900;
+
+ return Year;
+}
+
+static int
+LookupWord (buff)
+ char *buff;
+{
+ register char *p;
+ register char *q;
+ register const TABLE *tp;
+ int i;
+ int abbrev;
+
+ /* Make it lowercase. */
+ for (p = buff; *p; p++)
+ if (ISUPPER ((unsigned char) *p))
+ *p = tolower (*p);
+
+ if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
+ {
+ yylval.Meridian = MERam;
+ return tMERIDIAN;
+ }
+ if (strcmp (buff, "pm") == 0 || strcmp (buff, "p.m.") == 0)
+ {
+ yylval.Meridian = MERpm;
+ return tMERIDIAN;
+ }
+
+ /* See if we have an abbreviation for a month. */
+ if (strlen (buff) == 3)
+ abbrev = 1;
+ else if (strlen (buff) == 4 && buff[3] == '.')
+ {
+ abbrev = 1;
+ buff[3] = '\0';
+ }
+ else
+ abbrev = 0;
+
+ for (tp = MonthDayTable; tp->name; tp++)
+ {
+ if (abbrev)
+ {
+ if (strncmp (buff, tp->name, 3) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+ else if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ if (strcmp (buff, "dst") == 0)
+ return tDST;
+
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Strip off any plural and try the units table again. */
+ i = strlen (buff) - 1;
+ if (buff[i] == 's')
+ {
+ buff[i] = '\0';
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ buff[i] = 's'; /* Put back for "this" in OtherTable. */
+ }
+
+ for (tp = OtherTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Military timezones. */
+ if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
+ {
+ for (tp = MilitaryTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ /* Drop out any periods and try the timezone table again. */
+ for (i = 0, p = q = buff; *q; q++)
+ if (*q != '.')
+ *p++ = *q;
+ else
+ i++;
+ *p = '\0';
+ if (i)
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ return tID;
+}
+
+static int
+yylex ()
+{
+ register unsigned char c;
+ register char *p;
+ char buff[20];
+ int Count;
+ int sign;
+
+ for (;;)
+ {
+ while (ISSPACE ((unsigned char) *yyInput))
+ yyInput++;
+
+ if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
+ {
+ if (c == '-' || c == '+')
+ {
+ sign = c == '-' ? -1 : 1;
+ if (!ISDIGIT (*++yyInput))
+ /* skip the '-' sign */
+ continue;
+ }
+ else
+ sign = 0;
+ for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
+ yylval.Number = 10 * yylval.Number + c - '0';
+ yyInput--;
+ if (sign < 0)
+ yylval.Number = -yylval.Number;
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+ if (ISALPHA (c))
+ {
+ for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
+ if (p < &buff[sizeof buff - 1])
+ *p++ = c;
+ *p = '\0';
+ yyInput--;
+ return LookupWord (buff);
+ }
+ if (c != '(')
+ return *yyInput++;
+ Count = 0;
+ do
+ {
+ c = *yyInput++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ Count++;
+ else if (c == ')')
+ Count--;
+ }
+ while (Count > 0);
+ }
+}
+
+#define TM_YEAR_ORIGIN 1900
+
+/* Yield A - B, measured in seconds. */
+static long
+difftm (struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ long days = (
+ /* difference in day of year */
+ a->tm_yday - b->tm_yday
+ /* + intervening leap days */
+ + ((ay >> 2) - (by >> 2))
+ - (ay / 100 - by / 100)
+ + ((ay / 100 >> 2) - (by / 100 >> 2))
+ /* + difference in years * 365 */
+ + (long) (ay - by) * 365
+ );
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+
+time_t
+get_date (const char *p, const time_t *now)
+{
+ struct tm tm, tm0, *tmp;
+ time_t Start;
+
+ yyInput = p;
+ Start = now ? *now : time ((time_t *) NULL);
+ tmp = localtime (&Start);
+ if (!tmp)
+ return -1;
+ yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
+ yyMonth = tmp->tm_mon + 1;
+ yyDay = tmp->tm_mday;
+ yyHour = tmp->tm_hour;
+ yyMinutes = tmp->tm_min;
+ yySeconds = tmp->tm_sec;
+ tm.tm_isdst = tmp->tm_isdst;
+ yyMeridian = MER24;
+ yyRelSeconds = 0;
+ yyRelMinutes = 0;
+ yyRelHour = 0;
+ yyRelDay = 0;
+ yyRelMonth = 0;
+ yyRelYear = 0;
+ yyHaveDate = 0;
+ yyHaveDay = 0;
+ yyHaveRel = 0;
+ yyHaveTime = 0;
+ yyHaveZone = 0;
+
+ if (yyparse ()
+ || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
+ return -1;
+
+ tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear;
+ tm.tm_mon = yyMonth - 1 + yyRelMonth;
+ tm.tm_mday = yyDay + yyRelDay;
+ if (yyHaveTime || (yyHaveRel && !yyHaveDate && !yyHaveDay))
+ {
+ tm.tm_hour = ToHour (yyHour, yyMeridian);
+ if (tm.tm_hour < 0)
+ return -1;
+ tm.tm_min = yyMinutes;
+ tm.tm_sec = yySeconds;
+ }
+ else
+ {
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+ }
+ tm.tm_hour += yyRelHour;
+ tm.tm_min += yyRelMinutes;
+ tm.tm_sec += yyRelSeconds;
+
+ /* Let mktime deduce tm_isdst if we have an absolute timestamp,
+ or if the relative timestamp mentions days, months, or years. */
+ if (yyHaveDate | yyHaveDay | yyHaveTime | yyRelDay | yyRelMonth | yyRelYear)
+ tm.tm_isdst = -1;
+
+ tm0 = tm;
+
+ Start = mktime (&tm);
+
+ if (Start == (time_t) -1)
+ {
+
+ /* Guard against falsely reporting errors near the time_t boundaries
+ when parsing times in other time zones. For example, if the min
+ time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
+ of UTC, then the min localtime value is 1970-01-01 08:00:00; if
+ we apply mktime to 1970-01-01 00:00:00 we will get an error, so
+ we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
+ zone by 24 hours to compensate. This algorithm assumes that
+ there is no DST transition within a day of the time_t boundaries. */
+ if (yyHaveZone)
+ {
+ tm = tm0;
+ if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
+ {
+ tm.tm_mday++;
+ yyTimezone -= 24 * 60;
+ }
+ else
+ {
+ tm.tm_mday--;
+ yyTimezone += 24 * 60;
+ }
+ Start = mktime (&tm);
+ }
+
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (yyHaveDay && !yyHaveDate)
+ {
+ tm.tm_mday += ((yyDayNumber - tm.tm_wday + 7) % 7
+ + 7 * (yyDayOrdinal - (0 < yyDayOrdinal)));
+ Start = mktime (&tm);
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (yyHaveZone)
+ {
+ long delta;
+ struct tm *gmt = gmtime (&Start);
+ if (!gmt)
+ return -1;
+ delta = yyTimezone * 60L + difftm (&tm, gmt);
+ if ((Start + delta < Start) != (delta < 0))
+ return -1; /* time_t overflow */
+ Start += delta;
+ }
+
+ return Start;
+}
+
+#if defined (TEST)
+
+/* ARGSUSED */
+int
+main (ac, av)
+ int ac;
+ char *av[];
+{
+ char buff[MAX_BUFF_LEN + 1];
+ time_t d;
+
+ (void) printf ("Enter date, or blank line to exit.\n\t> ");
+ (void) fflush (stdout);
+
+ buff[MAX_BUFF_LEN] = 0;
+ while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
+ {
+ d = get_date (buff, (time_t *) NULL);
+ if (d == -1)
+ (void) printf ("Bad format - couldn't convert.\n");
+ else
+ (void) printf ("%s", ctime (&d));
+ (void) printf ("\t> ");
+ (void) fflush (stdout);
+ }
+ exit (0);
+ /* NOTREACHED */
+}
+#endif /* defined (TEST) */
diff --git a/lib/getdate.h b/lib/getdate.h
new file mode 100644
index 000000000..674c474f1
--- /dev/null
+++ b/lib/getdate.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
+
+ This program 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, or (at your option)
+ any later version.
+
+ This program 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 this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifndef PARAMS
+# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
+#endif
+
+#ifdef vms
+# include <types.h>
+# include <time.h>
+#else
+# include <sys/types.h>
+# if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+# else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+# endif
+#endif /* defined (vms) */
+
+time_t get_date PARAMS ((const char *p, const time_t *now));
diff --git a/lib/getdate.y b/lib/getdate.y
new file mode 100644
index 000000000..d60be3cf0
--- /dev/null
+++ b/lib/getdate.y
@@ -0,0 +1,1051 @@
+%{
+/*
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
+**
+** This code is in the public domain and has no copyright.
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# endif
+#endif
+
+/* Since the code of getdate.y is not included in the Emacs executable
+ itself, there is no need to #define static in this file. Even if
+ the code were included in the Emacs executable, it probably
+ wouldn't do any harm to #undef it here; this will only cause
+ problems if we try to write to a static variable, which I don't
+ think this code needs to do. */
+#ifdef emacs
+# undef static
+#endif
+
+#include <malloc.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_STDLIB_H
+# include <stdlib.h> /* for `free'; used by Bison 1.27 */
+#endif
+
+#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
+#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+
+/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
+ - Its arg may be any int or unsigned int; it need not be an unsigned char.
+ - It's guaranteed to evaluate its argument exactly once.
+ - It's typically faster.
+ Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
+ only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
+ it's important to use the locale's definition of `digit' even when the
+ host does not conform to Posix. */
+#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
+
+#if defined (STDC_HEADERS) || defined (USG)
+# include <string.h>
+#endif
+
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
+/* Some old versions of bison generate parsers that use bcopy.
+ That loses on systems that don't provide the function, so we have
+ to redefine it here. */
+#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
+# define bcopy(from, to, len) memcpy ((to), (from), (len))
+#endif
+
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
+ as well as gratuitiously global symbol names, so we can have multiple
+ yacc generated parsers in the same program. Note that these are only
+ the variables produced by yacc. If other parser generators (bison,
+ byacc, etc) produce additional global names that conflict at link time,
+ then those parser generators need to be fixed instead of adding those
+ names to this list. */
+
+#define yymaxdepth gd_maxdepth
+#define yyparse gd_parse
+#define yylex gd_lex
+#define yyerror gd_error
+#define yylval gd_lval
+#define yychar gd_char
+#define yydebug gd_debug
+#define yypact gd_pact
+#define yyr1 gd_r1
+#define yyr2 gd_r2
+#define yydef gd_def
+#define yychk gd_chk
+#define yypgo gd_pgo
+#define yyact gd_act
+#define yyexca gd_exca
+#define yyerrflag gd_errflag
+#define yynerrs gd_nerrs
+#define yyps gd_ps
+#define yypv gd_pv
+#define yys gd_s
+#define yy_yys gd_yys
+#define yystate gd_state
+#define yytmp gd_tmp
+#define yyv gd_v
+#define yy_yyv gd_yyv
+#define yyval gd_val
+#define yylloc gd_lloc
+#define yyreds gd_reds /* With YYDEBUG defined */
+#define yytoks gd_toks /* With YYDEBUG defined */
+#define yylhs gd_yylhs
+#define yylen gd_yylen
+#define yydefred gd_yydefred
+#define yydgoto gd_yydgoto
+#define yysindex gd_yysindex
+#define yyrindex gd_yyrindex
+#define yygindex gd_yygindex
+#define yytable gd_yytable
+#define yycheck gd_yycheck
+
+static int yylex ();
+static int yyerror ();
+
+#define EPOCH 1970
+#define HOUR(x) ((x) * 60)
+
+#define MAX_BUFF_LEN 128 /* size of buffer to read the date into */
+
+/*
+** An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+ const char *name;
+ int type;
+ int value;
+} TABLE;
+
+
+/*
+** Meridian: am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+ MERam, MERpm, MER24
+} MERIDIAN;
+
+
+/*
+** Global variables. We could get rid of most of these by using a good
+** union as the yacc stack. (This routine was originally written before
+** yacc had the %union construct.) Maybe someday; right now we only use
+** the %union very rarely.
+*/
+static const char *yyInput;
+static int yyDayOrdinal;
+static int yyDayNumber;
+static int yyHaveDate;
+static int yyHaveDay;
+static int yyHaveRel;
+static int yyHaveTime;
+static int yyHaveZone;
+static int yyTimezone;
+static int yyDay;
+static int yyHour;
+static int yyMinutes;
+static int yyMonth;
+static int yySeconds;
+static int yyYear;
+static MERIDIAN yyMeridian;
+static int yyRelDay;
+static int yyRelHour;
+static int yyRelMinutes;
+static int yyRelMonth;
+static int yyRelSeconds;
+static int yyRelYear;
+
+%}
+
+/* This grammar has 13 shift/reduce conflicts. */
+%expect 13
+
+%union {
+ int Number;
+ enum _MERIDIAN Meridian;
+}
+
+%token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
+%token tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
+%token tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+
+%type <Number> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tMINUTE_UNIT
+%type <Number> tMONTH tMONTH_UNIT
+%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tYEAR_UNIT tZONE
+%type <Meridian> tMERIDIAN o_merid
+
+%%
+
+spec : /* NULL */
+ | spec item
+ ;
+
+item : time {
+ yyHaveTime++;
+ }
+ | zone {
+ yyHaveZone++;
+ }
+ | date {
+ yyHaveDate++;
+ }
+ | day {
+ yyHaveDay++;
+ }
+ | rel {
+ yyHaveRel++;
+ }
+ | number
+ ;
+
+time : tUNUMBER tMERIDIAN {
+ yyHour = $1;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = $2;
+ }
+ | tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = 0;
+ yyMeridian = $4;
+ }
+ | tUNUMBER ':' tUNUMBER tSNUMBER {
+ yyHour = $1;
+ yyMinutes = $3;
+ yyMeridian = MER24;
+ yyHaveZone++;
+ yyTimezone = ($4 < 0
+ ? -$4 % 100 + (-$4 / 100) * 60
+ : - ($4 % 100 + ($4 / 100) * 60));
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyMeridian = $6;
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyMeridian = MER24;
+ yyHaveZone++;
+ yyTimezone = ($6 < 0
+ ? -$6 % 100 + (-$6 / 100) * 60
+ : - ($6 % 100 + ($6 / 100) * 60));
+ }
+ ;
+
+zone : tZONE {
+ yyTimezone = $1;
+ }
+ | tDAYZONE {
+ yyTimezone = $1 - 60;
+ }
+ |
+ tZONE tDST {
+ yyTimezone = $1 - 60;
+ }
+ ;
+
+day : tDAY {
+ yyDayOrdinal = 1;
+ yyDayNumber = $1;
+ }
+ | tDAY ',' {
+ yyDayOrdinal = 1;
+ yyDayNumber = $1;
+ }
+ | tUNUMBER tDAY {
+ yyDayOrdinal = $1;
+ yyDayNumber = $2;
+ }
+ ;
+
+date : tUNUMBER '/' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $3;
+ }
+ | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
+ /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
+ The goal in recognizing YYYY/MM/DD is solely to support legacy
+ machine-generated dates like those in an RCS log listing. If
+ you want portability, use the ISO 8601 format. */
+ if ($1 >= 1000)
+ {
+ yyYear = $1;
+ yyMonth = $3;
+ yyDay = $5;
+ }
+ else
+ {
+ yyMonth = $1;
+ yyDay = $3;
+ yyYear = $5;
+ }
+ }
+ | tUNUMBER tSNUMBER tSNUMBER {
+ /* ISO 8601 format. yyyy-mm-dd. */
+ yyYear = $1;
+ yyMonth = -$2;
+ yyDay = -$3;
+ }
+ | tUNUMBER tMONTH tSNUMBER {
+ /* e.g. 17-JUN-1992. */
+ yyDay = $1;
+ yyMonth = $2;
+ yyYear = -$3;
+ }
+ | tMONTH tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ }
+ | tMONTH tUNUMBER ',' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ yyYear = $4;
+ }
+ | tUNUMBER tMONTH {
+ yyMonth = $2;
+ yyDay = $1;
+ }
+ | tUNUMBER tMONTH tUNUMBER {
+ yyMonth = $2;
+ yyDay = $1;
+ yyYear = $3;
+ }
+ ;
+
+rel : relunit tAGO {
+ yyRelSeconds = -yyRelSeconds;
+ yyRelMinutes = -yyRelMinutes;
+ yyRelHour = -yyRelHour;
+ yyRelDay = -yyRelDay;
+ yyRelMonth = -yyRelMonth;
+ yyRelYear = -yyRelYear;
+ }
+ | relunit
+ ;
+
+relunit : tUNUMBER tYEAR_UNIT {
+ yyRelYear += $1 * $2;
+ }
+ | tSNUMBER tYEAR_UNIT {
+ yyRelYear += $1 * $2;
+ }
+ | tYEAR_UNIT {
+ yyRelYear += $1;
+ }
+ | tUNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ | tSNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ | tMONTH_UNIT {
+ yyRelMonth += $1;
+ }
+ | tUNUMBER tDAY_UNIT {
+ yyRelDay += $1 * $2;
+ }
+ | tSNUMBER tDAY_UNIT {
+ yyRelDay += $1 * $2;
+ }
+ | tDAY_UNIT {
+ yyRelDay += $1;
+ }
+ | tUNUMBER tHOUR_UNIT {
+ yyRelHour += $1 * $2;
+ }
+ | tSNUMBER tHOUR_UNIT {
+ yyRelHour += $1 * $2;
+ }
+ | tHOUR_UNIT {
+ yyRelHour += $1;
+ }
+ | tUNUMBER tMINUTE_UNIT {
+ yyRelMinutes += $1 * $2;
+ }
+ | tSNUMBER tMINUTE_UNIT {
+ yyRelMinutes += $1 * $2;
+ }
+ | tMINUTE_UNIT {
+ yyRelMinutes += $1;
+ }
+ | tUNUMBER tSEC_UNIT {
+ yyRelSeconds += $1 * $2;
+ }
+ | tSNUMBER tSEC_UNIT {
+ yyRelSeconds += $1 * $2;
+ }
+ | tSEC_UNIT {
+ yyRelSeconds += $1;
+ }
+ ;
+
+number : tUNUMBER
+ {
+ if (yyHaveTime && yyHaveDate && !yyHaveRel)
+ yyYear = $1;
+ else
+ {
+ if ($1>10000)
+ {
+ yyHaveDate++;
+ yyDay= ($1)%100;
+ yyMonth= ($1/100)%100;
+ yyYear = $1/10000;
+ }
+ else
+ {
+ yyHaveTime++;
+ if ($1 < 100)
+ {
+ yyHour = $1;
+ yyMinutes = 0;
+ }
+ else
+ {
+ yyHour = $1 / 100;
+ yyMinutes = $1 % 100;
+ }
+ yySeconds = 0;
+ yyMeridian = MER24;
+ }
+ }
+ }
+ ;
+
+o_merid : /* NULL */
+ {
+ $$ = MER24;
+ }
+ | tMERIDIAN
+ {
+ $$ = $1;
+ }
+ ;
+
+%%
+
+/* Include this file down here because bison inserts code above which
+ may define-away `const'. We want the prototype for get_date to have
+ the same signature as the function definition does. */
+#include "getdate.h"
+
+extern struct tm *gmtime ();
+extern struct tm *localtime ();
+extern time_t mktime ();
+
+/* Month and day table. */
+static TABLE const MonthDayTable[] = {
+ { "january", tMONTH, 1 },
+ { "february", tMONTH, 2 },
+ { "march", tMONTH, 3 },
+ { "april", tMONTH, 4 },
+ { "may", tMONTH, 5 },
+ { "june", tMONTH, 6 },
+ { "july", tMONTH, 7 },
+ { "august", tMONTH, 8 },
+ { "september", tMONTH, 9 },
+ { "sept", tMONTH, 9 },
+ { "october", tMONTH, 10 },
+ { "november", tMONTH, 11 },
+ { "december", tMONTH, 12 },
+ { "sunday", tDAY, 0 },
+ { "monday", tDAY, 1 },
+ { "tuesday", tDAY, 2 },
+ { "tues", tDAY, 2 },
+ { "wednesday", tDAY, 3 },
+ { "wednes", tDAY, 3 },
+ { "thursday", tDAY, 4 },
+ { "thur", tDAY, 4 },
+ { "thurs", tDAY, 4 },
+ { "friday", tDAY, 5 },
+ { "saturday", tDAY, 6 },
+ { NULL, 0, 0 }
+};
+
+/* Time units table. */
+static TABLE const UnitsTable[] = {
+ { "year", tYEAR_UNIT, 1 },
+ { "month", tMONTH_UNIT, 1 },
+ { "fortnight", tDAY_UNIT, 14 },
+ { "week", tDAY_UNIT, 7 },
+ { "day", tDAY_UNIT, 1 },
+ { "hour", tHOUR_UNIT, 1 },
+ { "minute", tMINUTE_UNIT, 1 },
+ { "min", tMINUTE_UNIT, 1 },
+ { "second", tSEC_UNIT, 1 },
+ { "sec", tSEC_UNIT, 1 },
+ { NULL, 0, 0 }
+};
+
+/* Assorted relative-time words. */
+static TABLE const OtherTable[] = {
+ { "tomorrow", tMINUTE_UNIT, 1 * 24 * 60 },
+ { "yesterday", tMINUTE_UNIT, -1 * 24 * 60 },
+ { "today", tMINUTE_UNIT, 0 },
+ { "now", tMINUTE_UNIT, 0 },
+ { "last", tUNUMBER, -1 },
+ { "this", tMINUTE_UNIT, 0 },
+ { "next", tUNUMBER, 1 },
+ { "first", tUNUMBER, 1 },
+/* { "second", tUNUMBER, 2 }, */
+ { "third", tUNUMBER, 3 },
+ { "fourth", tUNUMBER, 4 },
+ { "fifth", tUNUMBER, 5 },
+ { "sixth", tUNUMBER, 6 },
+ { "seventh", tUNUMBER, 7 },
+ { "eighth", tUNUMBER, 8 },
+ { "ninth", tUNUMBER, 9 },
+ { "tenth", tUNUMBER, 10 },
+ { "eleventh", tUNUMBER, 11 },
+ { "twelfth", tUNUMBER, 12 },
+ { "ago", tAGO, 1 },
+ { NULL, 0, 0 }
+};
+
+/* The timezone table. */
+static TABLE const TimezoneTable[] = {
+ { "gmt", tZONE, HOUR ( 0) }, /* Greenwich Mean */
+ { "ut", tZONE, HOUR ( 0) }, /* Universal (Coordinated) */
+ { "utc", tZONE, HOUR ( 0) },
+ { "wet", tZONE, HOUR ( 0) }, /* Western European */
+ { "bst", tDAYZONE, HOUR ( 0) }, /* British Summer */
+ { "wat", tZONE, HOUR ( 1) }, /* West Africa */
+ { "at", tZONE, HOUR ( 2) }, /* Azores */
+#if 0
+ /* For completeness. BST is also British Summer, and GST is
+ * also Guam Standard. */
+ { "bst", tZONE, HOUR ( 3) }, /* Brazil Standard */
+ { "gst", tZONE, HOUR ( 3) }, /* Greenland Standard */
+#endif
+#if 0
+ { "nft", tZONE, HOUR (3.5) }, /* Newfoundland */
+ { "nst", tZONE, HOUR (3.5) }, /* Newfoundland Standard */
+ { "ndt", tDAYZONE, HOUR (3.5) }, /* Newfoundland Daylight */
+#endif
+ { "ast", tZONE, HOUR ( 4) }, /* Atlantic Standard */
+ { "adt", tDAYZONE, HOUR ( 4) }, /* Atlantic Daylight */
+ { "est", tZONE, HOUR ( 5) }, /* Eastern Standard */
+ { "edt", tDAYZONE, HOUR ( 5) }, /* Eastern Daylight */
+ { "cst", tZONE, HOUR ( 6) }, /* Central Standard */
+ { "cdt", tDAYZONE, HOUR ( 6) }, /* Central Daylight */
+ { "mst", tZONE, HOUR ( 7) }, /* Mountain Standard */
+ { "mdt", tDAYZONE, HOUR ( 7) }, /* Mountain Daylight */
+ { "pst", tZONE, HOUR ( 8) }, /* Pacific Standard */
+ { "pdt", tDAYZONE, HOUR ( 8) }, /* Pacific Daylight */
+ { "yst", tZONE, HOUR ( 9) }, /* Yukon Standard */
+ { "ydt", tDAYZONE, HOUR ( 9) }, /* Yukon Daylight */
+ { "hst", tZONE, HOUR (10) }, /* Hawaii Standard */
+ { "hdt", tDAYZONE, HOUR (10) }, /* Hawaii Daylight */
+ { "cat", tZONE, HOUR (10) }, /* Central Alaska */
+ { "ahst", tZONE, HOUR (10) }, /* Alaska-Hawaii Standard */
+ { "nt", tZONE, HOUR (11) }, /* Nome */
+ { "idlw", tZONE, HOUR (12) }, /* International Date Line West */
+ { "cet", tZONE, -HOUR (1) }, /* Central European */
+ { "met", tZONE, -HOUR (1) }, /* Middle European */
+ { "mewt", tZONE, -HOUR (1) }, /* Middle European Winter */
+ { "mest", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "mesz", tDAYZONE, -HOUR (1) }, /* Middle European Summer */
+ { "swt", tZONE, -HOUR (1) }, /* Swedish Winter */
+ { "sst", tDAYZONE, -HOUR (1) }, /* Swedish Summer */
+ { "fwt", tZONE, -HOUR (1) }, /* French Winter */
+ { "fst", tDAYZONE, -HOUR (1) }, /* French Summer */
+ { "eet", tZONE, -HOUR (2) }, /* Eastern Europe, USSR Zone 1 */
+ { "bt", tZONE, -HOUR (3) }, /* Baghdad, USSR Zone 2 */
+#if 0
+ { "it", tZONE, -HOUR (3.5) },/* Iran */
+#endif
+ { "zp4", tZONE, -HOUR (4) }, /* USSR Zone 3 */
+ { "zp5", tZONE, -HOUR (5) }, /* USSR Zone 4 */
+#if 0
+ { "ist", tZONE, -HOUR (5.5) },/* Indian Standard */
+#endif
+ { "zp6", tZONE, -HOUR (6) }, /* USSR Zone 5 */
+#if 0
+ /* For completeness. NST is also Newfoundland Standard, and SST is
+ * also Swedish Summer. */
+ { "nst", tZONE, -HOUR (6.5) },/* North Sumatra */
+ { "sst", tZONE, -HOUR (7) }, /* South Sumatra, USSR Zone 6 */
+#endif /* 0 */
+ { "wast", tZONE, -HOUR (7) }, /* West Australian Standard */
+ { "wadt", tDAYZONE, -HOUR (7) }, /* West Australian Daylight */
+#if 0
+ { "jt", tZONE, -HOUR (7.5) },/* Java (3pm in Cronusland!) */
+#endif
+ { "cct", tZONE, -HOUR (8) }, /* China Coast, USSR Zone 7 */
+ { "jst", tZONE, -HOUR (9) }, /* Japan Standard, USSR Zone 8 */
+#if 0
+ { "cast", tZONE, -HOUR (9.5) },/* Central Australian Standard */
+ { "cadt", tDAYZONE, -HOUR (9.5) },/* Central Australian Daylight */
+#endif
+ { "east", tZONE, -HOUR (10) }, /* Eastern Australian Standard */
+ { "eadt", tDAYZONE, -HOUR (10) }, /* Eastern Australian Daylight */
+ { "gst", tZONE, -HOUR (10) }, /* Guam Standard, USSR Zone 9 */
+ { "nzt", tZONE, -HOUR (12) }, /* New Zealand */
+ { "nzst", tZONE, -HOUR (12) }, /* New Zealand Standard */
+ { "nzdt", tDAYZONE, -HOUR (12) }, /* New Zealand Daylight */
+ { "idle", tZONE, -HOUR (12) }, /* International Date Line East */
+ { NULL, 0, 0 }
+};
+
+/* Military timezone table. */
+static TABLE const MilitaryTable[] = {
+ { "a", tZONE, HOUR ( 1) },
+ { "b", tZONE, HOUR ( 2) },
+ { "c", tZONE, HOUR ( 3) },
+ { "d", tZONE, HOUR ( 4) },
+ { "e", tZONE, HOUR ( 5) },
+ { "f", tZONE, HOUR ( 6) },
+ { "g", tZONE, HOUR ( 7) },
+ { "h", tZONE, HOUR ( 8) },
+ { "i", tZONE, HOUR ( 9) },
+ { "k", tZONE, HOUR ( 10) },
+ { "l", tZONE, HOUR ( 11) },
+ { "m", tZONE, HOUR ( 12) },
+ { "n", tZONE, HOUR (- 1) },
+ { "o", tZONE, HOUR (- 2) },
+ { "p", tZONE, HOUR (- 3) },
+ { "q", tZONE, HOUR (- 4) },
+ { "r", tZONE, HOUR (- 5) },
+ { "s", tZONE, HOUR (- 6) },
+ { "t", tZONE, HOUR (- 7) },
+ { "u", tZONE, HOUR (- 8) },
+ { "v", tZONE, HOUR (- 9) },
+ { "w", tZONE, HOUR (-10) },
+ { "x", tZONE, HOUR (-11) },
+ { "y", tZONE, HOUR (-12) },
+ { "z", tZONE, HOUR ( 0) },
+ { NULL, 0, 0 }
+};
+
+
+
+
+/* ARGSUSED */
+static int
+yyerror (s)
+ char *s ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
+static int
+ToHour (Hours, Meridian)
+ int Hours;
+ MERIDIAN Meridian;
+{
+ switch (Meridian)
+ {
+ case MER24:
+ if (Hours < 0 || Hours > 23)
+ return -1;
+ return Hours;
+ case MERam:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours;
+ case MERpm:
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ return Hours + 12;
+ default:
+ abort ();
+ }
+ /* NOTREACHED */
+}
+
+static int
+ToYear (Year)
+ int Year;
+{
+ if (Year < 0)
+ Year = -Year;
+
+ /* XPG4 suggests that years 00-68 map to 2000-2068, and
+ years 69-99 map to 1969-1999. */
+ if (Year < 69)
+ Year += 2000;
+ else if (Year < 100)
+ Year += 1900;
+
+ return Year;
+}
+
+static int
+LookupWord (buff)
+ char *buff;
+{
+ register char *p;
+ register char *q;
+ register const TABLE *tp;
+ int i;
+ int abbrev;
+
+ /* Make it lowercase. */
+ for (p = buff; *p; p++)
+ if (ISUPPER ((unsigned char) *p))
+ *p = tolower (*p);
+
+ if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
+ {
+ yylval.Meridian = MERam;
+ return tMERIDIAN;
+ }
+ if (strcmp (buff, "pm") == 0 || strcmp (buff, "p.m.") == 0)
+ {
+ yylval.Meridian = MERpm;
+ return tMERIDIAN;
+ }
+
+ /* See if we have an abbreviation for a month. */
+ if (strlen (buff) == 3)
+ abbrev = 1;
+ else if (strlen (buff) == 4 && buff[3] == '.')
+ {
+ abbrev = 1;
+ buff[3] = '\0';
+ }
+ else
+ abbrev = 0;
+
+ for (tp = MonthDayTable; tp->name; tp++)
+ {
+ if (abbrev)
+ {
+ if (strncmp (buff, tp->name, 3) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+ else if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ if (strcmp (buff, "dst") == 0)
+ return tDST;
+
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Strip off any plural and try the units table again. */
+ i = strlen (buff) - 1;
+ if (buff[i] == 's')
+ {
+ buff[i] = '\0';
+ for (tp = UnitsTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ buff[i] = 's'; /* Put back for "this" in OtherTable. */
+ }
+
+ for (tp = OtherTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Military timezones. */
+ if (buff[1] == '\0' && ISALPHA ((unsigned char) *buff))
+ {
+ for (tp = MilitaryTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ /* Drop out any periods and try the timezone table again. */
+ for (i = 0, p = q = buff; *q; q++)
+ if (*q != '.')
+ *p++ = *q;
+ else
+ i++;
+ *p = '\0';
+ if (i)
+ for (tp = TimezoneTable; tp->name; tp++)
+ if (strcmp (buff, tp->name) == 0)
+ {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ return tID;
+}
+
+static int
+yylex ()
+{
+ register unsigned char c;
+ register char *p;
+ char buff[20];
+ int Count;
+ int sign;
+
+ for (;;)
+ {
+ while (ISSPACE ((unsigned char) *yyInput))
+ yyInput++;
+
+ if (ISDIGIT (c = *yyInput) || c == '-' || c == '+')
+ {
+ if (c == '-' || c == '+')
+ {
+ sign = c == '-' ? -1 : 1;
+ if (!ISDIGIT (*++yyInput))
+ /* skip the '-' sign */
+ continue;
+ }
+ else
+ sign = 0;
+ for (yylval.Number = 0; ISDIGIT (c = *yyInput++);)
+ yylval.Number = 10 * yylval.Number + c - '0';
+ yyInput--;
+ if (sign < 0)
+ yylval.Number = -yylval.Number;
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+ if (ISALPHA (c))
+ {
+ for (p = buff; (c = *yyInput++, ISALPHA (c)) || c == '.';)
+ if (p < &buff[sizeof buff - 1])
+ *p++ = c;
+ *p = '\0';
+ yyInput--;
+ return LookupWord (buff);
+ }
+ if (c != '(')
+ return *yyInput++;
+ Count = 0;
+ do
+ {
+ c = *yyInput++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ Count++;
+ else if (c == ')')
+ Count--;
+ }
+ while (Count > 0);
+ }
+}
+
+#define TM_YEAR_ORIGIN 1900
+
+/* Yield A - B, measured in seconds. */
+static long
+difftm (struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ long days = (
+ /* difference in day of year */
+ a->tm_yday - b->tm_yday
+ /* + intervening leap days */
+ + ((ay >> 2) - (by >> 2))
+ - (ay / 100 - by / 100)
+ + ((ay / 100 >> 2) - (by / 100 >> 2))
+ /* + difference in years * 365 */
+ + (long) (ay - by) * 365
+ );
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+
+time_t
+get_date (const char *p, const time_t *now)
+{
+ struct tm tm, tm0, *tmp;
+ time_t Start;
+
+ yyInput = p;
+ Start = now ? *now : time ((time_t *) NULL);
+ tmp = localtime (&Start);
+ if (!tmp)
+ return -1;
+ yyYear = tmp->tm_year + TM_YEAR_ORIGIN;
+ yyMonth = tmp->tm_mon + 1;
+ yyDay = tmp->tm_mday;
+ yyHour = tmp->tm_hour;
+ yyMinutes = tmp->tm_min;
+ yySeconds = tmp->tm_sec;
+ tm.tm_isdst = tmp->tm_isdst;
+ yyMeridian = MER24;
+ yyRelSeconds = 0;
+ yyRelMinutes = 0;
+ yyRelHour = 0;
+ yyRelDay = 0;
+ yyRelMonth = 0;
+ yyRelYear = 0;
+ yyHaveDate = 0;
+ yyHaveDay = 0;
+ yyHaveRel = 0;
+ yyHaveTime = 0;
+ yyHaveZone = 0;
+
+ if (yyparse ()
+ || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
+ return -1;
+
+ tm.tm_year = ToYear (yyYear) - TM_YEAR_ORIGIN + yyRelYear;
+ tm.tm_mon = yyMonth - 1 + yyRelMonth;
+ tm.tm_mday = yyDay + yyRelDay;
+ if (yyHaveTime || (yyHaveRel && !yyHaveDate && !yyHaveDay))
+ {
+ tm.tm_hour = ToHour (yyHour, yyMeridian);
+ if (tm.tm_hour < 0)
+ return -1;
+ tm.tm_min = yyMinutes;
+ tm.tm_sec = yySeconds;
+ }
+ else
+ {
+ tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+ }
+ tm.tm_hour += yyRelHour;
+ tm.tm_min += yyRelMinutes;
+ tm.tm_sec += yyRelSeconds;
+
+ /* Let mktime deduce tm_isdst if we have an absolute timestamp,
+ or if the relative timestamp mentions days, months, or years. */
+ if (yyHaveDate | yyHaveDay | yyHaveTime | yyRelDay | yyRelMonth | yyRelYear)
+ tm.tm_isdst = -1;
+
+ tm0 = tm;
+
+ Start = mktime (&tm);
+
+ if (Start == (time_t) -1)
+ {
+
+ /* Guard against falsely reporting errors near the time_t boundaries
+ when parsing times in other time zones. For example, if the min
+ time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead
+ of UTC, then the min localtime value is 1970-01-01 08:00:00; if
+ we apply mktime to 1970-01-01 00:00:00 we will get an error, so
+ we apply mktime to 1970-01-02 08:00:00 instead and adjust the time
+ zone by 24 hours to compensate. This algorithm assumes that
+ there is no DST transition within a day of the time_t boundaries. */
+ if (yyHaveZone)
+ {
+ tm = tm0;
+ if (tm.tm_year <= EPOCH - TM_YEAR_ORIGIN)
+ {
+ tm.tm_mday++;
+ yyTimezone -= 24 * 60;
+ }
+ else
+ {
+ tm.tm_mday--;
+ yyTimezone += 24 * 60;
+ }
+ Start = mktime (&tm);
+ }
+
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (yyHaveDay && !yyHaveDate)
+ {
+ tm.tm_mday += ((yyDayNumber - tm.tm_wday + 7) % 7
+ + 7 * (yyDayOrdinal - (0 < yyDayOrdinal)));
+ Start = mktime (&tm);
+ if (Start == (time_t) -1)
+ return Start;
+ }
+
+ if (yyHaveZone)
+ {
+ long delta;
+ struct tm *gmt = gmtime (&Start);
+ if (!gmt)
+ return -1;
+ delta = yyTimezone * 60L + difftm (&tm, gmt);
+ if ((Start + delta < Start) != (delta < 0))
+ return -1; /* time_t overflow */
+ Start += delta;
+ }
+
+ return Start;
+}
+
+#if defined (TEST)
+
+/* ARGSUSED */
+int
+main (ac, av)
+ int ac;
+ char *av[];
+{
+ char buff[MAX_BUFF_LEN + 1];
+ time_t d;
+
+ (void) printf ("Enter date, or blank line to exit.\n\t> ");
+ (void) fflush (stdout);
+
+ buff[MAX_BUFF_LEN] = 0;
+ while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
+ {
+ d = get_date (buff, (time_t *) NULL);
+ if (d == -1)
+ (void) printf ("Bad format - couldn't convert.\n");
+ else
+ (void) printf ("%s", ctime (&d));
+ (void) printf ("\t> ");
+ (void) fflush (stdout);
+ }
+ exit (0);
+ /* NOTREACHED */
+}
+#endif /* defined (TEST) */
diff --git a/lib/getenv.c b/lib/getenv.c
new file mode 100644
index 000000000..404f1c970
--- /dev/null
+++ b/lib/getenv.c
@@ -0,0 +1,95 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rafael Sagula <sagula@inf.ufrgs.br>
+ * Sampo Kellomaki <sampo@iki.fi>
+ * Linas Vepstas <linas@linas.org>
+ * Bjorn Reese <breese@imada.ou.dk>
+ * Johan Anderson <johan@homemail.com>
+ * Kjell Ericson <Kjell.Ericson@haxx.nu>
+ * Troy Engel <tengel@palladium.net>
+ * Ryan Nelson <ryan@inch.com>
+ * Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ * $Log$
+ * Revision 1.1 1999-12-29 14:21:29 bagder
+ * Initial revision
+ *
+ * Revision 1.4 1999/09/06 06:59:40 dast
+ * Changed email info
+ *
+ * Revision 1.3 1999/08/13 07:34:48 dast
+ * Changed the URL in the header
+ *
+ * Revision 1.2 1999/03/13 00:56:09 dast
+ * Big changes done due to url.c being split up in X smaller files and that
+ * the lib is now more stand-alone.
+ *
+ * Revision 1.1.1.1 1999/03/11 22:23:34 dast
+ * Imported sources
+ *
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+char *GetEnv(char *variable)
+{
+#ifdef WIN32
+ /* This shit requires windows.h (HUGE) to be included */
+ static char env[MAX_PATH]; /* MAX_PATH is from windef.h */
+ char *temp = getenv(variable);
+ env[0] = '\0';
+ ExpandEnvironmentStrings(temp, env, sizeof(env));
+#else
+ /* no length control */
+ char *env = getenv(variable);
+#endif
+ return env;
+}
+
+char *curl_GetEnv(char *v)
+{
+ return GetEnv(v);
+}
diff --git a/lib/getenv.h b/lib/getenv.h
new file mode 100644
index 000000000..83b9495e1
--- /dev/null
+++ b/lib/getenv.h
@@ -0,0 +1,71 @@
+#ifndef __GETENV_H
+#define __GETENV_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rafael Sagula <sagula@inf.ufrgs.br>
+ * Sampo Kellomaki <sampo@iki.fi>
+ * Linas Vepstas <linas@linas.org>
+ * Bjorn Reese <breese@imada.ou.dk>
+ * Johan Anderson <johan@homemail.com>
+ * Kjell Ericson <Kjell.Ericson@haxx.nu>
+ * Troy Engel <tengel@palladium.net>
+ * Ryan Nelson <ryan@inch.com>
+ * Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ * $Log$
+ * Revision 1.1 1999-12-29 14:21:30 bagder
+ * Initial revision
+ *
+ * Revision 1.3 1999/09/06 06:59:40 dast
+ * Changed email info
+ *
+ * Revision 1.2 1999/08/13 07:34:48 dast
+ * Changed the URL in the header
+ *
+ * Revision 1.1.1.1 1999/03/11 22:23:34 dast
+ * Imported sources
+ *
+ ****************************************************************************/
+
+/* Unix and Win32 getenv function call */
+char *GetEnv(char *variable);
+
+#endif
diff --git a/lib/getpass.c b/lib/getpass.c
new file mode 100644
index 000000000..c0c7bf97b
--- /dev/null
+++ b/lib/getpass.c
@@ -0,0 +1,185 @@
+/* ============================================================================
+ * Copyright (C) 1998 Angus Mackay. All rights reserved;
+ *
+ * Redistribution and use are freely permitted provided that:
+ *
+ * 1) This header remain in tact.
+ * 2) The prototype for getpass is not changed from:
+ * char *getpass(const char *prompt)
+ * 3) This source code is not used outside of this(getpass.c) file.
+ * 3) Any changes to this(getpass.c) source code are made publicly available.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * $Id$
+ *
+ * The spirit of this license is to allow use of this source code in any
+ * project be it open or closed but still encourage the use of the open,
+ * library based equivilents.
+ *
+ * Author(s):
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * Contributor(s):
+ * Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ */
+
+#ifndef WIN32
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_TERMIOS_H
+# if !defined(HAVE_TCGETATTR) && !defined(HAVE_TCSETATTR)
+# undef HAVE_TERMIOS_H
+# endif
+#endif
+
+#define INPUT_BUFFER 128
+
+#ifndef RETSIGTYPE
+# define RETSIGTYPE void
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <signal.h>
+#ifdef HAVE_TERMIOS_H
+# include <termios.h>
+#else
+# ifdef HAVE_TERMIO_H
+# include <termio.h>
+# else
+# endif
+#endif
+
+/* no perror? make an fprintf! */
+#ifndef HAVE_PERROR
+# define perror(x) fprintf(stderr, "Error in: %s\n", x)
+#endif
+
+char *getpass(const char *prompt)
+{
+ FILE *infp;
+ FILE *outfp;
+ static char buf[INPUT_BUFFER];
+ RETSIGTYPE (*sigint)();
+ RETSIGTYPE (*sigtstp)();
+ size_t bytes_read;
+ int infd;
+ int outfd;
+#ifdef HAVE_TERMIOS_H
+ struct termios orig;
+ struct termios noecho;
+#else
+# ifdef HAVE_TERMIO_H
+ struct termio orig;
+ struct termio noecho;
+# else
+# endif
+#endif
+
+ sigint = signal(SIGINT, SIG_IGN);
+ sigtstp = signal(SIGTSTP, SIG_IGN);
+
+ if( (infp=fopen("/dev/tty", "r")) == NULL )
+ {
+ infp = stdin;
+ }
+ if( (outfp=fopen("/dev/tty", "w")) == NULL )
+ {
+ outfp = stderr;
+ }
+ infd = fileno(infp);
+ outfd = fileno(outfp);
+
+ /* dissable echo */
+#ifdef HAVE_TERMIOS_H
+ if(tcgetattr(outfd, &orig) != 0)
+ {
+ perror("tcgetattr");
+ }
+ noecho = orig;
+ noecho.c_lflag &= ~ECHO;
+ if(tcsetattr(outfd, TCSANOW, &noecho) != 0)
+ {
+ perror("tcgetattr");
+ }
+#else
+# ifdef HAVE_TERMIO_H
+ if(ioctl(outfd, TCGETA, &orig) != 0)
+ {
+ perror("ioctl");
+ }
+ noecho = orig;
+ noecho.c_lflag &= ~ECHO;
+ if(ioctl(outfd, TCSETA, &noecho) != 0)
+ {
+ perror("ioctl");
+ }
+# else
+# endif
+#endif
+
+ fputs(prompt, outfp);
+ fflush(outfp);
+
+ bytes_read=read(infd, buf, INPUT_BUFFER);
+ buf[bytes_read > 0 ? (bytes_read -1) : 0] = '\0';
+
+ /* print a new line if needed */
+#ifdef HAVE_TERMIOS_H
+ fputs("\n", outfp);
+#else
+# ifdef HAVE_TERMIO_H
+ fputs("\n", outfp);
+# else
+# endif
+#endif
+
+ /*
+ * reset term charectaristics, use TCSAFLUSH incase the
+ * user types more than INPUT_BUFFER
+ */
+#ifdef HAVE_TERMIOS_H
+ if(tcsetattr(outfd, TCSAFLUSH, &orig) != 0)
+ {
+ perror("tcgetattr");
+ }
+#else
+# ifdef HAVE_TERMIO_H
+ if(ioctl(outfd, TCSETA, &orig) != 0)
+ {
+ perror("ioctl");
+ }
+# else
+# endif
+#endif
+
+ signal(SIGINT, sigint);
+ signal(SIGTSTP, sigtstp);
+
+ return(buf);
+}
+#else
+#include <stdio.h>
+char *getpass(const char *prompt)
+{
+ static char password[80];
+ printf(prompt);
+ gets(password);
+ return password;
+}
+#endif /* don't do anything if WIN32 */
diff --git a/lib/getpass.h b/lib/getpass.h
new file mode 100644
index 000000000..33dfed668
--- /dev/null
+++ b/lib/getpass.h
@@ -0,0 +1 @@
+char *getpass(const char *prompt);
diff --git a/lib/hostip.c b/lib/hostip.c
new file mode 100644
index 000000000..453d8a387
--- /dev/null
+++ b/lib/hostip.c
@@ -0,0 +1,111 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <string.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#else
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#endif
+
+#include "urldata.h"
+#include "sendf.h"
+
+/* --- resolve name or IP-number --- */
+
+char *MakeIP(unsigned long num)
+{
+#ifdef HAVE_INET_NTOA
+ struct in_addr in;
+
+ in.s_addr = htonl(num);
+ return (inet_ntoa(in));
+#else
+ static char addr[128];
+ unsigned char *paddr;
+
+ num = htonl(num); /* htonl() added to avoid endian probs */
+ paddr = (unsigned char *)&num;
+ sprintf(addr, "%u.%u.%u.%u", paddr[0], paddr[1], paddr[2], paddr[3]);
+ return (addr);
+#endif
+}
+
+/* Stolen from Dancer source code, written by
+ Bjorn Reese <breese@imada.ou.dk> */
+#ifndef INADDR_NONE
+#define INADDR_NONE (unsigned long) ~0
+#endif
+struct hostent *GetHost(struct UrlData *data, char *hostname)
+{
+ struct hostent *h = NULL;
+ unsigned long in;
+ static struct hostent he;
+ static char name[MAXHOSTNAMELEN];
+ static char *addrlist[2];
+ static struct in_addr addrentry;
+
+ if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
+ addrentry.s_addr = in;
+ addrlist[0] = (char *)&addrentry;
+ addrlist[1] = NULL;
+ he.h_name = strncpy(name, MakeIP(ntohl(in)), MAXHOSTNAMELEN);
+ he.h_addrtype = AF_INET;
+ he.h_length = sizeof(struct in_addr);
+ he.h_addr_list = addrlist;
+ h = &he;
+ } else if ( (h=gethostbyname(hostname)) == NULL ) {
+ infof(data, "gethostbyname(2) failed for %s\n", hostname);
+ }
+ return (h);
+}
diff --git a/lib/hostip.h b/lib/hostip.h
new file mode 100644
index 000000000..8753e3975
--- /dev/null
+++ b/lib/hostip.h
@@ -0,0 +1,46 @@
+#ifndef __HOSTIP_H
+#define __HOSTIP_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+struct hostent *GetHost(struct UrlData *data, char *hostname);
+char *MakeIP(unsigned long num);
+
+#endif
diff --git a/lib/http.c b/lib/http.c
new file mode 100644
index 000000000..2dd380214
--- /dev/null
+++ b/lib/http.c
@@ -0,0 +1,381 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#include <time.h>
+#include <io.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "download.h"
+#include "sendf.h"
+#include "formdata.h"
+#include "progress.h"
+#include "base64.h"
+#include "upload.h"
+#include "cookie.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+/*
+ * This function checks the linked list of custom HTTP headers for a particular
+ * header (prefix).
+ */
+bool static checkheaders(struct UrlData *data, char *thisheader)
+{
+ struct HttpHeader *head;
+ size_t thislen = strlen(thisheader);
+
+ for(head = data->headers; head; head=head->next) {
+ if(strnequal(head->header, thisheader, thislen)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+UrgError http(struct UrlData *data, char *ppath, char *host, long *bytecount)
+{
+ /* Send the GET line to the HTTP server */
+
+ struct FormData *sendit=NULL;
+ int postsize=0;
+ UrgError result;
+ char *buf;
+ struct Cookie *co = NULL;
+ char *p_pragma = NULL;
+ char *p_accept = NULL;
+
+ buf = data->buffer; /* this is our buffer */
+
+ if ( (data->conf&(CONF_HTTP|CONF_FTP)) &&
+ (data->conf&CONF_UPLOAD)) {
+ data->conf |= CONF_PUT;
+ }
+#if 0 /* old version */
+ if((data->conf&(CONF_HTTP|CONF_UPLOAD)) ==
+ (CONF_HTTP|CONF_UPLOAD)) {
+ /* enable PUT! */
+ data->conf |= CONF_PUT;
+ }
+#endif
+
+ /* The User-Agent string has been built in url.c already, because it might
+ have been used in the proxy connect, but if we have got a header with
+ the user-agent string specified, we erase the previosly made string
+ here. */
+ if(checkheaders(data, "User-Agent:") && data->ptr_uagent) {
+ free(data->ptr_uagent);
+ data->ptr_uagent=NULL;
+ }
+
+ if((data->conf & CONF_USERPWD) && !checkheaders(data, "Authorization:")) {
+ char authorization[512];
+ sprintf(data->buffer, "%s:%s", data->user, data->passwd);
+ base64Encode(data->buffer, authorization);
+ data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012",
+ authorization);
+ }
+ if((data->conf & CONF_RANGE) && !checkheaders(data, "Range:")) {
+ data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range);
+ }
+ if((data->conf & CONF_REFERER) && !checkheaders(data, "Referer:")) {
+ data->ptr_ref = maprintf("Referer: %s\015\012", data->referer);
+ }
+ if(data->cookie && !checkheaders(data, "Cookie:")) {
+ data->ptr_cookie = maprintf("Cookie: %s\015\012", data->cookie);
+ }
+
+ if(data->cookies) {
+ co = cookie_getlist(data->cookies,
+ host,
+ ppath,
+ data->conf&CONF_HTTPS?TRUE:FALSE);
+ }
+ if ((data->conf & CONF_PROXY) && (!(data->conf & CONF_HTTPS))) {
+ /* The path sent to the proxy is in fact the entire URL */
+ strncpy(ppath, data->url, URL_MAX_LENGTH-1);
+ }
+ if(data->conf & CONF_HTTPPOST) {
+ /* we must build the whole darned post sequence first, so that we have
+ a size of the whole shebang before we start to send it */
+ sendit = getFormData(data->httppost, &postsize);
+ }
+
+ if(!checkheaders(data, "Host:"))
+ data->ptr_host = maprintf("Host: %s\r\n", host);
+
+
+ if(!checkheaders(data, "Pragma:"))
+ p_pragma = "Pragma: no-cache\r\n";
+
+ if(!checkheaders(data, "Accept:"))
+ p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
+
+ do {
+ sendf(data->firstsocket, data,
+ "%s " /* GET/HEAD/POST/PUT */
+ "%s HTTP/1.0\r\n" /* path */
+ "%s" /* proxyuserpwd */
+ "%s" /* userpwd */
+ "%s" /* range */
+ "%s" /* user agent */
+ "%s" /* cookie */
+ "%s" /* host */
+ "%s" /* pragma */
+ "%s" /* accept */
+ "%s", /* referer */
+
+ data->customrequest?data->customrequest:
+ (data->conf&CONF_NOBODY?"HEAD":
+ (data->conf&(CONF_POST|CONF_HTTPPOST))?"POST":
+ (data->conf&CONF_PUT)?"PUT":"GET"),
+ ppath,
+ (data->conf&CONF_PROXYUSERPWD && data->ptr_proxyuserpwd)?data->ptr_proxyuserpwd:"",
+ (data->conf&CONF_USERPWD && data->ptr_userpwd)?data->ptr_userpwd:"",
+ (data->conf&CONF_RANGE && data->ptr_rangeline)?data->ptr_rangeline:"",
+ (data->useragent && *data->useragent && data->ptr_uagent)?data->ptr_uagent:"",
+ (data->ptr_cookie?data->ptr_cookie:""), /* Cookie: <data> */
+ (data->ptr_host?data->ptr_host:""), /* Host: host */
+ p_pragma?p_pragma:"",
+ p_accept?p_accept:"",
+ (data->conf&CONF_REFERER && data->ptr_ref)?data->ptr_ref:"" /* Referer: <data> <CRLF> */
+ );
+
+ if(co) {
+ int count=0;
+ /* now loop through all cookies that matched */
+ while(co) {
+ if(0 == count) {
+ sendf(data->firstsocket, data,
+ "Cookie: ");
+ }
+ count++;
+ sendf(data->firstsocket, data,
+ "%s=%s;", co->name, co->value);
+ co = co->next; /* next cookie please */
+ }
+ if(count) {
+ sendf(data->firstsocket, data,
+ "\r\n");
+ }
+ cookie_freelist(co); /* free the cookie list */
+ co=NULL;
+ }
+
+ if(data->timecondition) {
+ struct tm *thistime;
+
+ thistime = localtime(&data->timevalue);
+
+#if defined(HAVE_STRFTIME) || defined(WIN32)
+ /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
+ strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S %Z", thistime);
+#else
+ /* Right, we *could* write a replacement here */
+ strcpy(buf, "no strftime() support");
+#endif
+ switch(data->timecondition) {
+ case TIMECOND_IFMODSINCE:
+ default:
+ sendf(data->firstsocket, data,
+ "If-Modified-Since: %s\r\n", buf);
+ break;
+ case TIMECOND_IFUNMODSINCE:
+ sendf(data->firstsocket, data,
+ "If-Unmodified-Since: %s\r\n", buf);
+ break;
+ case TIMECOND_LASTMOD:
+ sendf(data->firstsocket, data,
+ "Last-Modified: %s\r\n", buf);
+ break;
+ }
+ }
+
+ while(data->headers) {
+ sendf(data->firstsocket, data,
+ "%s\015\012",
+ data->headers->header);
+ data->headers = data->headers->next;
+ }
+
+ if(data->conf&(CONF_POST|CONF_HTTPPOST)) {
+ if(data->conf & CONF_POST) {
+ /* this is the simple x-www-form-urlencoded style */
+ sendf(data->firstsocket, data,
+ "Content-Length: %d\015\012"
+ "Content-Type: application/x-www-form-urlencoded\r\n\r\n"
+ "%s\015\012",
+ strlen(data->postfields),
+ data->postfields );
+ }
+ else {
+ struct Form form;
+ size_t (*storefread)(char *, size_t , size_t , FILE *);
+ FILE *in;
+ long conf;
+
+ if(FormInit(&form, sendit)) {
+ failf(data, "Internal HTTP POST error!\n");
+ return URG_HTTP_POST_ERROR;
+ }
+
+ storefread = data->fread; /* backup */
+ in = data->in; /* backup */
+
+ data->fread =
+ (size_t (*)(char *, size_t, size_t, FILE *))
+ FormReader; /* set the read function to read from the
+ generated form data */
+ data->in = (FILE *)&form;
+
+ sendf(data->firstsocket, data,
+ "Content-Length: %d\r\n",
+ postsize-2);
+
+ conf = data->conf;
+ data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
+ ProgressInit(data, postsize);
+
+ result = Upload(data, data->firstsocket, bytecount);
+
+ FormFree(sendit); /* Now free that whole lot */
+
+ data->conf = conf; /* restore conf values for the download */
+
+ if(result)
+ return result;
+
+ data->fread = storefread; /* restore */
+ data->in = in; /* restore */
+
+ sendf(data->firstsocket, data,
+ "\r\n\r\n");
+ }
+ }
+ else if(data->conf&CONF_PUT) {
+ /* Let's PUT the data to the server! */
+ long conf;
+
+ if(data->infilesize>0) {
+ sendf(data->firstsocket, data,
+ "Content-Length: %d\r\n\r\n", /* file size */
+ data->infilesize );
+ }
+ else
+ sendf(data->firstsocket, data,
+ "\015\012");
+
+ conf = data->conf;
+ data->conf &= ~CONF_NOPROGRESS; /* enable progress meter */
+
+ ProgressInit(data, data->infilesize);
+
+ result = Upload(data, data->firstsocket, bytecount);
+
+ data->conf = conf;
+
+ if(result)
+ return result;
+
+ /* reset the byte counter */
+ *bytecount=0;
+ }
+ else {
+ sendf(data->firstsocket, data, "\r\n");
+ }
+ /* HTTP GET/HEAD download: */
+ result = Download(data, data->firstsocket, -1, TRUE, bytecount);
+
+ if(result)
+ return result;
+
+ ProgressEnd(data);
+ } while (0); /* this is just a left-over from the multiple document download
+ attempts */
+
+ return URG_OK;
+}
+
diff --git a/lib/http.h b/lib/http.h
new file mode 100644
index 000000000..be35842cf
--- /dev/null
+++ b/lib/http.h
@@ -0,0 +1,45 @@
+#ifndef __HTTP_H
+#define __HTTP_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError http(struct UrlData *data, char *path, char *host, long *bytecountp);
+
+#endif
diff --git a/lib/if2ip.c b/lib/if2ip.c
new file mode 100644
index 000000000..f8a37bb12
--- /dev/null
+++ b/lib/if2ip.c
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "setup.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if ! defined(WIN32) && ! defined(__BEOS__)
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#include <netinet/in.h>
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+
+/* -- if2ip() -- */
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+
+#define SYS_ERROR -1
+
+char *if2ip(char *interface)
+{
+ int dummy;
+ char *ip=NULL;
+
+ if(!interface)
+ return NULL;
+
+ dummy = socket(AF_INET, SOCK_STREAM, 0);
+ if (SYS_ERROR == dummy) {
+ return NULL;
+ }
+ else {
+ struct ifreq req;
+ memset(&req, 0, sizeof(req));
+ strcpy(req.ifr_name, interface);
+ req.ifr_addr.sa_family = AF_INET;
+ if (SYS_ERROR == ioctl(dummy, SIOCGIFADDR, &req, sizeof(req))) {
+ return NULL;
+ }
+ else {
+ struct in_addr in;
+
+ struct sockaddr_in *s = (struct sockaddr_in *)&req.ifr_dstaddr;
+ memcpy(&in, &(s->sin_addr.s_addr), sizeof(in));
+ ip = (char *)strdup(inet_ntoa(in));
+ }
+ close(dummy);
+ }
+ return ip;
+}
+
+/* -- end of if2ip() -- */
+#else
+#define if2ip(x) NULL
+#endif
diff --git a/lib/if2ip.h b/lib/if2ip.h
new file mode 100644
index 000000000..0b658f9d2
--- /dev/null
+++ b/lib/if2ip.h
@@ -0,0 +1,50 @@
+#ifndef __IF2IP_H
+#define __IF2IP_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+#include "setup.h"
+
+#if ! defined(WIN32) && ! defined(__BEOS__)
+char *if2ip(char *interface);
+#else
+#define if2ip(x) NULL
+#endif
+
+#endif
diff --git a/lib/ldap.c b/lib/ldap.c
new file mode 100644
index 000000000..7f0e0251f
--- /dev/null
+++ b/lib/ldap.c
@@ -0,0 +1,226 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Contributor(s):
+ * Bjørn Reese <breese@mail1.stofanet.dk>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__)
+#else
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+# ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+# endif
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "sendf.h"
+#include "escape.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+
+#define DYNA_GET_FUNCTION(type, fnc) \
+ (fnc) = (type)DynaGetFunction(#fnc); \
+ if ((fnc) == NULL) { \
+ return URG_FUNCTION_NOT_FOUND; \
+ } \
+
+/***********************************************************************
+ */
+static void *libldap = NULL;
+static void *liblber = NULL;
+
+static void DynaOpen(void)
+{
+#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
+ if (libldap == NULL) {
+ /*
+ * libldap.so should be able to resolve its dependency on
+ * liblber.so automatically, but since it does not we will
+ * handle it here by opening liblber.so as global.
+ */
+ dlopen("liblber.so", RTLD_LAZY | RTLD_GLOBAL);
+ libldap = dlopen("libldap.so", RTLD_LAZY);
+ }
+#endif
+}
+
+static void DynaClose(void)
+{
+#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
+ if (libldap) {
+ dlclose(libldap);
+ }
+ if (liblber) {
+ dlclose(liblber);
+ }
+#endif
+}
+
+static void * DynaGetFunction(char *name)
+{
+ void *func = NULL;
+
+#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
+ if (libldap) {
+ func = dlsym(libldap, name);
+ }
+#endif
+
+ return func;
+}
+
+static int WriteProc(void *param, char *text, int len)
+{
+ struct UrlData *data = (struct UrlData *)param;
+
+ printf("%s\n", text);
+ return 0;
+}
+
+/***********************************************************************
+ */
+UrgError ldap(struct UrlData *data, char *path, long *bytecount)
+{
+ UrgError status = URG_OK;
+ int rc;
+ void *(*ldap_open)(char *, int);
+ int (*ldap_simple_bind_s)(void *, char *, char *);
+ int (*ldap_unbind_s)(void *);
+ int (*ldap_url_search_s)(void *, char *, int, void **);
+ void *(*ldap_first_entry)(void *, void *);
+ void *(*ldap_next_entry)(void *, void *);
+ char *(*ldap_err2string)(int);
+ int (*ldap_entry2text)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long);
+ int (*ldap_entry2html)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *);
+ void *server;
+ void *result;
+ void *entryIterator;
+#if 0
+ char *dn;
+ char **attrArray;
+ char *attrIterator;
+ char *attrString;
+ void *dummy;
+#endif
+ int ldaptext;
+
+ infof(data, "LDAP: %s %s\n", data->url);
+
+ DynaOpen();
+ if (libldap == NULL) {
+ failf(data, "The needed LDAP library/libraries couldn't be opened");
+ return URG_LIBRARY_NOT_FOUND;
+ }
+
+ ldaptext = data->conf & CONF_FTPASCII; /* This is a dirty hack */
+
+ /* The types are needed because ANSI C distinguishes between
+ * pointer-to-object (data) and pointer-to-function.
+ */
+ DYNA_GET_FUNCTION(void *(*)(char *, int), ldap_open);
+ DYNA_GET_FUNCTION(int (*)(void *, char *, char *), ldap_simple_bind_s);
+ DYNA_GET_FUNCTION(int (*)(void *), ldap_unbind_s);
+ DYNA_GET_FUNCTION(int (*)(void *, char *, int, void **), ldap_url_search_s);
+ DYNA_GET_FUNCTION(void *(*)(void *, void *), ldap_first_entry);
+ DYNA_GET_FUNCTION(void *(*)(void *, void *), ldap_next_entry);
+ DYNA_GET_FUNCTION(char *(*)(int), ldap_err2string);
+ DYNA_GET_FUNCTION(int (*)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long), ldap_entry2text);
+ DYNA_GET_FUNCTION(int (*)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *), ldap_entry2html);
+
+ server = ldap_open(data->hostname, data->port);
+ if (server == NULL) {
+ failf(data, "LDAP: Cannot connect to %s:%d",
+ data->hostname, data->port);
+ status = URG_COULDNT_CONNECT;
+ } else {
+ rc = ldap_simple_bind_s(server, data->user, data->passwd);
+ if (rc != 0) {
+ failf(data, "LDAP: %s", ldap_err2string(rc));
+ status = URG_LDAP_CANNOT_BIND;
+ } else {
+ rc = ldap_url_search_s(server, data->url, 0, &result);
+ if (rc != 0) {
+ failf(data, "LDAP: %s", ldap_err2string(rc));
+ status = URG_LDAP_SEARCH_FAILED;
+ } else {
+ for (entryIterator = ldap_first_entry(server, result);
+ entryIterator;
+ entryIterator = ldap_next_entry(server, entryIterator))
+ {
+ if (ldaptext) {
+ rc = ldap_entry2text(server, NULL, entryIterator, NULL,
+ NULL, NULL, WriteProc, data,
+ "", 0, 0);
+ if (rc != 0) {
+ failf(data, "LDAP: %s", ldap_err2string(rc));
+ status = URG_LDAP_SEARCH_FAILED;
+ }
+ } else {
+ rc = ldap_entry2html(server, NULL, entryIterator, NULL,
+ NULL, NULL, WriteProc, data,
+ "", 0, 0, NULL, NULL);
+ if (rc != 0) {
+ failf(data, "LDAP: %s", ldap_err2string(rc));
+ status = URG_LDAP_SEARCH_FAILED;
+ }
+ }
+ }
+ }
+ ldap_unbind_s(server);
+ }
+ }
+ DynaClose();
+
+ return status;
+}
diff --git a/lib/ldap.h b/lib/ldap.h
new file mode 100644
index 000000000..d88880ede
--- /dev/null
+++ b/lib/ldap.h
@@ -0,0 +1,45 @@
+#ifndef __LDAP_H
+#define __LDAP_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://www.fts.frontec.se/~dast/curl/
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError ldap(struct UrlData *data, char *path, long *bytecount);
+
+#endif /* __LDAP_H */
diff --git a/lib/mprintf.c b/lib/mprintf.c
new file mode 100644
index 000000000..237a21a9d
--- /dev/null
+++ b/lib/mprintf.c
@@ -0,0 +1,1253 @@
+/****************************************************************************
+ *
+ * $Id$
+ *
+ *************************************************************************
+ *
+ * Purpose:
+ * A merge of Bjorn Reese's format() function and Daniel's dsprintf()
+ * 1.0. A full blooded printf() clone with full support for <num>$
+ * everywhere (parameters, widths and precisions) including variabled
+ * sized parameters (like doubles, long longs, long doubles and even
+ * void * in 64-bit architectures).
+ *
+ * Current restrictions:
+ * - Max 128 parameters
+ * - No 'long double' support.
+ *
+ *************************************************************************
+ *
+ *
+ * 1998/01/10 (v2.8)
+ * Daniel
+ * - Updated version number.
+ * - Corrected a static non-zero prefixed width problem.
+ *
+ * 1998/11/17 - Daniel
+ * Added daprintf() and dvaprintf() for allocated printf() and vprintf().
+ * They return an allocated buffer with the result inside. The result must
+ * be free()ed!
+ *
+ * 1998/08/23 - breese
+ *
+ * Converted all non-printable (and non-whitespace) characters into
+ * their decimal ASCII value preceeded by a '\' character
+ * (this only applies to snprintf family so far)
+ *
+ * Added %S (which is the same as %#s)
+ *
+ * 1998/05/05 (v2.7)
+ *
+ * Fixed precision and width qualifiers (%.*s)
+ *
+ * Added support for snprintf()
+ *
+ * Quoting (%#s) is disabled for the (nil) pointer
+ *
+ * 1997/06/09 (v2.6)
+ *
+ * %#s means that the string will be quoted with "
+ * (I was getting tired of writing \"%s\" all the time)
+ *
+ * [ERR] for strings changed to (nil)
+ *
+ * v2.5
+ * - Added C++ support
+ * - Prepended all internal functions with dprintf_
+ * - Defined the booleans
+ *
+ * v2.4
+ * - Added dvsprintf(), dvfprintf() and dvprintf().
+ * - Made the formatting function available with the name _formatf() to enable
+ * other *printf()-inspired functions. (I considered adding a dmsprintf()
+ * that works like sprintf() but allocates the destination string and
+ * possibly enlarges it itself, but things like that should be done with the
+ * new _formatf() instead.)
+ *
+ * v2.3
+ * - Small modifications to make it compile nicely at both Daniel's and
+ * Bjorn's place.
+ *
+ * v2.2
+ * - Made it work with text to the right of the last %!
+ * - Introduced dprintf(), dsprintf() and dfprintf().
+ * - Float/double support enabled. This system is currently using the ordinary
+ * sprintf() function. NOTE that positional parameters, widths and precisions
+ * will still work like it should since the d-system takes care of that and
+ * passes that information re-formatted to the old sprintf().
+ *
+ * v2.1
+ * - Fixed space padding (i.e %d was extra padded previously)
+ * - long long output is supported
+ * - alternate output is done correct like in %#08x
+ *
+ ****************************************************************************/
+
+static const char rcsid[] = "@(#)$Id$";
+
+/*
+ * To test:
+ *
+ * Use WIDTH, PRECISION and NUMBERED ARGUMENT combined.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <string.h>
+
+
+#define BUFFSIZE 256 /* buffer for long-to-str and float-to-str calcs */
+#define MAX_PARAMETERS 128 /* lame static limit */
+
+#undef TRUE
+#undef FALSE
+#undef BOOL
+#ifdef __cplusplus
+# define TRUE true
+# define FALSE false
+# define BOOL bool
+#else
+# define TRUE ((char)(1 == 1))
+# define FALSE ((char)(0 == 1))
+# define BOOL char
+#endif
+
+
+/* Lower-case digits. */
+static const char lower_digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+
+/* Upper-case digits. */
+static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+#define OUTCHAR(x) done+=(stream(x, (FILE *)data)==-1?0:1)
+
+/* Data type to read from the arglist */
+typedef enum {
+ FORMAT_UNKNOWN = 0,
+ FORMAT_STRING,
+ FORMAT_PTR,
+ FORMAT_INT,
+ FORMAT_INTPTR,
+ FORMAT_LONG,
+ FORMAT_LONGLONG,
+ FORMAT_DOUBLE,
+ FORMAT_LONGDOUBLE,
+ FORMAT_WIDTH /* For internal use */
+} FormatType;
+
+/* convertion and display flags */
+enum {
+ FLAGS_NEW = 0,
+ FLAGS_SPACE = 1<<0,
+ FLAGS_SHOWSIGN = 1<<1,
+ FLAGS_LEFT = 1<<2,
+ FLAGS_ALT = 1<<3,
+ FLAGS_SHORT = 1<<4,
+ FLAGS_LONG = 1<<5,
+ FLAGS_LONGLONG = 1<<6,
+ FLAGS_LONGDOUBLE = 1<<7,
+ FLAGS_PAD_NIL = 1<<8,
+ FLAGS_UNSIGNED = 1<<9,
+ FLAGS_OCTAL = 1<<10,
+ FLAGS_HEX = 1<<11,
+ FLAGS_UPPER = 1<<12,
+ FLAGS_WIDTH = 1<<13, /* '*' or '*<num>$' used */
+ FLAGS_WIDTHPARAM = 1<<14, /* width PARAMETER was specified */
+ FLAGS_PREC = 1<<15, /* precision was specified */
+ FLAGS_PRECPARAM = 1<<16, /* precision PARAMETER was specified */
+ FLAGS_CHAR = 1<<17, /* %c story */
+ FLAGS_FLOATE = 1<<18, /* %e or %E */
+ FLAGS_FLOATG = 1<<19 /* %g or %G */
+};
+
+typedef struct {
+ FormatType type;
+ int flags;
+ int width; /* width OR width parameter number */
+ int precision; /* precision OR precision parameter number */
+ union {
+ char *str;
+ void *ptr;
+ long num;
+#if SIZEOF_LONG_LONG /* if this is non-zero */
+ long long lnum;
+#endif
+ double dnum;
+#if SIZEOF_LONG_DOUBLE
+ long double ldnum;
+#endif
+ } data;
+} va_stack_t;
+
+struct nsprintf {
+ char *buffer;
+ size_t length;
+ size_t max;
+};
+
+struct asprintf {
+ char *buffer; /* allocated buffer */
+ size_t len; /* length of string */
+ size_t alloc; /* length of alloc */
+};
+
+int msprintf(char *buffer, const char *format, ...);
+
+static int dprintf_DollarString(char *input, char **end)
+{
+ int number=0;
+ while(isdigit((int)*input)) {
+ number *= 10;
+ number += *input-'0';
+ input++;
+ }
+ if(number && ('$'==*input++)) {
+ *end = input;
+ return number;
+ }
+ return 0;
+}
+
+static BOOL dprintf_IsQualifierNoDollar(char c)
+{
+ switch (c) {
+ case '-': case '+': case ' ': case '#': case '.':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case 'h': case 'l': case 'L': case 'Z': case 'q':
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+#ifdef DPRINTF_DEBUG2
+int dprintf_Pass1Report(va_stack_t *vto, int max)
+{
+ int i;
+ char buffer[128];
+ int bit;
+ int flags;
+
+ for(i=0; i<max; i++) {
+ char *type;
+ switch(vto[i].type) {
+ case FORMAT_UNKNOWN:
+ type = "unknown";
+ break;
+ case FORMAT_STRING:
+ type ="string";
+ break;
+ case FORMAT_PTR:
+ type ="pointer";
+ break;
+ case FORMAT_INT:
+ type = "int";
+ break;
+ case FORMAT_LONG:
+ type = "long";
+ break;
+ case FORMAT_LONGLONG:
+ type = "long long";
+ break;
+ case FORMAT_DOUBLE:
+ type = "double";
+ break;
+ case FORMAT_LONGDOUBLE:
+ type = "long double";
+ break;
+ }
+
+
+ buffer[0]=0;
+
+ for(bit=0; bit<31; bit++) {
+ flags = vto[i].flags & (1<<bit);
+
+ if(flags & FLAGS_SPACE)
+ strcat(buffer, "space ");
+ else if(flags & FLAGS_SHOWSIGN)
+ strcat(buffer, "plus ");
+ else if(flags & FLAGS_LEFT)
+ strcat(buffer, "left ");
+ else if(flags & FLAGS_ALT)
+ strcat(buffer, "alt ");
+ else if(flags & FLAGS_SHORT)
+ strcat(buffer, "short ");
+ else if(flags & FLAGS_LONG)
+ strcat(buffer, "long ");
+ else if(flags & FLAGS_LONGLONG)
+ strcat(buffer, "longlong ");
+ else if(flags & FLAGS_LONGDOUBLE)
+ strcat(buffer, "longdouble ");
+ else if(flags & FLAGS_PAD_NIL)
+ strcat(buffer, "padnil ");
+ else if(flags & FLAGS_UNSIGNED)
+ strcat(buffer, "unsigned ");
+ else if(flags & FLAGS_OCTAL)
+ strcat(buffer, "octal ");
+ else if(flags & FLAGS_HEX)
+ strcat(buffer, "hex ");
+ else if(flags & FLAGS_UPPER)
+ strcat(buffer, "upper ");
+ else if(flags & FLAGS_WIDTH)
+ strcat(buffer, "width ");
+ else if(flags & FLAGS_WIDTHPARAM)
+ strcat(buffer, "widthparam ");
+ else if(flags & FLAGS_PREC)
+ strcat(buffer, "precision ");
+ else if(flags & FLAGS_PRECPARAM)
+ strcat(buffer, "precparam ");
+ else if(flags & FLAGS_CHAR)
+ strcat(buffer, "char ");
+ else if(flags & FLAGS_FLOATE)
+ strcat(buffer, "floate ");
+ else if(flags & FLAGS_FLOATG)
+ strcat(buffer, "floatg ");
+ }
+ printf("REPORT: %d. %s [%s]\n", i, type, buffer);
+
+ }
+
+
+}
+#endif
+
+/******************************************************************
+ *
+ * Pass 1:
+ * Create an index with the type of each parameter entry and its
+ * value (may vary in size)
+ *
+ ******************************************************************/
+
+static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list arglist)
+{
+ char *fmt = format;
+ int param_num = 0;
+ int this_param;
+ int width;
+ int precision;
+ int flags;
+ int max_param=0;
+ int i;
+
+ while (*fmt) {
+ if (*fmt++ == '%') {
+ if (*fmt == '%') {
+ fmt++;
+ continue; /* while */
+ }
+
+ flags = FLAGS_NEW;
+
+ /* Handle the positional case (N$) */
+
+ param_num++;
+
+ this_param = dprintf_DollarString(fmt, &fmt);
+ if (0 == this_param)
+ /* we got no positional, get the next counter */
+ this_param = param_num;
+
+ if (this_param > max_param)
+ max_param = this_param;
+
+ /*
+ * The parameter with number 'i' should be used. Next, we need
+ * to get SIZE and TYPE of the parameter. Add the information
+ * to our array.
+ */
+
+ width = 0;
+ precision = 0;
+
+ /* Handle the flags */
+
+ while (dprintf_IsQualifierNoDollar(*fmt)) {
+ switch (*fmt++) {
+ case ' ':
+ flags |= FLAGS_SPACE;
+ break;
+ case '+':
+ flags |= FLAGS_SHOWSIGN;
+ break;
+ case '-':
+ flags |= FLAGS_LEFT;
+ flags &= ~FLAGS_PAD_NIL;
+ break;
+ case '#':
+ flags |= FLAGS_ALT;
+ break;
+ case '.':
+ flags |= FLAGS_PREC;
+ if ('*' == *fmt) {
+ /* The precision is picked from a specified parameter */
+
+ flags |= FLAGS_PRECPARAM;
+ fmt++;
+ param_num++;
+
+ i = dprintf_DollarString(fmt, &fmt);
+ if (i)
+ precision = i;
+ else
+ precision = param_num;
+
+ if (precision > max_param)
+ max_param = precision;
+ }
+ else {
+ flags |= FLAGS_PREC;
+ precision = strtol(fmt, &fmt, 10);
+ }
+ break;
+ case 'h':
+ flags |= FLAGS_SHORT;
+ break;
+ case 'l':
+ if (flags & FLAGS_LONG)
+ flags |= FLAGS_LONGLONG;
+ else
+ flags |= FLAGS_LONG;
+ break;
+ case 'L':
+ flags |= FLAGS_LONGDOUBLE;
+ break;
+ case 'q':
+ flags |= FLAGS_LONGLONG;
+ break;
+ case 'Z':
+ if (sizeof(size_t) > sizeof(unsigned long int))
+ flags |= FLAGS_LONGLONG;
+ if (sizeof(size_t) > sizeof(unsigned int))
+ flags |= FLAGS_LONG;
+ break;
+ case '0':
+ if (!(flags & FLAGS_LEFT))
+ flags |= FLAGS_PAD_NIL;
+ /* FALLTHROUGH */
+ case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ flags |= FLAGS_WIDTH;
+ width = strtol(--fmt, &fmt, 10);
+ break;
+ case '*': /* Special case */
+ flags |= FLAGS_WIDTHPARAM;
+ param_num++;
+
+ i = dprintf_DollarString(fmt, &fmt);
+ if(i)
+ width = i;
+ else
+ width = param_num;
+ if(width > max_param)
+ max_param=width;
+ break;
+ default:
+ break;
+ }
+ } /* switch */
+
+ /* Handle the specifier */
+
+ i = this_param - 1;
+
+ switch (*fmt) {
+ case 'S':
+ flags |= FLAGS_ALT;
+ /* FALLTHROUGH */
+ case 's':
+ vto[i].type = FORMAT_STRING;
+ break;
+ case 'n':
+ vto[i].type = FORMAT_INTPTR;
+ break;
+ case 'p':
+ vto[i].type = FORMAT_PTR;
+ break;
+ case 'd': case 'i':
+ vto[i].type = FORMAT_INT;
+ break;
+ case 'u':
+ vto[i].type = FORMAT_INT;
+ flags |= FLAGS_UNSIGNED;
+ break;
+ case 'o':
+ vto[i].type = FORMAT_INT;
+ flags |= FLAGS_OCTAL;
+ break;
+ case 'x':
+ vto[i].type = FORMAT_INT;
+ flags |= FLAGS_HEX;
+ break;
+ case 'X':
+ vto[i].type = FORMAT_INT;
+ flags |= FLAGS_HEX|FLAGS_UPPER;
+ break;
+ case 'c':
+ vto[i].type = FORMAT_INT;
+ flags |= FLAGS_CHAR;
+ break;
+ case 'f':
+ vto[i].type = FORMAT_DOUBLE;
+ break;
+ case 'e': case 'E':
+ vto[i].type = FORMAT_DOUBLE;
+ flags |= FLAGS_FLOATE| (('E' == *fmt)?FLAGS_UPPER:0);
+ break;
+ case 'g': case 'G':
+ vto[i].type = FORMAT_DOUBLE;
+ flags |= FLAGS_FLOATG| (('G' == *fmt)?FLAGS_UPPER:0);
+ break;
+ default:
+ vto[i].type = FORMAT_UNKNOWN;
+ break;
+ } /* switch */
+
+ vto[i].flags = flags;
+ vto[i].width = width;
+ vto[i].precision = precision;
+
+ if (flags & FLAGS_WIDTHPARAM) {
+ /* we have the width specified from a parameter, so we make that
+ parameter's info setup properly */
+ vto[i].width = width - 1;
+ i = width - 1;
+ vto[i].type = FORMAT_WIDTH;
+ vto[i].flags = FLAGS_NEW;
+ vto[i].precision = vto[i].width = 0; /* can't use width or precision
+ of width! */
+ }
+ if (flags & FLAGS_PRECPARAM) {
+ /* we have the precision specified from a parameter, so we make that
+ parameter's info setup properly */
+ vto[i].precision = precision - 1;
+ i = precision - 1;
+ vto[i].type = FORMAT_WIDTH;
+ vto[i].flags = FLAGS_NEW;
+ vto[i].precision = vto[i].width = 0; /* can't use width or precision
+ of width! */
+ }
+ *endpos++ = fmt + 1; /* end of this sequence */
+ }
+ }
+
+#ifdef DPRINTF_DEBUG2
+ dprintf_Pass1Report(vto, max_param);
+#endif
+
+ /* Read the arg list parameters into our data list */
+ for (i=0; i<max_param; i++) {
+ if ((i + 1 < max_param) && (vto[i + 1].type == FORMAT_WIDTH))
+ {
+ /* Width/precision arguments must be read before the main argument
+ * they are attached to
+ */
+ vto[i + 1].data.num = va_arg(arglist, int);
+ }
+
+ switch (vto[i].type)
+ {
+ case FORMAT_STRING:
+ vto[i].data.str = va_arg(arglist, char *);
+ break;
+
+ case FORMAT_INTPTR:
+ case FORMAT_UNKNOWN:
+ case FORMAT_PTR:
+ vto[i].data.ptr = va_arg(arglist, void *);
+ break;
+
+ case FORMAT_INT:
+#if SIZEOF_LONG_LONG
+ if(vto[i].flags & FLAGS_LONGLONG)
+ vto[i].data.lnum = va_arg(arglist, long long);
+ else
+#endif
+ if(vto[i].flags & FLAGS_LONG)
+ vto[i].data.num = va_arg(arglist, long);
+ else
+ vto[i].data.num = va_arg(arglist, int);
+ break;
+
+ case FORMAT_DOUBLE:
+#if SIZEOF_LONG_DOUBLE
+ if(vto[i].flags & FLAGS_LONG)
+ vto[i].data.ldnum = va_arg(arglist, long double);
+ else
+#endif
+ vto[i].data.dnum = va_arg(arglist, double);
+ break;
+
+ case FORMAT_WIDTH:
+ /* Argument has been read. Silently convert it into an integer
+ * for later use
+ */
+ vto[i].type = FORMAT_INT;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return max_param;
+
+}
+
+static int dprintf_formatf(
+ void *data, /* untouched by format(), just sent to the
+ stream() function in the first argument */
+ int (*stream)(int, FILE *), /* function pointer called for each
+ output character */
+ const char *format, /* %-formatted string */
+ va_list ap_save) /* list of parameters */
+{
+ /* Base-36 digits for numbers. */
+ const char *digits = lower_digits;
+
+ /* Pointer into the format string. */
+ char *f;
+
+ /* Number of characters written. */
+ register size_t done = 0;
+
+ long param; /* current parameter to read */
+ long param_num=0; /* parameter counter */
+
+ va_stack_t vto[MAX_PARAMETERS];
+ char *endpos[MAX_PARAMETERS];
+ char **end;
+
+ char work[BUFFSIZE];
+
+ va_stack_t *p;
+
+ /* Do the actual %-code parsing */
+ dprintf_Pass1((char *)format, vto, endpos, ap_save);
+
+ end = &endpos[0]; /* the initial end-position from the list dprintf_Pass1()
+ created for us */
+
+ f = (char *)format;
+ while (*f != '\0') {
+ /* Format spec modifiers. */
+ char alt;
+
+ /* Width of a field. */
+ register long width;
+ /* Precision of a field. */
+ long prec;
+
+ /* Decimal integer is negative. */
+ char is_neg;
+
+ /* Base of a number to be written. */
+ long base;
+
+ /* Integral values to be written. */
+#if SIZEOF_LONG_LONG
+ unsigned long long num;
+#else
+ unsigned long num;
+#endif
+ long signed_num;
+
+ if (*f != '%') {
+ /* This isn't a format spec, so write everything out until the next one
+ OR end of string is reached. */
+ do {
+ OUTCHAR(*f);
+ } while(*++f && ('%' != *f));
+ continue;
+ }
+
+ ++f;
+
+ /* Check for "%%". Note that although the ANSI standard lists
+ '%' as a conversion specifier, it says "The complete format
+ specification shall be `%%'," so we can avoid all the width
+ and precision processing. */
+ if (*f == '%') {
+ ++f;
+ OUTCHAR('%');
+ continue;
+ }
+
+ /* If this is a positional parameter, the position must follow imediately
+ after the %, thus create a %<num>$ sequence */
+ param=dprintf_DollarString(f, &f);
+
+ if(!param)
+ param = param_num;
+ else
+ --param;
+
+ param_num++; /* increase this always to allow "%2$s %1$s %s" and then the
+ third %s will pick the 3rd argument */
+
+ p = &vto[param];
+
+ /* pick up the specified width */
+ if(p->flags & FLAGS_WIDTHPARAM)
+ width = vto[p->width].data.num;
+ else
+ width = p->width;
+
+ /* pick up the specified precision */
+ if(p->flags & FLAGS_PRECPARAM)
+ prec = vto[p->precision].data.num;
+ else if(p->flags & FLAGS_PREC)
+ prec = p->precision;
+ else
+ prec = -1;
+
+ alt = p->flags & FLAGS_ALT;
+
+ switch (p->type) {
+ case FORMAT_INT:
+ num = p->data.num;
+ if(p->flags & FLAGS_CHAR) {
+ /* Character. */
+ if (!(p->flags & FLAGS_LEFT))
+ while (--width > 0)
+ OUTCHAR(' ');
+ OUTCHAR((char) num);
+ if (p->flags & FLAGS_LEFT)
+ while (--width > 0)
+ OUTCHAR(' ');
+ break;
+ }
+ if(p->flags & FLAGS_UNSIGNED) {
+ /* Decimal unsigned integer. */
+ base = 10;
+ goto unsigned_number;
+ }
+ if(p->flags & FLAGS_OCTAL) {
+ /* Octal unsigned integer. */
+ base = 8;
+ goto unsigned_number;
+ }
+ if(p->flags & FLAGS_HEX) {
+ /* Hexadecimal unsigned integer. */
+
+ digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;
+ base = 16;
+ goto unsigned_number;
+ }
+
+ /* Decimal integer. */
+ base = 10;
+
+#if SIZEOF_LONG_LONG
+ if(p->flags & FLAGS_LONGLONG) {
+ /* long long */
+ num = p->data.lnum;
+ is_neg = num < 0;
+ num = is_neg ? (- num) : num;
+ }
+ else
+#endif
+ {
+ signed_num = (long) num;
+
+ is_neg = signed_num < 0;
+ num = is_neg ? (- signed_num) : signed_num;
+ }
+ goto number;
+
+ unsigned_number:;
+ /* Unsigned number of base BASE. */
+ is_neg = 0;
+
+ number:;
+ /* Number of base BASE. */
+ {
+ char *workend = &work[sizeof(work) - 1];
+ register char *w;
+
+ /* Supply a default precision if none was given. */
+ if (prec == -1)
+ prec = 1;
+
+ /* Put the number in WORK. */
+ w = workend;
+ while (num > 0) {
+ *w-- = digits[num % base];
+ num /= base;
+ }
+ width -= workend - w;
+ prec -= workend - w;
+
+ if (alt && base == 8 && prec <= 0) {
+ *w-- = '0';
+ --width;
+ }
+
+ if (prec > 0) {
+ width -= prec;
+ while (prec-- > 0)
+ *w-- = '0';
+ }
+
+ if (alt && base == 16)
+ width -= 2;
+
+ if (is_neg || (p->flags & FLAGS_SHOWSIGN) || (p->flags & FLAGS_SPACE))
+ --width;
+
+ if (!(p->flags & FLAGS_LEFT) && !(p->flags & FLAGS_PAD_NIL))
+ while (width-- > 0)
+ OUTCHAR(' ');
+
+ if (is_neg)
+ OUTCHAR('-');
+ else if (p->flags & FLAGS_SHOWSIGN)
+ OUTCHAR('+');
+ else if (p->flags & FLAGS_SPACE)
+ OUTCHAR(' ');
+
+ if (alt && base == 16) {
+ OUTCHAR('0');
+ if(p->flags & FLAGS_UPPER)
+ OUTCHAR('X');
+ else
+ OUTCHAR('x');
+ }
+
+ if (!(p->flags & FLAGS_LEFT) && (p->flags & FLAGS_PAD_NIL))
+ while (width-- > 0)
+ OUTCHAR('0');
+
+ /* Write the number. */
+ while (++w <= workend) {
+ OUTCHAR(*w);
+ }
+
+ if (p->flags & FLAGS_LEFT)
+ while (width-- > 0)
+ OUTCHAR(' ');
+ }
+ break;
+
+ case FORMAT_STRING:
+ /* String. */
+ {
+ static char null[] = "(nil)";
+ char *str;
+ size_t len;
+
+ str = (char *) p->data.str;
+ if ( str == NULL) {
+ /* Write null[] if there's space. */
+ if (prec == -1 || prec >= (long) sizeof(null) - 1) {
+ str = null;
+ len = sizeof(null) - 1;
+ /* Disable quotes around (nil) */
+ p->flags &= (~FLAGS_ALT);
+ }
+ else {
+ str = "";
+ len = 0;
+ }
+ }
+ else
+ len = strlen(str);
+
+ if (prec != -1 && (size_t) prec < len)
+ len = prec;
+ width -= len;
+
+ if (p->flags & FLAGS_ALT)
+ OUTCHAR('"');
+
+ if (!(p->flags&FLAGS_LEFT))
+ while (width-- > 0)
+ OUTCHAR(' ');
+
+ while (len-- > 0)
+ OUTCHAR(*str++);
+ if (p->flags&FLAGS_LEFT)
+ while (width-- > 0)
+ OUTCHAR(' ');
+
+ if (p->flags & FLAGS_ALT)
+ OUTCHAR('"');
+ }
+ break;
+
+ case FORMAT_PTR:
+ /* Generic pointer. */
+ {
+ void *ptr;
+ ptr = (void *) p->data.ptr;
+ if (ptr != NULL) {
+ /* If the pointer is not NULL, write it as a %#x spec. */
+ base = 16;
+ digits = (p->flags & FLAGS_UPPER)? upper_digits : lower_digits;
+ alt = 1;
+ num = (unsigned long) ptr;
+ is_neg = 0;
+ goto number;
+ }
+ else {
+ /* Write "(nil)" for a nil pointer. */
+ static char nil[] = "(nil)";
+ register char *point;
+
+ width -= sizeof(nil) - 1;
+ if (p->flags & FLAGS_LEFT)
+ while (width-- > 0)
+ OUTCHAR(' ');
+ for (point = nil; *point != '\0'; ++point)
+ OUTCHAR(*point);
+ if (! (p->flags & FLAGS_LEFT))
+ while (width-- > 0)
+ OUTCHAR(' ');
+ }
+ }
+ break;
+
+ case FORMAT_DOUBLE:
+ {
+ char formatbuf[32]="%";
+ char *fptr;
+
+ width = -1;
+ if (p->flags & FLAGS_WIDTH)
+ width = p->width;
+ else if (p->flags & FLAGS_WIDTHPARAM)
+ width = vto[p->width].data.num;
+
+ prec = -1;
+ if (p->flags & FLAGS_PREC)
+ prec = p->precision;
+ else if (p->flags & FLAGS_PRECPARAM)
+ prec = vto[p->precision].data.num;
+
+ if (p->flags & FLAGS_LEFT)
+ strcat(formatbuf, "-");
+ if (p->flags & FLAGS_SHOWSIGN)
+ strcat(formatbuf, "+");
+ if (p->flags & FLAGS_SPACE)
+ strcat(formatbuf, " ");
+ if (p->flags & FLAGS_ALT)
+ strcat(formatbuf, "#");
+
+ fptr=&formatbuf[strlen(formatbuf)];
+
+ if(width >= 0) {
+ /* RECURSIVE USAGE */
+ fptr += msprintf(fptr, "%d", width);
+ }
+ if(prec >= 0) {
+ /* RECURSIVE USAGE */
+ fptr += msprintf(fptr, ".%d", prec);
+ }
+ if (p->flags & FLAGS_LONG)
+ strcat(fptr, "l");
+
+ if (p->flags & FLAGS_FLOATE)
+ strcat(fptr, p->flags&FLAGS_UPPER?"E":"e");
+ else if (p->flags & FLAGS_FLOATG)
+ strcat(fptr, (p->flags & FLAGS_UPPER) ? "G" : "g");
+ else
+ strcat(fptr, "f");
+
+ /* NOTE NOTE NOTE!! Not all sprintf() implementations returns number
+ of output characters */
+#if SIZEOF_LONG_DOUBLE
+ if (p->flags & FLAGS_LONG)
+ /* This is for support of the 'long double' type */
+ (sprintf)(work, formatbuf, p->data.ldnum);
+ else
+#endif
+ (sprintf)(work, formatbuf, p->data.dnum);
+
+ for(fptr=work; *fptr; fptr++)
+ OUTCHAR(*fptr);
+ }
+ break;
+
+ case FORMAT_INTPTR:
+ /* Answer the count of characters written. */
+#if SIZEOF_LONG_LONG
+ if (p->flags & FLAGS_LONGLONG)
+ *(long long int *) p->data.ptr = done;
+ else
+#endif
+ if (p->flags & FLAGS_LONG)
+ *(long int *) p->data.ptr = done;
+ else if (!(p->flags & FLAGS_SHORT))
+ *(int *) p->data.ptr = done;
+ else
+ *(short int *) p->data.ptr = done;
+ break;
+
+ default:
+ break;
+ }
+ f = *end++; /* goto end of %-code */
+
+ }
+ return done;
+}
+
+static int StoreNonPrintable(int output, struct nsprintf *infop)
+{
+ /* If the character isn't printable then we convert it */
+ char work[64], *w;
+ int num = output;
+
+ w = &work[sizeof(work)];
+ *(--w) = (char)0;
+ for(; num > 0; num /= 10) {
+ *(--w) = lower_digits[num % 10];
+ }
+ if (infop->length + strlen(w) + 1 < infop->max)
+ {
+ infop->buffer[0] = '\\';
+ infop->buffer++;
+ infop->length++;
+ for (; *w; w++)
+ {
+ infop->buffer[0] = *w;
+ infop->buffer++;
+ infop->length++;
+ }
+ return output;
+ }
+ return -1;
+}
+
+/* fputc() look-alike */
+static int addbyter(int output, FILE *data)
+{
+ struct nsprintf *infop=(struct nsprintf *)data;
+
+ if(infop->length < infop->max) {
+ /* only do this if we haven't reached max length yet */
+ if (isprint(output) || isspace(output))
+ {
+ infop->buffer[0] = (char)output; /* store */
+ infop->buffer++; /* increase pointer */
+ infop->length++; /* we are now one byte larger */
+ }
+ else
+ {
+ return StoreNonPrintable(output, infop);
+ }
+ return output; /* fputc() returns like this on success */
+ }
+ return -1;
+}
+
+int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
+{
+ va_list ap_save; /* argument pointer */
+ int retcode;
+ struct nsprintf info;
+
+ info.buffer = buffer;
+ info.length = 0;
+ info.max = maxlength;
+
+ va_start(ap_save, format);
+ retcode = dprintf_formatf(&info, addbyter, format, ap_save);
+ va_end(ap_save);
+ info.buffer[0] = 0; /* we terminate this with a zero byte */
+
+ /* we could even return things like */
+
+ return retcode;
+}
+
+int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list ap_save)
+{
+ int retcode;
+ struct nsprintf info;
+
+ info.buffer = buffer;
+ info.length = 0;
+ info.max = maxlength;
+
+ retcode = dprintf_formatf(&info, addbyter, format, ap_save);
+ info.buffer[0] = 0; /* we terminate this with a zero byte */
+ return retcode;
+}
+
+
+/* fputc() look-alike */
+static int alloc_addbyter(int output, FILE *data)
+{
+ struct asprintf *infop=(struct asprintf *)data;
+
+ if(!infop->buffer) {
+ infop->buffer=(char *)malloc(32);
+ if(!infop->buffer)
+ return -1; /* fail */
+ infop->alloc = 32;
+ infop->len =0;
+ }
+ else if(infop->len+1 >= infop->alloc) {
+ char *newptr;
+
+ newptr = (char *)realloc(infop->buffer, infop->alloc*2);
+
+ if(!newptr) {
+ return -1;
+ }
+ infop->buffer = newptr;
+ infop->alloc *= 2;
+ }
+
+ infop->buffer[ infop->len ] = output;
+
+ infop->len++;
+
+ return output; /* fputc() returns like this on success */
+
+}
+
+char *maprintf(const char *format, ...)
+{
+ va_list ap_save; /* argument pointer */
+ int retcode;
+ struct asprintf info;
+
+ info.buffer = NULL;
+ info.len = 0;
+ info.alloc = 0;
+
+ va_start(ap_save, format);
+ retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
+ va_end(ap_save);
+ if(info.len) {
+ info.buffer[info.len] = 0; /* we terminate this with a zero byte */
+ return info.buffer;
+ }
+ else
+ return NULL;
+}
+
+char *mvaprintf(const char *format, va_list ap_save)
+{
+ int retcode;
+ struct asprintf info;
+
+ info.buffer = NULL;
+ info.len = 0;
+ info.alloc = 0;
+
+ retcode = dprintf_formatf(&info, alloc_addbyter, format, ap_save);
+ info.buffer[info.len] = 0; /* we terminate this with a zero byte */
+ if(info.len) {
+ info.buffer[info.len] = 0; /* we terminate this with a zero byte */
+ return info.buffer;
+ }
+ else
+ return NULL;
+}
+
+static int storebuffer(int output, FILE *data)
+{
+ char **buffer = (char **)data;
+ **buffer = (char)output;
+ (*buffer)++;
+ return output; /* act like fputc() ! */
+}
+
+int msprintf(char *buffer, const char *format, ...)
+{
+ va_list ap_save; /* argument pointer */
+ int retcode;
+ va_start(ap_save, format);
+ retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
+ va_end(ap_save);
+ *buffer=0; /* we terminate this with a zero byte */
+ return retcode;
+}
+
+extern int fputc(int, FILE *);
+
+int mprintf(const char *format, ...)
+{
+ int retcode;
+ va_list ap_save; /* argument pointer */
+ va_start(ap_save, format);
+ retcode = dprintf_formatf(stdout, fputc, format, ap_save);
+ va_end(ap_save);
+ return retcode;
+}
+
+int mfprintf(FILE *whereto, const char *format, ...)
+{
+ int retcode;
+ va_list ap_save; /* argument pointer */
+ va_start(ap_save, format);
+ retcode = dprintf_formatf(whereto, fputc, format, ap_save);
+ va_end(ap_save);
+ return retcode;
+}
+
+int mvsprintf(char *buffer, const char *format, va_list ap_save)
+{
+ int retcode;
+ retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
+ *buffer=0; /* we terminate this with a zero byte */
+ return retcode;
+}
+
+int mvprintf(const char *format, va_list ap_save)
+{
+ return dprintf_formatf(stdout, fputc, format, ap_save);
+}
+
+int mvfprintf(FILE *whereto, const char *format, va_list ap_save)
+{
+ return dprintf_formatf(whereto, fputc, format, ap_save);
+}
+
+#ifdef DPRINTF_DEBUG
+int main()
+{
+ char buffer[129];
+ char *ptr;
+#ifdef SIZEOF_LONG_LONG
+ long long hullo;
+ dprintf("%3$12s %1$s %2$qd %4$d\n", "daniel", hullo, "stenberg", 65);
+#endif
+
+ mprintf("%3d %5d\n", 10, 1998);
+
+ ptr=maprintf("test this then baby %s%s%s%s%s%s %d %d %d loser baby get a hit in yer face now!", "", "pretty long string pretty long string pretty long string pretty long string pretty long string", "/", "/", "/", "pretty long string", 1998, 1999, 2001);
+
+ puts(ptr);
+
+ memset(ptr, 55, strlen(ptr)+1);
+
+ free(ptr);
+
+#if 1
+ mprintf(buffer, "%s %s %d", "daniel", "stenberg", 19988);
+ puts(buffer);
+
+ mfprintf(stderr, "%s %#08x\n", "dummy", 65);
+
+ printf("%s %#08x\n", "dummy", 65);
+ {
+ double tryout = 3.14156592;
+ mprintf(buffer, "%.2g %G %f %e %E", tryout, tryout, tryout, tryout, tryout);
+ puts(buffer);
+ printf("%.2g %G %f %e %E\n", tryout, tryout, tryout, tryout, tryout);
+ }
+#endif
+
+ return 0;
+}
+
+#endif
diff --git a/lib/netrc.c b/lib/netrc.c
new file mode 100644
index 000000000..f0e1382fe
--- /dev/null
+++ b/lib/netrc.c
@@ -0,0 +1,182 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rafael Sagula <sagula@inf.ufrgs.br>
+ * Sampo Kellomaki <sampo@iki.fi>
+ * Linas Vepstas <linas@linas.org>
+ * Bjorn Reese <breese@imada.ou.dk>
+ * Johan Anderson <johan@homemail.com>
+ * Kjell Ericson <Kjell.Ericson@haxx.nu>
+ * Troy Engel <tengel@palladium.net>
+ * Ryan Nelson <ryan@inch.com>
+ * Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "setup.h"
+#include "getenv.h"
+
+/* Debug this single source file with:
+ 'make netrc' then run './netrc'!
+
+ Oh, make sure you have a .netrc file too ;-)
+ */
+
+/* Get user and password from .netrc when given a machine name */
+
+enum {
+ NOTHING,
+ HOSTFOUND, /* the 'machine' keyword was found */
+ HOSTCOMPLETE, /* the machine name following the keyword was found too */
+ HOSTVALID, /* this is "our" machine! */
+
+ HOSTEND /* LAST enum */
+};
+
+/* make sure we have room for at least this size: */
+#define LOGINSIZE 64
+#define PASSWORDSIZE 64
+
+int ParseNetrc(char *host,
+ char *login,
+ char *password)
+{
+ FILE *file;
+ char netrcbuffer[256];
+ int retcode=1;
+
+ char *home = GetEnv("HOME"); /* portable environment reader */
+ int state=NOTHING;
+
+ char state_login=0;
+ char state_password=0;
+
+#define NETRC DOT_CHAR "netrc"
+
+ if(!home || (strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))))
+ return -1;
+
+ sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
+
+ file = fopen(netrcbuffer, "r");
+ if(file) {
+ char *tok;
+ while(fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
+ tok=strtok(netrcbuffer, " \t\n");
+ while(tok) {
+ switch(state) {
+ case NOTHING:
+ if(strequal("machine", tok)) {
+ /* the next tok is the machine name, this is in itself the
+ delimiter that starts the stuff entered for this machine,
+ after this we need to search for 'login' and
+ 'password'. */
+ state=HOSTFOUND;
+ }
+ break;
+ case HOSTFOUND:
+ if(strequal(host, tok)) {
+ /* and yes, this is our host! */
+ state=HOSTVALID;
+#ifdef _NETRC_DEBUG
+ printf("HOST: %s\n", tok);
+#endif
+ retcode=0; /* we did find our host */
+ }
+ else
+ /* not our host */
+ state=NOTHING;
+ break;
+ case HOSTVALID:
+ /* we are now parsing sub-keywords concerning "our" host */
+ if(state_login) {
+ strncpy(login, tok, LOGINSIZE-1);
+#ifdef _NETRC_DEBUG
+ printf("LOGIN: %s\n", login);
+#endif
+ state_login=0;
+ }
+ else if(state_password) {
+ strncpy(password, tok, PASSWORDSIZE-1);
+#if _NETRC_DEBUG
+ printf("PASSWORD: %s\n", password);
+#endif
+ state_password=0;
+ }
+ else if(strequal("login", tok))
+ state_login=1;
+ else if(strequal("password", tok))
+ state_password=1;
+ else if(strequal("machine", tok)) {
+ /* ok, there's machine here go => */
+ state = HOSTFOUND;
+ }
+ break;
+ } /* switch (state) */
+ tok = strtok(NULL, " \t\n");
+ } /* while (tok) */
+ } /* while fgets() */
+
+ fclose(file);
+ }
+
+ return retcode;
+}
+
+#ifdef _NETRC_DEBUG
+int main(int argc, char **argv)
+{
+ char login[64]="";
+ char password[64]="";
+
+ if(argc<2)
+ return -1;
+
+ if(0 == ParseNetrc(argv[1], login, password)) {
+ printf("HOST: %s LOGIN: %s PASSWORD: %s\n",
+ argv[1], login, password);
+ }
+}
+
+#endif
diff --git a/lib/netrc.h b/lib/netrc.h
new file mode 100644
index 000000000..2875cbc53
--- /dev/null
+++ b/lib/netrc.h
@@ -0,0 +1,70 @@
+#ifndef __NETRC_H
+#define __NETRC_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * Contributor(s):
+ * Rafael Sagula <sagula@inf.ufrgs.br>
+ * Sampo Kellomaki <sampo@iki.fi>
+ * Linas Vepstas <linas@linas.org>
+ * Bjorn Reese <breese@imada.ou.dk>
+ * Johan Anderson <johan@homemail.com>
+ * Kjell Ericson <Kjell.Ericson@haxx.nu>
+ * Troy Engel <tengel@palladium.net>
+ * Ryan Nelson <ryan@inch.com>
+ * Bjorn Stenberg <Bjorn.Stenberg@haxx.nu>
+ * Angus Mackay <amackay@gus.ml.org>
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ * $Log$
+ * Revision 1.1 1999-12-29 14:21:35 bagder
+ * Initial revision
+ *
+ * Revision 1.3 1999/09/06 06:59:41 dast
+ * Changed email info
+ *
+ * Revision 1.2 1999/08/13 07:34:48 dast
+ * Changed the URL in the header
+ *
+ * Revision 1.1.1.1 1999/03/11 22:23:34 dast
+ * Imported sources
+ *
+ ****************************************************************************/
+int ParseNetrc(char *host,
+ char *login,
+ char *password);
+#endif
diff --git a/lib/progress.c b/lib/progress.c
new file mode 100644
index 000000000..6a083370b
--- /dev/null
+++ b/lib/progress.c
@@ -0,0 +1,221 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <string.h>
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#if defined(__MINGW32__)
+#include <winsock.h>
+#endif
+#include <time.h>
+#endif
+
+#include <curl/curl.h>
+#include "urldata.h"
+
+#include "progress.h"
+
+/* --- start of progress routines --- */
+int progressmax=-1;
+
+static int prev = 0;
+static int width = 0;
+
+void ProgressInit(struct UrlData *data, int max)
+{
+ if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
+ return;
+
+ prev = 0;
+
+/* TODO: get terminal width through ansi escapes or something similar.
+ try to update width when xterm is resized... - 19990617 larsa */
+ if (curl_GetEnv("COLUMNS") != NULL)
+ width = atoi(curl_GetEnv("COLUMNS"));
+ else
+ width = 80;
+
+ progressmax = max;
+ if(-1 == max)
+ return;
+ if(progressmax <= LEAST_SIZE_PROGRESS) {
+ progressmax = -1; /* disable */
+ return;
+ }
+
+ if ( data->progressmode == CURL_PROGRESS_STATS )
+ fprintf(data->err,
+ " %% Received Total Speed Time left Total Curr.Speed\n");
+}
+
+void time2str(char *r, int t)
+{
+ int h = (t/3600);
+ int m = (t-(h*3600))/60;
+ int s = (t-(h*3600)-(m*60));
+ sprintf(r,"%3d:%02d:%02d",h,m,s);
+}
+
+void ProgressShow(struct UrlData *data,
+ int point, struct timeval start, struct timeval now, bool force)
+{
+ switch ( data->progressmode ) {
+ case CURL_PROGRESS_STATS:
+ {
+ static long lastshow;
+ double percen;
+
+ double spent;
+ double speed;
+
+#define CURR_TIME 5
+
+ static int speeder[ CURR_TIME ];
+ static int speeder_c=0;
+
+ int nowindex = speeder_c% CURR_TIME;
+ int checkindex;
+ int count;
+
+ if(!force && (point != progressmax) && (lastshow == tvlong(now)))
+ return; /* never update this more than once a second if the end isn't
+ reached */
+
+ spent = tvdiff (now, start);
+ speed = point/(spent!=0.0?spent:1.0);
+ if(!speed)
+ speed=1;
+
+ /* point is where we are right now */
+ speeder[ nowindex ] = point;
+ speeder_c++; /* increase */
+ count = ((speeder_c>=CURR_TIME)?CURR_TIME:speeder_c) - 1;
+ checkindex = (speeder_c>=CURR_TIME)?speeder_c%CURR_TIME:0;
+
+ /* find out the average speed the last CURR_TIME seconds */
+ data->current_speed = (speeder[nowindex]-speeder[checkindex])/(count?count:1);
+
+#if 0
+ printf("NOW %d(%d) THEN %d(%d) DIFF %lf COUNT %d\n",
+ speeder[nowindex], nowindex,
+ speeder[checkindex], checkindex,
+ data->current_speed, count);
+#endif
+
+ if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
+ return;
+
+ if(-1 != progressmax) {
+ char left[20],estim[20];
+ int estimate = progressmax/(int) speed;
+
+ time2str(left,estimate-(int) spent);
+ time2str(estim,estimate);
+
+ percen=(double)point/progressmax;
+ percen=percen*100;
+
+ fprintf(data->err, "\r%3d %8d %8d %6.0lf %s %s %6.0lf ",
+ (int)percen, point, progressmax,
+ speed, left, estim, data->current_speed);
+ }
+ else
+ fprintf(data->err,
+ "\r%d bytes received in %.3lf seconds (%.0lf bytes/sec)",
+ point, spent, speed);
+
+ lastshow = now.tv_sec;
+ break;
+ }
+ case CURL_PROGRESS_BAR: /* 19990617 larsa */
+ {
+ if (point == prev) break;
+ if (progressmax == -1) {
+ int prevblock = prev / 1024;
+ int thisblock = point / 1024;
+ while ( thisblock > prevblock ) {
+ fprintf( data->err, "#" );
+ prevblock++;
+ }
+ prev = point;
+ } else {
+ char line[256];
+ char outline[256];
+ char format[40];
+ float frac = (float) point / (float) progressmax;
+ float percent = frac * 100.0f;
+ int barwidth = width - 7;
+ int num = (int) (((float)barwidth) * frac);
+ int i = 0;
+ for ( i = 0; i < num; i++ ) {
+ line[i] = '#';
+ }
+ line[i] = '\0';
+ sprintf( format, "%%-%ds %%5.1f%%%%", barwidth );
+ sprintf( outline, format, line, percent );
+ fprintf( data->err, "\r%s", outline );
+ }
+ prev = point;
+ break;
+ }
+ default: /* 19990617 larsa */
+ {
+ int prevblock = prev / 1024;
+ int thisblock = point / 1024;
+ if (prev == point) break;
+ while ( thisblock > prevblock ) {
+ fprintf( data->err, "#" );
+ prevblock++;
+ }
+ prev = point;
+ break;
+ }
+ }
+}
+
+void ProgressEnd(struct UrlData *data)
+{
+ if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
+ return;
+ fputs("\n", data->err);
+}
+
+/* --- end of progress routines --- */
diff --git a/lib/progress.h b/lib/progress.h
new file mode 100644
index 000000000..6babd89ca
--- /dev/null
+++ b/lib/progress.h
@@ -0,0 +1,54 @@
+#ifndef __PROGRESS_H
+#define __PROGRESS_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include "timeval.h"
+
+void ProgressInit(struct UrlData *data, int max);
+void ProgressShow(struct UrlData *data,
+ int point, struct timeval start, struct timeval now, bool force);
+void ProgressEnd(struct UrlData *data);
+void ProgressMode(int mode);
+
+/* Don't show progress for sizes smaller than: */
+#define LEAST_SIZE_PROGRESS BUFSIZE
+
+#endif /* __PROGRESS_H */
diff --git a/lib/sendf.c b/lib/sendf.c
new file mode 100644
index 000000000..387984d9d
--- /dev/null
+++ b/lib/sendf.c
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "setup.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#endif
+
+#include <curl/curl.h>
+#include "urldata.h"
+
+#include <curl/mprintf.h>
+
+/* infof() is for info message along the way */
+
+void infof(struct UrlData *data, char *fmt, ...)
+{
+ va_list ap;
+ if(data->conf & CONF_VERBOSE) {
+ va_start(ap, fmt);
+ fputs("* ", data->err);
+ vfprintf(data->err, fmt, ap);
+ va_end(ap);
+ }
+}
+
+/* failf() is for messages stating why we failed, the LAST one will be
+ returned for the user (if requested) */
+
+void failf(struct UrlData *data, char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ if(data->errorbuffer)
+ vsprintf(data->errorbuffer, fmt, ap);
+ else /* no errorbuffer receives this, write to data->err instead */
+ vfprintf(data->err, fmt, ap);
+ va_end(ap);
+}
+
+/* sendf() sends the formated data to the server */
+
+int sendf(int fd, struct UrlData *data, char *fmt, ...)
+{
+ size_t bytes_written;
+ char *s;
+ va_list ap;
+ va_start(ap, fmt);
+ s = mvaprintf(fmt, ap);
+ va_end(ap);
+ if(!s)
+ return 0; /* failure */
+ if(data->conf & CONF_VERBOSE)
+ fprintf(data->err, "> %s", s);
+#ifndef USE_SSLEAY
+ bytes_written = swrite(fd, s, strlen(s));
+#else
+ if (data->use_ssl) {
+ bytes_written = SSL_write(data->ssl, s, strlen(s));
+ } else {
+ bytes_written = swrite(fd, s, strlen(s));
+ }
+#endif /* USE_SSLEAY */
+ free(s); /* free the output string */
+ return(bytes_written);
+}
+
+
+
+
diff --git a/lib/sendf.h b/lib/sendf.h
new file mode 100644
index 000000000..de6571930
--- /dev/null
+++ b/lib/sendf.h
@@ -0,0 +1,47 @@
+#ifndef __SENDF_H
+#define __SENDF_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+int sendf(int fd, struct UrlData *, char *fmt, ...);
+void infof(struct UrlData *, char *fmt, ...);
+void failf(struct UrlData *, char *fmt, ...);
+
+#endif
diff --git a/lib/setup.h b/lib/setup.h
new file mode 100644
index 000000000..6770ec6c4
--- /dev/null
+++ b/lib/setup.h
@@ -0,0 +1,169 @@
+#ifndef __SETUP_H
+#define __SETUP_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+
+#if !defined(WIN32) && defined(_WIN32)
+/* This _might_ be a good Borland fix. Please report whether this works or
+ not! */
+#define WIN32
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h" /* the configure script results */
+#else
+#ifdef WIN32
+/* include the hand-modified win32 adjusted config.h! */
+#include "../config-win32.h"
+#endif
+#endif
+
+
+
+#ifndef OS
+#ifdef WIN32
+#define OS "win32"
+#else
+#define OS "unknown"
+#endif
+#endif
+
+#if defined(HAVE_X509_H) && defined(HAVE_SSL_H) && defined(HAVE_RSA_H) && \
+defined(HAVE_PEM_H) && defined(HAVE_ERR_H) && defined(HAVE_CRYPTO_H) && \
+defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
+ /* the six important includes files all exist and so do both libs,
+ defined SSLeay usage */
+#define USE_SSLEAY 1
+#endif
+#if defined(HAVE_OPENSSL_X509_H) && defined(HAVE_OPENSSL_SSL_H) && \
+defined(HAVE_OPENSSL_RSA_H) && defined(HAVE_OPENSSL_PEM_H) && \
+defined(HAVE_OPENSSL_ERR_H) && defined(HAVE_OPENSSL_CRYPTO_H) && \
+defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
+ /* the six important includes files all exist and so do both libs,
+ defined SSLeay usage */
+#define USE_SSLEAY 1
+#define USE_OPENSSL 1
+#endif
+
+#ifndef STDC_HEADERS /* no standard C headers! */
+#include "stdcheaders.h"
+#else
+#ifdef _AIX
+#include "stdcheaders.h"
+#endif
+#endif
+
+#if 0 /* zlib experiments are halted 17th october, 1999 (Daniel) */
+#if defined(HAVE_ZLIB_H) && defined(HAVE_LIBZ)
+ /* Both lib and header file exist, we have libz! */
+#define USE_ZLIB
+#endif
+#endif
+
+#ifdef HAVE_STRCASECMP
+#define strnequal(x,y,z) !(strncasecmp)(x,y,z)
+#define strequal(x,y) !(strcasecmp)(x,y)
+
+#else
+#define strnequal(x,y,z) !strnicmp(x,y,z)
+#define strequal(x,y) !stricmp(x,y)
+#endif
+
+/* Below we define four functions. They should
+ 1. close a socket
+ 2. read from a socket
+ 3. write to a socket
+ (Hopefully, only win32-crap do this weird name changing)
+
+ 4. set the SIGALRM signal timeout
+ 5. set dir/file naming defines
+ */
+
+#ifdef WIN32
+#if !defined(__GNUC__) || defined(__MINGW32__)
+#define sclose(x) closesocket(x)
+#define sread(x,y,z) recv(x,y,z,0)
+#define swrite(x,y,z) (size_t)send(x,y,z,0)
+#define myalarm(x) /* win32 is a silly system */
+#else
+ /* gcc-for-win is still good :) */
+#define sclose(x) close(x)
+#define sread(x,y,z) read(x,y,z)
+#define swrite(x,y,z) write(x,y,z)
+#define myalarm(x) alarm(x)
+#endif
+
+#define PATH_CHAR ";"
+#define DIR_CHAR "\\"
+#define DOT_CHAR "_"
+
+#else
+#define sclose(x) close(x)
+#define sread(x,y,z) read(x,y,z)
+#define swrite(x,y,z) write(x,y,z)
+#define myalarm(x) alarm(x)
+
+#define PATH_CHAR ":"
+#define DIR_CHAR "/"
+#define DOT_CHAR "."
+
+#ifdef HAVE_STRCASECMP
+/* this is for "-ansi -Wall -pedantic" to stop complaining! */
+extern int (strcasecmp)(const char *s1, const char *s2);
+extern int (strncasecmp)(const char *s1, const char *s2, size_t n);
+#ifndef fileno /* sunos 4 have this as a macro! */
+int fileno( FILE *stream);
+#endif
+#endif
+
+#endif
+
+/*
+ * FIXME: code for getting a passwd in windows/non termcap/signal systems?
+ */
+#ifndef WIN32
+#define get_password(x) getpass(x)
+#else
+#define get_password(x)
+#endif
+
+#endif /* __CONFIG_H */
diff --git a/lib/speedcheck.c b/lib/speedcheck.c
new file mode 100644
index 000000000..5647b50e2
--- /dev/null
+++ b/lib/speedcheck.c
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#if defined(__MINGW32__)
+#include <winsock.h>
+#endif
+
+#include <curl/curl.h>
+#include "urldata.h"
+#include "sendf.h"
+#include "speedcheck.h"
+
+UrgError speedcheck(struct UrlData *data,
+ struct timeval now)
+{
+ static struct timeval keeps_speed;
+
+ if((data->current_speed >= 0) &&
+ data->low_speed_time &&
+ (tvlong(keeps_speed) != 0) &&
+ (data->current_speed < data->low_speed_limit)) {
+
+ /* We are now below the "low speed limit". If we are below it
+ for "low speed time" seconds we consider that enough reason
+ to abort the download. */
+
+ if( tvdiff(now, keeps_speed) > data->low_speed_time) {
+ /* we have been this slow for long enough, now die */
+ failf(data,
+ "Operation too slow. "
+ "Less than %d bytes/sec transfered the last %d seconds",
+ data->low_speed_limit,
+ data->low_speed_time);
+ return URG_OPERATION_TIMEOUTED;
+ }
+ }
+ else {
+ /* we keep up the required speed all right */
+ keeps_speed = now;
+ }
+ return URG_OK;
+}
+
diff --git a/lib/speedcheck.h b/lib/speedcheck.h
new file mode 100644
index 000000000..27e7ba2f6
--- /dev/null
+++ b/lib/speedcheck.h
@@ -0,0 +1,50 @@
+#ifndef __SPEEDCHECK_H
+#define __SPEEDCHECK_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include "setup.h"
+
+#include "timeval.h"
+
+UrgError speedcheck(struct UrlData *data,
+ struct timeval now);
+
+#endif
diff --git a/lib/ssluse.c b/lib/ssluse.c
new file mode 100644
index 000000000..bb78df009
--- /dev/null
+++ b/lib/ssluse.c
@@ -0,0 +1,265 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "urldata.h"
+#include "sendf.h"
+
+#ifdef USE_SSLEAY
+
+static char global_passwd[64];
+
+static int passwd_callback(char *buf, int num, int verify
+#if OPENSSL_VERSION_NUMBER >= 0x00904100L
+ /* This was introduced in 0.9.4, we can set this
+ using SSL_CTX_set_default_passwd_cb_userdata()
+ */
+ , void *userdata
+#endif
+ )
+{
+ if(verify)
+ fprintf(stderr, "%s\n", buf);
+ else {
+ if(num > strlen(global_passwd)) {
+ strcpy(buf, global_passwd);
+ return strlen(buf);
+ }
+ }
+ return 0;
+}
+
+/* This function is *highly* inspired by (and parts are directly stolen
+ * from) source from the SSLeay package written by Eric Young
+ * (eay@cryptsoft.com). */
+
+int SSL_cert_stuff(struct UrlData *data,
+ char *cert_file,
+ char *key_file)
+{
+ if (cert_file != NULL) {
+ SSL *ssl;
+ X509 *x509;
+
+ if(data->cert_passwd) {
+ /*
+ * If password has been given, we store that in the global
+ * area (*shudder*) for a while:
+ */
+ strcpy(global_passwd, data->cert_passwd);
+ /* Set passwd callback: */
+ SSL_CTX_set_default_passwd_cb(data->ctx, passwd_callback);
+ }
+
+ if (SSL_CTX_use_certificate_file(data->ctx,
+ cert_file,
+ SSL_FILETYPE_PEM) <= 0) {
+ failf(data, "unable to set certificate file (wrong password?)\n");
+ return(0);
+ }
+ if (key_file == NULL)
+ key_file=cert_file;
+
+ if (SSL_CTX_use_PrivateKey_file(data->ctx,
+ key_file,
+ SSL_FILETYPE_PEM) <= 0) {
+ failf(data, "unable to set public key file\n");
+ return(0);
+ }
+
+ ssl=SSL_new(data->ctx);
+ x509=SSL_get_certificate(ssl);
+
+ if (x509 != NULL)
+ EVP_PKEY_copy_parameters(X509_get_pubkey(x509),
+ SSL_get_privatekey(ssl));
+ SSL_free(ssl);
+
+ /* If we are using DSA, we can copy the parameters from
+ * the private key */
+
+
+ /* Now we know that a key and cert have been set against
+ * the SSL context */
+ if (!SSL_CTX_check_private_key(data->ctx)) {
+ failf(data, "Private key does not match the certificate public key\n");
+ return(0);
+ }
+
+ /* erase it now */
+ memset(global_passwd, 0, sizeof(global_passwd));
+ }
+ return(1);
+}
+
+#endif
+
+#if SSL_VERIFY_CERT
+int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
+{
+ X509 *err_cert;
+ char buf[256];
+
+ err_cert=X509_STORE_CTX_get_current_cert(ctx);
+ X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
+
+ return 1;
+}
+
+#endif
+
+/* ====================================================== */
+int
+UrgSSLConnect (struct UrlData *data)
+{
+#ifdef USE_SSLEAY
+ int err;
+ char * str;
+ SSL_METHOD *req_method;
+
+ /* mark this is being ssl enabled from here on out. */
+ data->use_ssl = 1;
+
+ /* Lets get nice error messages */
+ SSL_load_error_strings();
+
+ /* Setup all the global SSL stuff */
+ SSLeay_add_ssl_algorithms();
+
+ switch(data->ssl_version) {
+ default:
+ req_method = SSLv23_client_method();
+ break;
+ case 2:
+ req_method = SSLv2_client_method();
+ break;
+ case 3:
+ req_method = SSLv3_client_method();
+ break;
+ }
+
+ data->ctx = SSL_CTX_new(req_method);
+
+ if(!data->ctx) {
+ failf(data, "SSL: couldn't create a context!");
+ return 1;
+ }
+
+ if(data->cert) {
+ if (!SSL_cert_stuff(data, data->cert, data->cert)) {
+ failf(data, "couldn't use certificate!\n");
+ return 2;
+ }
+ }
+
+#if SSL_VERIFY_CERT
+ SSL_CTX_set_verify(data->ctx,
+ SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
+ SSL_VERIFY_CLIENT_ONCE,
+ cert_verify_callback);
+#endif
+
+ /* Lets make an SSL structure */
+ data->ssl = SSL_new (data->ctx);
+ SSL_set_connect_state (data->ssl);
+
+ data->server_cert = 0x0;
+
+ /* pass the raw socket into the SSL layers */
+ SSL_set_fd (data->ssl, data->firstsocket);
+ err = SSL_connect (data->ssl);
+
+ if (-1 == err) {
+ err = ERR_get_error();
+ failf(data, "SSL: %s", ERR_error_string(err, NULL));
+ return 10;
+ }
+
+
+ infof (data, "SSL connection using %s\n", SSL_get_cipher (data->ssl));
+
+ /* Get server's certificate (note: beware of dynamic allocation) - opt */
+ /* major serious hack alert -- we should check certificates
+ * to authenticate the server; otherwise we risk man-in-the-middle
+ * attack
+ */
+
+ data->server_cert = SSL_get_peer_certificate (data->ssl);
+ if(!data->server_cert) {
+ failf(data, "SSL: couldn't get peer certificate!");
+ return 3;
+ }
+ infof (data, "Server certificate:\n");
+
+ str = X509_NAME_oneline (X509_get_subject_name (data->server_cert), NULL, 0);
+ if(!str) {
+ failf(data, "SSL: couldn't get X509-subject!");
+ return 4;
+ }
+ infof (data, "\t subject: %s\n", str);
+ Free (str);
+
+ str = X509_NAME_oneline (X509_get_issuer_name (data->server_cert), NULL, 0);
+ if(!str) {
+ failf(data, "SSL: couldn't get X509-issuer name!");
+ return 5;
+ }
+ infof (data, "\t issuer: %s\n", str);
+ Free (str);
+
+ /* We could do all sorts of certificate verification stuff here before
+ deallocating the certificate. */
+
+
+#if SSL_VERIFY_CERT
+ infof(data, "Verify result: %d\n", SSL_get_verify_result(data->ssl));
+#endif
+
+
+
+ X509_free (data->server_cert);
+#else /* USE_SSLEAY */
+ /* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
+ (void) data;
+#endif
+ return 0;
+}
diff --git a/lib/ssluse.h b/lib/ssluse.h
new file mode 100644
index 000000000..c1996b28e
--- /dev/null
+++ b/lib/ssluse.h
@@ -0,0 +1,46 @@
+#ifndef __SSLUSE_H
+#define __SSLUSE_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+int SSL_cert_stuff(struct UrlData *data,
+ char *cert_file,
+ char *key_file);
+int UrgSSLConnect (struct UrlData *data);
+#endif
diff --git a/lib/sta01005 b/lib/sta01005
new file mode 100644
index 000000000..31cd282d1
--- /dev/null
+++ b/lib/sta01005
Binary files differ
diff --git a/lib/sta18057 b/lib/sta18057
new file mode 100644
index 000000000..36d824b46
--- /dev/null
+++ b/lib/sta18057
Binary files differ
diff --git a/lib/telnet.c b/lib/telnet.c
new file mode 100644
index 000000000..8ca12450d
--- /dev/null
+++ b/lib/telnet.c
@@ -0,0 +1,937 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ *
+ * This implementation of the TELNET protocol is written by
+ * Linus Nielsen <Linus.Nielsen@haxx.nu>,
+ * with some code snippets stolen from the BSD Telnet client.
+ *
+ * The negotiation is performed according to RFC 1143 (D. Bernstein,
+ * "The Q Method of Implementing TELNET Option Negotiation")
+ *
+ ****************************************************************************/
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#include <time.h>
+#include <io.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "download.h"
+#include "sendf.h"
+#include "formdata.h"
+#include "progress.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+#define TELOPTS
+#define TELCMDS
+#define SLC_NAMES
+
+#include "arpa_telnet.h"
+
+#define SUBBUFSIZE 512
+
+#define SB_CLEAR() subpointer = subbuffer;
+#define SB_TERM() { subend = subpointer; SB_CLEAR(); }
+#define SB_ACCUM(c) if (subpointer < (subbuffer+sizeof subbuffer)) { \
+ *subpointer++ = (c); \
+ }
+
+#define SB_GET() ((*subpointer++)&0xff)
+#define SB_PEEK() ((*subpointer)&0xff)
+#define SB_EOF() (subpointer >= subend)
+#define SB_LEN() (subend - subpointer)
+
+void telwrite(struct UrlData *data,
+ unsigned char *buffer, /* Data to write */
+ int count); /* Number of bytes to write */
+
+void telrcv(struct UrlData *data,
+ unsigned char *inbuf, /* Data received from socket */
+ int count); /* Number of bytes received */
+
+static void printoption(struct UrlData *data,
+ const char *direction,
+ int cmd, int option);
+
+static void negotiate(struct UrlData *data);
+static void send_negotiation(struct UrlData *data, int cmd, int option);
+static void set_local_option(struct UrlData *data, int cmd, int option);
+static void set_remote_option(struct UrlData *data, int cmd, int option);
+
+static void printsub(struct UrlData *data,
+ int direction, unsigned char *pointer, int length);
+static void suboption(struct UrlData *data);
+
+/* suboptions */
+static char subbuffer[SUBBUFSIZE];
+static char *subpointer, *subend; /* buffer for sub-options */
+
+/*
+ * Telnet receiver states for fsm
+ */
+static enum
+{
+ TS_DATA = 0,
+ TS_IAC,
+ TS_WILL,
+ TS_WONT,
+ TS_DO,
+ TS_DONT,
+ TS_CR,
+ TS_SB, /* sub-option collection */
+ TS_SE /* looking for sub-option end */
+} telrcv_state;
+
+/* For negotiation compliant to RFC 1143 */
+#define NO 0
+#define YES 1
+#define WANTYES 2
+#define WANTNO 3
+
+#define EMPTY 0
+#define OPPOSITE 1
+
+static int us[256];
+static int usq[256];
+static int us_preferred[256];
+static int him[256];
+static int himq[256];
+static int him_preferred[256];
+
+void init_telnet(struct UrlData *data)
+{
+ telrcv_state = TS_DATA;
+
+ /* Init suboptions */
+ SB_CLEAR();
+
+ /* Set all options to NO */
+ memset(us, NO, 256);
+ memset(usq, NO, 256);
+ memset(us_preferred, NO, 256);
+ memset(him, NO, 256);
+ memset(himq, NO, 256);
+ memset(him_preferred, NO, 256);
+
+ /* Set the options we want */
+ us_preferred[TELOPT_BINARY] = YES;
+ us_preferred[TELOPT_SGA] = YES;
+ him_preferred[TELOPT_BINARY] = YES;
+ him_preferred[TELOPT_SGA] = YES;
+
+ /* Start negotiating */
+ negotiate(data);
+}
+
+static void negotiate(struct UrlData *data)
+{
+ int i;
+
+ for(i = 0;i < NTELOPTS;i++)
+ {
+ if(us_preferred[i] == YES)
+ set_local_option(data, i, YES);
+
+ if(him_preferred[i] == YES)
+ set_remote_option(data, i, YES);
+ }
+}
+
+static void printoption(struct UrlData *data,
+ const char *direction, int cmd, int option)
+{
+ char *fmt;
+ char *opt;
+
+ if (data->conf & CONF_VERBOSE)
+ {
+ if (cmd == IAC)
+ {
+ if (TELCMD_OK(option))
+ printf("%s IAC %s\n", direction, TELCMD(option));
+ else
+ printf("%s IAC %d\n", direction, option);
+ }
+ else
+ {
+ fmt = (cmd == WILL) ? "WILL" : (cmd == WONT) ? "WONT" :
+ (cmd == DO) ? "DO" : (cmd == DONT) ? "DONT" : 0;
+ if (fmt)
+ {
+ if (TELOPT_OK(option))
+ opt = TELOPT(option);
+ else if (option == TELOPT_EXOPL)
+ opt = "EXOPL";
+ else
+ opt = NULL;
+
+ if(opt)
+ printf("%s %s %s\n", direction, fmt, opt);
+ else
+ printf("%s %s %d\n", direction, fmt, option);
+ }
+ else
+ printf("%s %d %d\n", direction, cmd, option);
+ }
+ }
+}
+
+static void send_negotiation(struct UrlData *data, int cmd, int option)
+{
+ unsigned char buf[3];
+
+ buf[0] = IAC;
+ buf[1] = cmd;
+ buf[2] = option;
+
+ swrite(data->firstsocket, buf, 3);
+
+ printoption(data, "SENT", cmd, option);
+}
+
+void set_remote_option(struct UrlData *data, int option, int newstate)
+{
+ if(newstate == YES)
+ {
+ switch(him[option])
+ {
+ case NO:
+ him[option] = WANTYES;
+ send_negotiation(data, DO, option);
+ break;
+
+ case YES:
+ /* Already enabled */
+ break;
+
+ case WANTNO:
+ switch(himq[option])
+ {
+ case EMPTY:
+ /* Already negotiating for YES, queue the request */
+ himq[option] = OPPOSITE;
+ break;
+ case OPPOSITE:
+ /* Error: already queued an enable request */
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(himq[option])
+ {
+ case EMPTY:
+ /* Error: already negotiating for enable */
+ break;
+ case OPPOSITE:
+ himq[option] = EMPTY;
+ break;
+ }
+ break;
+ }
+ }
+ else /* NO */
+ {
+ switch(him[option])
+ {
+ case NO:
+ /* Already disabled */
+ break;
+
+ case YES:
+ him[option] = WANTNO;
+ send_negotiation(data, DONT, option);
+ break;
+
+ case WANTNO:
+ switch(himq[option])
+ {
+ case EMPTY:
+ /* Already negotiating for NO */
+ break;
+ case OPPOSITE:
+ himq[option] = EMPTY;
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(himq[option])
+ {
+ case EMPTY:
+ himq[option] = OPPOSITE;
+ break;
+ case OPPOSITE:
+ break;
+ }
+ break;
+ }
+ }
+}
+
+void rec_will(struct UrlData *data, int option)
+{
+ switch(him[option])
+ {
+ case NO:
+ if(him_preferred[option] == YES)
+ {
+ him[option] = YES;
+ send_negotiation(data, DO, option);
+ }
+ else
+ {
+ send_negotiation(data, DONT, option);
+ }
+ break;
+
+ case YES:
+ /* Already enabled */
+ break;
+
+ case WANTNO:
+ switch(himq[option])
+ {
+ case EMPTY:
+ /* Error: DONT answered by WILL */
+ him[option] = NO;
+ break;
+ case OPPOSITE:
+ /* Error: DONT answered by WILL */
+ him[option] = YES;
+ himq[option] = EMPTY;
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(himq[option])
+ {
+ case EMPTY:
+ him[option] = YES;
+ break;
+ case OPPOSITE:
+ him[option] = WANTNO;
+ himq[option] = EMPTY;
+ send_negotiation(data, DONT, option);
+ break;
+ }
+ break;
+ }
+}
+
+void rec_wont(struct UrlData *data, int option)
+{
+ switch(him[option])
+ {
+ case NO:
+ /* Already disabled */
+ break;
+
+ case YES:
+ him[option] = NO;
+ send_negotiation(data, DONT, option);
+ break;
+
+ case WANTNO:
+ switch(himq[option])
+ {
+ case EMPTY:
+ him[option] = NO;
+ break;
+
+ case OPPOSITE:
+ him[option] = WANTYES;
+ himq[option] = EMPTY;
+ send_negotiation(data, DO, option);
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(himq[option])
+ {
+ case EMPTY:
+ him[option] = NO;
+ break;
+ case OPPOSITE:
+ him[option] = NO;
+ himq[option] = EMPTY;
+ break;
+ }
+ break;
+ }
+}
+
+void set_local_option(struct UrlData *data, int option, int newstate)
+{
+ if(newstate == YES)
+ {
+ switch(us[option])
+ {
+ case NO:
+ us[option] = WANTYES;
+ send_negotiation(data, WILL, option);
+ break;
+
+ case YES:
+ /* Already enabled */
+ break;
+
+ case WANTNO:
+ switch(usq[option])
+ {
+ case EMPTY:
+ /* Already negotiating for YES, queue the request */
+ usq[option] = OPPOSITE;
+ break;
+ case OPPOSITE:
+ /* Error: already queued an enable request */
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(usq[option])
+ {
+ case EMPTY:
+ /* Error: already negotiating for enable */
+ break;
+ case OPPOSITE:
+ usq[option] = EMPTY;
+ break;
+ }
+ break;
+ }
+ }
+ else /* NO */
+ {
+ switch(us[option])
+ {
+ case NO:
+ /* Already disabled */
+ break;
+
+ case YES:
+ us[option] = WANTNO;
+ send_negotiation(data, WONT, option);
+ break;
+
+ case WANTNO:
+ switch(usq[option])
+ {
+ case EMPTY:
+ /* Already negotiating for NO */
+ break;
+ case OPPOSITE:
+ usq[option] = EMPTY;
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(usq[option])
+ {
+ case EMPTY:
+ usq[option] = OPPOSITE;
+ break;
+ case OPPOSITE:
+ break;
+ }
+ break;
+ }
+ }
+}
+
+void rec_do(struct UrlData *data, int option)
+{
+ switch(us[option])
+ {
+ case NO:
+ if(us_preferred[option] == YES)
+ {
+ us[option] = YES;
+ send_negotiation(data, WILL, option);
+ }
+ else
+ {
+ send_negotiation(data, WONT, option);
+ }
+ break;
+
+ case YES:
+ /* Already enabled */
+ break;
+
+ case WANTNO:
+ switch(usq[option])
+ {
+ case EMPTY:
+ /* Error: DONT answered by WILL */
+ us[option] = NO;
+ break;
+ case OPPOSITE:
+ /* Error: DONT answered by WILL */
+ us[option] = YES;
+ usq[option] = EMPTY;
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(usq[option])
+ {
+ case EMPTY:
+ us[option] = YES;
+ break;
+ case OPPOSITE:
+ us[option] = WANTNO;
+ himq[option] = EMPTY;
+ send_negotiation(data, WONT, option);
+ break;
+ }
+ break;
+ }
+}
+
+void rec_dont(struct UrlData *data, int option)
+{
+ switch(us[option])
+ {
+ case NO:
+ /* Already disabled */
+ break;
+
+ case YES:
+ us[option] = NO;
+ send_negotiation(data, WONT, option);
+ break;
+
+ case WANTNO:
+ switch(usq[option])
+ {
+ case EMPTY:
+ us[option] = NO;
+ break;
+
+ case OPPOSITE:
+ us[option] = WANTYES;
+ usq[option] = EMPTY;
+ send_negotiation(data, WILL, option);
+ break;
+ }
+ break;
+
+ case WANTYES:
+ switch(usq[option])
+ {
+ case EMPTY:
+ us[option] = NO;
+ break;
+ case OPPOSITE:
+ us[option] = NO;
+ usq[option] = EMPTY;
+ break;
+ }
+ break;
+ }
+}
+
+
+static void printsub(struct UrlData *data,
+ int direction, /* '<' or '>' */
+ unsigned char *pointer, /* where suboption data is */
+ int length) /* length of suboption data */
+
+{
+ int i = 0;
+
+ if (data->conf & CONF_VERBOSE)
+ {
+ if (direction)
+ {
+ printf("%s IAC SB ", (direction == '<')? "RCVD":"SENT");
+ if (length >= 3)
+ {
+ int j;
+
+ i = pointer[length-2];
+ j = pointer[length-1];
+
+ if (i != IAC || j != SE)
+ {
+ printf("(terminated by ");
+ if (TELOPT_OK(i))
+ printf("%s ", TELOPT(i));
+ else if (TELCMD_OK(i))
+ printf("%s ", TELCMD(i));
+ else
+ printf("%d ", i);
+ if (TELOPT_OK(j))
+ printf("%s", TELOPT(j));
+ else if (TELCMD_OK(j))
+ printf("%s", TELCMD(j));
+ else
+ printf("%d", j);
+ printf(", not IAC SE!) ");
+ }
+ }
+ length -= 2;
+ }
+ if (length < 1)
+ {
+ printf("(Empty suboption?)");
+ return;
+ }
+
+ if (TELOPT_OK(pointer[0]))
+ printf("%s (unknown)", TELOPT(pointer[0]));
+ else
+ printf("%d (unknown)", pointer[i]);
+ for (i = 1; i < length; i++)
+ printf(" %d", pointer[i]);
+
+ if (direction)
+ {
+ printf("\n");
+ }
+ }
+}
+
+/*
+ * suboption()
+ *
+ * Look at the sub-option buffer, and try to be helpful to the other
+ * side.
+ * No suboptions are supported yet.
+ */
+
+static void suboption(struct UrlData *data)
+{
+ printsub(data, '<', (unsigned char *)subbuffer, SB_LEN()+2);
+ return;
+}
+
+void telrcv(struct UrlData *data,
+ unsigned char *inbuf, /* Data received from socket */
+ int count) /* Number of bytes received */
+{
+ unsigned char c;
+ int index = 0;
+
+ while(count--)
+ {
+ c = inbuf[index++];
+
+ switch (telrcv_state)
+ {
+ case TS_CR:
+ telrcv_state = TS_DATA;
+ if (c == '\0')
+ {
+ break; /* Ignore \0 after CR */
+ }
+
+ data->fwrite((char *)&c, 1, 1, data->out);
+ continue;
+
+ case TS_DATA:
+ if (c == IAC)
+ {
+ telrcv_state = TS_IAC;
+ break;
+ }
+ else if(c == '\r')
+ {
+ telrcv_state = TS_CR;
+ }
+
+ data->fwrite((char *)&c, 1, 1, data->out);
+ continue;
+
+ case TS_IAC:
+ process_iac:
+ switch (c)
+ {
+ case WILL:
+ telrcv_state = TS_WILL;
+ continue;
+ case WONT:
+ telrcv_state = TS_WONT;
+ continue;
+ case DO:
+ telrcv_state = TS_DO;
+ continue;
+ case DONT:
+ telrcv_state = TS_DONT;
+ continue;
+ case SB:
+ SB_CLEAR();
+ telrcv_state = TS_SB;
+ continue;
+ case IAC:
+ data->fwrite((char *)&c, 1, 1, data->out);
+ break;
+ case DM:
+ case NOP:
+ case GA:
+ default:
+ printoption(data, "RCVD", IAC, c);
+ break;
+ }
+ telrcv_state = TS_DATA;
+ continue;
+
+ case TS_WILL:
+ printoption(data, "RCVD", WILL, c);
+ rec_will(data, c);
+ telrcv_state = TS_DATA;
+ continue;
+
+ case TS_WONT:
+ printoption(data, "RCVD", WONT, c);
+ rec_wont(data, c);
+ telrcv_state = TS_DATA;
+ continue;
+
+ case TS_DO:
+ printoption(data, "RCVD", DO, c);
+ rec_do(data, c);
+ telrcv_state = TS_DATA;
+ continue;
+
+ case TS_DONT:
+ printoption(data, "RCVD", DONT, c);
+ rec_dont(data, c);
+ telrcv_state = TS_DATA;
+ continue;
+
+ case TS_SB:
+ if (c == IAC)
+ {
+ telrcv_state = TS_SE;
+ }
+ else
+ {
+ SB_ACCUM(c);
+ }
+ continue;
+
+ case TS_SE:
+ if (c != SE)
+ {
+ if (c != IAC)
+ {
+ /*
+ * This is an error. We only expect to get
+ * "IAC IAC" or "IAC SE". Several things may
+ * have happend. An IAC was not doubled, the
+ * IAC SE was left off, or another option got
+ * inserted into the suboption are all possibilities.
+ * If we assume that the IAC was not doubled,
+ * and really the IAC SE was left off, we could
+ * get into an infinate loop here. So, instead,
+ * we terminate the suboption, and process the
+ * partial suboption if we can.
+ */
+ SB_ACCUM((unsigned char)IAC);
+ SB_ACCUM(c);
+ subpointer -= 2;
+ SB_TERM();
+
+ printoption(data, "In SUBOPTION processing, RCVD", IAC, c);
+ suboption(data); /* handle sub-option */
+ telrcv_state = TS_IAC;
+ goto process_iac;
+ }
+ SB_ACCUM(c);
+ telrcv_state = TS_SB;
+ }
+ else
+ {
+ SB_ACCUM((unsigned char)IAC);
+ SB_ACCUM((unsigned char)SE);
+ subpointer -= 2;
+ SB_TERM();
+ suboption(data); /* handle sub-option */
+ telrcv_state = TS_DATA;
+ }
+ break;
+ }
+ }
+}
+
+void telwrite(struct UrlData *data,
+ unsigned char *buffer, /* Data to write */
+ int count) /* Number of bytes to write */
+{
+ unsigned char outbuf[2];
+ int out_count = 0;
+ int bytes_written;
+
+ while(count--)
+ {
+ outbuf[0] = *buffer++;
+ out_count = 1;
+ if(outbuf[0] == IAC)
+ outbuf[out_count++] = IAC;
+
+#ifndef USE_SSLEAY
+ bytes_written = swrite(data->firstsocket, outbuf, out_count);
+#else
+ if (data->use_ssl) {
+ bytes_written = SSL_write(data->ssl, (char *)outbuf, out_count);
+ }
+ else {
+ bytes_written = swrite(data->firstsocket, outbuf, out_count);
+ }
+#endif /* USE_SSLEAY */
+ }
+}
+
+UrgError telnet(struct UrlData *data)
+{
+ int sockfd = data->firstsocket;
+ fd_set readfd;
+ fd_set keepfd;
+
+ bool keepon = TRUE;
+ char *buf = data->buffer;
+ int nread;
+
+ init_telnet(data);
+
+ FD_ZERO (&readfd); /* clear it */
+ FD_SET (sockfd, &readfd);
+ FD_SET (1, &readfd);
+
+ keepfd = readfd;
+
+ while (keepon)
+ {
+ readfd = keepfd; /* set this every lap in the loop */
+
+ switch (select (sockfd + 1, &readfd, NULL, NULL, NULL))
+ {
+ case -1: /* error, stop reading */
+ keepon = FALSE;
+ continue;
+ case 0: /* timeout */
+ break;
+ default: /* read! */
+ if(FD_ISSET(1, &readfd))
+ {
+ nread = read(1, buf, 255);
+ telwrite(data, (unsigned char *)buf, nread);
+ }
+
+ if(FD_ISSET(sockfd, &readfd))
+ {
+#ifndef USE_SSLEAY
+ nread = sread (sockfd, buf, BUFSIZE - 1);
+#else
+ if (data->use_ssl) {
+ nread = SSL_read (data->ssl, buf, BUFSIZE - 1);
+ }
+ else {
+ nread = sread (sockfd, buf, BUFSIZE - 1);
+ }
+#endif /* USE_SSLEAY */
+ }
+
+ /* if we receive 0 or less here, the server closed the connection and
+ we bail out from this! */
+ if (nread <= 0) {
+ keepon = FALSE;
+ break;
+ }
+
+ telrcv(data, (unsigned char *)buf, nread);
+ }
+ }
+ return URG_OK;
+}
+
+
diff --git a/lib/telnet.h b/lib/telnet.h
new file mode 100644
index 000000000..25b7f2d29
--- /dev/null
+++ b/lib/telnet.h
@@ -0,0 +1,45 @@
+#ifndef __TELNET_H
+#define __TELNET_H
+
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError telnet(struct UrlData *data);
+
+#endif
diff --git a/lib/timeval.c b/lib/timeval.c
new file mode 100644
index 000000000..8ad25325f
--- /dev/null
+++ b/lib/timeval.c
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+#include "timeval.h"
+
+#ifndef HAVE_GETTIMEOFDAY
+
+#ifdef WIN32
+int
+gettimeofday (struct timeval *tp, void *nothing)
+{
+ SYSTEMTIME st;
+ time_t tt;
+ struct tm tmtm;
+ /* mktime converts local to UTC */
+ GetLocalTime (&st);
+ tmtm.tm_sec = st.wSecond;
+ tmtm.tm_min = st.wMinute;
+ tmtm.tm_hour = st.wHour;
+ tmtm.tm_mday = st.wDay;
+ tmtm.tm_mon = st.wMonth - 1;
+ tmtm.tm_year = st.wYear - 1900;
+ tmtm.tm_isdst = -1;
+ tt = mktime (&tmtm);
+ tp->tv_sec = tt;
+ tp->tv_usec = st.wMilliseconds * 1000;
+ return 1;
+}
+#define HAVE_GETTIMEOFDAY
+#endif
+#endif
+
+struct timeval tvnow ()
+{
+ struct timeval now;
+#ifdef HAVE_GETTIMEOFDAY
+ gettimeofday (&now, NULL);
+#else
+ now.tv_sec = (long) time(NULL);
+ now.tv_usec = 0;
+#endif
+ return now;
+}
+
+double tvdiff (struct timeval t1, struct timeval t2)
+{
+ return (double)(t1.tv_sec - t2.tv_sec) + ((t1.tv_usec-t2.tv_usec)/1000000.0);
+}
+
+long tvlong (struct timeval t1)
+{
+ return t1.tv_sec;
+}
diff --git a/lib/timeval.h b/lib/timeval.h
new file mode 100644
index 000000000..fe99e2896
--- /dev/null
+++ b/lib/timeval.h
@@ -0,0 +1,64 @@
+#ifndef __TIMEVAL_H
+#define __TIMEVAL_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
+
+#include "setup.h"
+
+#ifndef HAVE_GETTIMEOFDAY
+#if !defined(_WINSOCKAPI_) && !defined(__MINGW32__)
+struct timeval {
+ long tv_sec;
+ long tv_usec;
+};
+#endif
+#endif
+
+struct timeval tvnow ();
+double tvdiff (struct timeval t1, struct timeval t2);
+long tvlong (struct timeval t1);
+
+#endif
diff --git a/lib/upload.c b/lib/upload.c
new file mode 100644
index 000000000..0673382e9
--- /dev/null
+++ b/lib/upload.c
@@ -0,0 +1,178 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include "setup.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#ifdef WIN32
+#if !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#endif
+#include <time.h> /* for the time_t typedef! */
+
+#if defined(__GNUC__) && defined(TIME_WITH_SYS_TIME)
+#include <sys/time.h>
+#endif
+
+#endif
+
+#include <curl/curl.h>
+
+#ifdef __BEOS__
+#include <net/socket.h>
+#endif
+
+#include "urldata.h"
+#include "speedcheck.h"
+#include "sendf.h"
+#include "progress.h"
+
+/* --- upload a stream to a socket --- */
+
+UrgError Upload(struct UrlData *data,
+ int sockfd,
+ long *bytecountp)
+{
+ fd_set writefd;
+ fd_set keepfd;
+ struct timeval interval;
+ bool keepon=TRUE;
+ char *buf = data->buffer;
+ size_t nread;
+ long bytecount=0;
+ struct timeval start;
+ struct timeval now;
+ UrgError urg;
+ char scratch[BUFSIZE * 2];
+ int i, si;
+
+ /* timeout every X second
+ - makes a better progressmeter (i.e even when no data is sent, the
+ meter can be updated and reflect reality)
+ - allows removal of the alarm() crap
+ - variable timeout is easier
+ */
+
+ myalarm(0); /* switch off the alarm-style timeout */
+
+ start = tvnow();
+ now = start;
+
+ FD_ZERO(&writefd); /* clear it */
+ FD_SET(sockfd, &writefd);
+
+ keepfd = writefd;
+
+ while(keepon) {
+ size_t bytes_written = 0;
+
+ writefd = keepfd; /* set this every lap in the loop */
+ interval.tv_sec = 2;
+ interval.tv_usec = 0;
+
+ switch(select(sockfd+1, NULL, &writefd, NULL, &interval)) {
+ case -1: /* error, stop writing */
+ keepon=FALSE;
+ continue;
+ case 0: /* timeout */
+ break;
+ default: /* write! */
+ if(data->crlf)
+ buf = data->buffer; /* put it back on the buffer */
+
+ nread = data->fread(buf, 1, BUFSIZE, data->in);
+ bytecount += nread;
+
+ if (nread==0) {
+ /* done */
+ keepon = FALSE;
+ break;
+ }
+
+ /* convert LF to CRLF if so asked */
+ if (data->crlf) {
+ for(i = 0, si = 0; i < (int)nread; i++, si++) {
+ if (buf[i] == 0x0a) {
+ scratch[si++] = 0x0d;
+ scratch[si] = 0x0a;
+ }
+ else {
+ scratch[si] = buf[i];
+ }
+ }
+ nread = si;
+ buf = scratch; /* point to the new buffer */
+ }
+
+ /* write to socket */
+#ifndef USE_SSLEAY
+ bytes_written = swrite(sockfd, buf, nread);
+#else
+ if (data->use_ssl) {
+ bytes_written = SSL_write(data->ssl, buf, nread);
+ } else {
+ bytes_written = swrite(sockfd, buf, nread);
+ }
+#endif /* USE_SSLEAY */
+ if(nread != bytes_written) {
+ failf(data, "Failed uploading file");
+ return URG_FTP_WRITE_ERROR;
+ }
+ }
+ now = tvnow();
+ ProgressShow(data, bytecount, start, now, FALSE);
+ urg=speedcheck(data, now);
+ if(urg)
+ return urg;
+ if(data->timeout && (tvdiff(now,start)>data->timeout)) {
+ failf(data, "Upload timed out with %d bytes sent", bytecount);
+ return URG_OPERATION_TIMEOUTED;
+ }
+
+ }
+ ProgressShow(data, bytecount, start, now, TRUE);
+ *bytecountp = bytecount;
+
+ return URG_OK;
+}
diff --git a/lib/upload.h b/lib/upload.h
new file mode 100644
index 000000000..dbb6600c8
--- /dev/null
+++ b/lib/upload.h
@@ -0,0 +1,46 @@
+#ifndef __UPLOAD_H
+#define __UPLOAD_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+UrgError Upload(struct UrlData *data,
+ int sockfd,
+ long *bytecountp);
+
+#endif
diff --git a/lib/url.c b/lib/url.c
new file mode 100644
index 000000000..b520898dc
--- /dev/null
+++ b/lib/url.c
@@ -0,0 +1,1181 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/*
+ * SSL code intially written by
+ * Linas Vepstas <linas@linas.org> and Sampo Kellomaki <sampo@iki.fi>
+ */
+
+/* -- WIN32 approved -- */
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+
+#include "setup.h"
+
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+#include <winsock.h>
+#include <time.h>
+#include <io.h>
+#else
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#include <sys/ioctl.h>
+#include <signal.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#ifndef HAVE_VPRINTF
+#error "We can't compile without vprintf() support!"
+#endif
+#ifndef HAVE_SELECT
+#error "We can't compile without select() support!"
+#endif
+#ifndef HAVE_SOCKET
+#error "We can't compile without socket() support!"
+#endif
+
+#endif
+
+#include "urldata.h"
+#include <curl/curl.h>
+#include "netrc.h"
+
+#include "formdata.h"
+#include "getenv.h"
+#include "base64.h"
+#include "ssluse.h"
+#include "hostip.h"
+#include "if2ip.h"
+#include "upload.h"
+#include "download.h"
+#include "sendf.h"
+#include "speedcheck.h"
+#include "getpass.h"
+#include "progress.h"
+#include "cookie.h"
+
+/* And now for the protocols */
+#include "ftp.h"
+#include "dict.h"
+#include "telnet.h"
+#include "http.h"
+#include "file.h"
+#include "ldap.h"
+
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
+/* -- -- */
+
+/***********************************************************************
+ * Start with some silly functions to make win32-systems survive
+ ***********************************************************************/
+#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
+static void cleanup(void)
+{
+ WSACleanup();
+}
+
+static int init(void)
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+ wVersionRequested = MAKEWORD(1, 1);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+
+ if (err != 0)
+ /* Tell the user that we couldn't find a useable */
+ /* winsock.dll. */
+ return 1;
+
+ /* Confirm that the Windows Sockets DLL supports 1.1.*/
+ /* Note that if the DLL supports versions greater */
+ /* than 1.1 in addition to 1.1, it will still return */
+ /* 1.1 in wVersion since that is the version we */
+ /* requested. */
+
+ if ( LOBYTE( wsaData.wVersion ) != 1 ||
+ HIBYTE( wsaData.wVersion ) != 1 ) {
+ /* Tell the user that we couldn't find a useable */
+
+ /* winsock.dll. */
+ WSACleanup();
+ return 1;
+ }
+ return 0;
+}
+/* The Windows Sockets DLL is acceptable. Proceed. */
+#else
+static int init(void) { return 0; }
+static void cleanup(void) {}
+#endif
+
+static UrgError _urlget(struct UrlData *data);
+
+
+void urlfree(struct UrlData *data, bool totally)
+{
+#ifdef USE_SSLEAY
+ if (data->use_ssl) {
+ if(data->ssl) {
+ SSL_shutdown(data->ssl);
+ SSL_set_connect_state(data->ssl);
+
+ SSL_free (data->ssl);
+ data->ssl = NULL;
+ }
+ if(data->ctx) {
+ SSL_CTX_free (data->ctx);
+ data->ctx = NULL;
+ }
+ data->use_ssl = FALSE; /* get back to ordinary socket usage */
+ }
+#endif /* USE_SSLEAY */
+
+ /* close possibly still open sockets */
+ if(-1 != data->secondarysocket) {
+ sclose(data->secondarysocket);
+ data->secondarysocket = -1;
+ }
+ if(-1 != data->firstsocket) {
+ sclose(data->firstsocket);
+ data->firstsocket=-1;
+ }
+
+
+ if(data->ptr_proxyuserpwd) {
+ free(data->ptr_proxyuserpwd);
+ data->ptr_proxyuserpwd=NULL;
+ }
+ if(data->ptr_uagent) {
+ free(data->ptr_uagent);
+ data->ptr_uagent=NULL;
+ }
+ if(data->ptr_userpwd) {
+ free(data->ptr_userpwd);
+ data->ptr_userpwd=NULL;
+ }
+ if(data->ptr_rangeline) {
+ free(data->ptr_rangeline);
+ data->ptr_rangeline=NULL;
+ }
+ if(data->ptr_ref) {
+ free(data->ptr_ref);
+ data->ptr_ref=NULL;
+ }
+ if(data->ptr_cookie) {
+ free(data->ptr_cookie);
+ data->ptr_cookie=NULL;
+ }
+ if(data->ptr_host) {
+ free(data->ptr_host);
+ data->ptr_host=NULL;
+ }
+
+ if(totally) {
+ /* we let the switch decide whether we're doing a part or total
+ cleanup */
+
+ /* check for allocated [URL] memory to free: */
+ if(data->freethis)
+ free(data->freethis);
+
+ if(data->headerbuff)
+ free(data->headerbuff);
+
+ cookie_cleanup(data->cookies);
+
+ free(data);
+
+ /* winsock crap cleanup */
+ cleanup();
+ }
+}
+
+typedef int (*func_T)(void);
+
+UrgError curl_urlget(UrgTag tag, ...)
+{
+ va_list arg;
+ func_T param_func = (func_T)0;
+ long param_long = 0;
+ void *param_obj = NULL;
+ UrgError res;
+ char *cookiefile;
+
+ struct UrlData *data;
+
+ /* this is for the lame win32 socket crap */
+ if(init())
+ return URG_FAILED_INIT;
+
+ data = (struct UrlData *)malloc(sizeof(struct UrlData));
+ if(data) {
+
+ memset(data, 0, sizeof(struct UrlData));
+
+ /* Let's set some default values: */
+ data->out = stdout; /* default output to stdout */
+ data->in = stdin; /* default input from stdin */
+ data->err = stderr; /* default stderr to stderr */
+ data->firstsocket = -1; /* no file descriptor */
+ data->secondarysocket = -1; /* no file descriptor */
+
+ /* use fwrite as default function to store output */
+ data->fwrite = (size_t (*)(char *, size_t, size_t, FILE *))fwrite;
+
+ /* use fread as default function to read input */
+ data->fread = (size_t (*)(char *, size_t, size_t, FILE *))fread;
+
+ data->infilesize = -1; /* we don't know any size */
+
+ data->current_speed = -1; /* init to negative == impossible */
+
+ va_start(arg, tag);
+
+ while(tag != URGTAG_DONE) {
+ /* PORTING NOTE:
+ Ojbect pointers can't necessarily be casted to function pointers and
+ therefore we need to know what type it is and read the correct type
+ at once. This should also correct problems with different sizes of
+ the types.
+ */
+
+ if(tag < URGTYPE_OBJECTPOINT) {
+ /* This is a LONG type */
+ param_long = va_arg(arg, long);
+ }
+ else if(tag < URGTYPE_FUNCTIONPOINT) {
+ /* This is a object pointer type */
+ param_obj = va_arg(arg, void *);
+ }
+ else
+ param_func = va_arg(arg, func_T );
+
+ /* printf("tag: %d\n", tag); */
+
+
+ switch(tag) {
+#ifdef MULTIDOC
+ case URGTAG_MOREDOCS:
+ data->moredoc = (struct MoreDoc *)param_obj;
+ break;
+#endif
+ case URGTAG_TIMECONDITION:
+ data->timecondition = (long)param_long;
+ break;
+
+ case URGTAG_TIMEVALUE:
+ data->timevalue = (long)param_long;
+ break;
+
+ case URGTAG_SSLVERSION:
+ data->ssl_version = (int)param_long;
+ break;
+
+ case URGTAG_COOKIEFILE:
+ cookiefile = (char *)param_obj;
+ if(cookiefile) {
+ data->cookies = cookie_init(cookiefile);
+ }
+ break;
+ case URGTAG_WRITEHEADER:
+ data->writeheader = (FILE *)param_obj;
+ break;
+ case URGTAG_COOKIE:
+ data->cookie = (char *)param_obj;
+ break;
+ case URGTAG_ERRORBUFFER:
+ data->errorbuffer = (char *)param_obj;
+ break;
+ case URGTAG_FILE:
+ data->out = (FILE *)param_obj;
+ break;
+ case URGTAG_FTPPORT:
+ data->ftpport = (char *)param_obj;
+ break;
+ case URGTAG_HTTPHEADER:
+ data->headers = (struct HttpHeader *)param_obj;
+ break;
+ case URGTAG_CUSTOMREQUEST:
+ data->customrequest = (char *)param_obj;
+ break;
+ case URGTAG_HTTPPOST:
+ data->httppost = (struct HttpPost *)param_obj;
+ break;
+ case URGTAG_INFILE:
+ data->in = (FILE *)param_obj;
+ break;
+ case URGTAG_INFILESIZE:
+ data->infilesize = (long)param_long;
+ break;
+ case URGTAG_LOW_SPEED_LIMIT:
+ data->low_speed_limit=(long)param_long;
+ break;
+ case URGTAG_LOW_SPEED_TIME:
+ data->low_speed_time=(long)param_long;
+ break;
+ case URGTAG_URL:
+ data->url = (char *)param_obj;
+ break;
+ case URGTAG_PORT:
+ /* this typecast is used to fool the compiler to NOT warn for a
+ "cast from pointer to integer of different size" */
+ data->port = (unsigned short)((long)param_long);
+ break;
+ case URGTAG_POSTFIELDS:
+ data->postfields = (char *)param_obj;
+ break;
+ case URGTAG_PROGRESSMODE:
+ data->progressmode = (long)param_long;
+ break;
+ case URGTAG_REFERER:
+ data->referer = (char *)param_obj;
+ break;
+ case URGTAG_PROXY:
+ data->proxy = (char *)param_obj;
+ break;
+ case URGTAG_FLAGS:
+ data->conf = (long)param_long;
+ break;
+ case URGTAG_TIMEOUT:
+ data->timeout = (long)param_long;
+ break;
+ case URGTAG_USERAGENT:
+ data->useragent = (char *)param_obj;
+ break;
+ case URGTAG_USERPWD:
+ data->userpwd = (char *)param_obj;
+ break;
+ case URGTAG_PROXYUSERPWD:
+ data->proxyuserpwd = (char *)param_obj;
+ break;
+ case URGTAG_RANGE:
+ data->range = (char *)param_obj;
+ break;
+ case URGTAG_RESUME_FROM:
+ data->resume_from = (long)param_long;
+ break;
+ case URGTAG_STDERR:
+ data->err = (FILE *)param_obj;
+ break;
+ case URGTAG_WRITEFUNCTION:
+ data->fwrite = (size_t (*)(char *, size_t, size_t, FILE *))param_func;
+ break;
+ case URGTAG_READFUNCTION:
+ data->fread = (size_t (*)(char *, size_t, size_t, FILE *))param_func;
+ break;
+ case URGTAG_SSLCERT:
+ data->cert = (char *)param_obj;
+ break;
+ case URGTAG_SSLCERTPASSWD:
+ data->cert_passwd = (char *)param_obj;
+ break;
+ case URGTAG_CRLF:
+ data->crlf = (long)param_long;
+ break;
+ case URGTAG_QUOTE:
+ data->quote = (struct curl_slist *)param_obj;
+ break;
+ case URGTAG_DONE: /* done with the parsing, fall through */
+ continue;
+ default:
+ /* unknown tag and its companion, just ignore: */
+ break;
+ }
+ tag = va_arg(arg, UrgTag);
+ }
+
+ va_end(arg);
+
+ data-> headerbuff=(char*)malloc(HEADERSIZE);
+ if(!data->headerbuff)
+ return URG_FAILED_INIT;
+
+ data-> headersize=HEADERSIZE;
+
+ res = _urlget(data); /* fetch the URL please */
+
+ while((res == URG_OK) && data->newurl) {
+ /* Location: redirect */
+ char prot[16];
+ char path[URL_MAX_LENGTH];
+
+ if(2 != sscanf(data->newurl, "%15[^:]://%" URL_MAX_LENGTH_TXT
+ "s", prot, path)) {
+ /***
+ *DANG* this is an RFC 2068 violation. The URL is supposed
+ to be absolute and this doesn't seem to be that!
+ At least the Zeus HTTP server seem to do this.
+ ***
+ Instead, we have to TRY to append this new path to the old URL
+ to the right of the host part. Oh crap, this is doomed to cause
+ problems in the future...
+ */
+ char *protsep;
+ char *pathsep;
+ char *newest;
+
+ /* protsep points to the start of the host name */
+ protsep=strstr(data->url, "//");
+ if(!protsep)
+ protsep=data->url;
+ else {
+ data->port=0; /* we got a full URL and then we should reset the
+ port number here to re-initiate it later */
+ protsep+=2; /* pass the // */
+ }
+
+ if('/' != data->newurl[0]) {
+ /* First we need to find out if there's a ?-letter in the URL, and
+ cut it and the right-side of that off */
+ pathsep = strrchr(protsep, '?');
+ if(pathsep)
+ *pathsep=0;
+
+ /* we have a relative path to append to the last slash if
+ there's one available */
+ pathsep = strrchr(protsep, '/');
+ if(pathsep)
+ *pathsep=0;
+ }
+ else {
+ /* We got a new absolute path for this server, cut off from the
+ first slash */
+ pathsep = strchr(protsep, '/');
+ if(pathsep)
+ *pathsep=0;
+ }
+
+ newest=(char *)malloc( strlen(data->url) +
+ 1 + /* possible slash */
+ strlen(data->newurl) + 1/* zero byte */);
+
+ if(!newest)
+ return URG_OUT_OF_MEMORY;
+ sprintf(newest, "%s%s%s", data->url, ('/' == data->newurl[0])?"":"/",
+ data->newurl);
+ free(data->newurl);
+ data->newurl = newest;
+ }
+
+ data->url = data->newurl;
+ data->newurl = NULL; /* don't show! */
+
+ infof(data, "Follows Location: to new URL: '%s'\n", data->url);
+
+ /* clean up the sockets and SSL stuff from the previous "round" */
+ urlfree(data, FALSE);
+
+ res = _urlget(data);
+ }
+ if(data->newurl)
+ free(data->newurl);
+
+ }
+ else
+ res = URG_FAILED_INIT; /* failed */
+
+ /* total cleanup */
+ urlfree(data, TRUE);
+
+ return res;
+}
+
+
+/*
+ * Read everything until a newline.
+ */
+
+static int GetLine(int sockfd, char *buf,
+ struct UrlData *data)
+{
+ int nread;
+ int read_rc=1;
+ char *ptr;
+ ptr=buf;
+
+ /* get us a full line, terminated with a newline */
+ for(nread=0;
+ (nread<BUFSIZE) && read_rc;
+ nread++, ptr++) {
+#ifdef USE_SSLEAY
+ if (data->use_ssl) {
+ read_rc = SSL_read(data->ssl, ptr, 1);
+ }
+ else {
+#endif
+ read_rc = sread(sockfd, ptr, 1);
+#ifdef USE_SSLEAY
+ }
+#endif /* USE_SSLEAY */
+ if (*ptr == '\n')
+ break;
+ }
+ *ptr=0; /* zero terminate */
+
+ if(data->conf & CONF_VERBOSE) {
+ fputs("< ", data->err);
+ fwrite(buf, 1, nread, data->err);
+ fputs("\n", data->err);
+ }
+ return nread;
+}
+
+
+
+#ifndef WIN32
+#ifndef RETSIGTYPE
+#define RETSIGTYPE void
+#endif
+RETSIGTYPE alarmfunc(int signal)
+{
+ /* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
+ (void)signal;
+ return;
+}
+#endif
+
+/* ====================================================== */
+/*
+ * urlget <url>
+ * (result put on stdout)
+ *
+ * <url> ::= <proto> "://" <host> [ ":" <port> ] "/" <path>
+ *
+ * <proto> = "HTTP" | "HTTPS" | "GOPHER" | "FTP"
+ *
+ * When FTP:
+ *
+ * <host> ::= [ <user> ":" <password> "@" ] <host>
+ */
+
+static UrgError _urlget(struct UrlData *data)
+{
+ struct hostent *hp=NULL;
+ struct sockaddr_in serv_addr;
+ char *buf;
+ char proto[64];
+ char gname[256]="default.com";
+ char *name;
+ char path[URL_MAX_LENGTH]="/";
+ char *ppath, *tmp;
+ long bytecount;
+ struct timeval now;
+
+ UrgError result;
+ char resumerange[12]="";
+
+ buf = data->buffer; /* this is our buffer */
+
+#if 0
+ signal(SIGALRM, alarmfunc);
+#endif
+
+ /* Parse <url> */
+ /* We need to parse the url, even when using the proxy, because
+ * we will need the hostname and port in case we are trying
+ * to SSL connect through the proxy -- and we don't know if we
+ * will need to use SSL until we parse the url ...
+ */
+ if((1 == sscanf(data->url, "file://%" URL_MAX_LENGTH_TXT "[^\n]",
+ path))) {
+ /* we deal with file://<host>/<path> differently since it
+ supports no hostname other than "localhost" and "127.0.0.1",
+ which ist unique among the protocols specified in RFC 1738 */
+ if (strstr(path, "localhost/") || strstr(path, "127.0.0.1/"))
+ strcpy(path, &path[10]); /* ... since coincidentally
+ both host strings are of
+ equal length */
+ /* otherwise, <host>/ is quietly ommitted */
+
+
+ /* that's it, no more fiddling with proxies, redirections,
+ or SSL for files, go directly to the file reading function */
+ result = file(data, path, &bytecount);
+ if(result)
+ return result;
+
+ return URG_OK;
+ }
+ else if (2 > sscanf(data->url, "%64[^\n:]://%256[^\n/]%" URL_MAX_LENGTH_TXT "[^\n]",
+ proto, gname, path)) {
+
+
+ /* badly formatted, let's try the browser-style _without_ 'http://' */
+ if((1 > sscanf(data->url, "%256[^\n/]%" URL_MAX_LENGTH_TXT "[^\n]", gname,
+ path)) ) {
+ failf(data, "<url> malformed");
+ return URG_URL_MALFORMAT;
+ }
+ if(strnequal(gname, "FTP", 3)) {
+ strcpy(proto, "ftp");
+ }
+ else if(strnequal(gname, "GOPHER", 6))
+ strcpy(proto, "gopher");
+#ifdef USE_SSLEAY
+ else if(strnequal(gname, "HTTPS", 5))
+ strcpy(proto, "https");
+#endif /* USE_SSLEAY */
+ else if(strnequal(gname, "TELNET", 6))
+ strcpy(proto, "telnet");
+ else if (strnequal(gname, "DICT", sizeof("DICT")-1))
+ strcpy(proto, "DICT");
+ else if (strnequal(gname, "LDAP", sizeof("LDAP")-1))
+ strcpy(proto, "LDAP");
+ else
+ strcpy(proto, "http");
+
+ data->conf |= CONF_NOPROT;
+ }
+
+
+ if((data->conf & CONF_USERPWD) && ! (data->conf & CONF_NETRC)) {
+ if(':' != *data->userpwd) {
+ if((1 <= sscanf(data->userpwd, "%127[^:]:%127s",
+ data->user, data->passwd))) {
+ /* check for password, if no ask for one */
+ if( !data->passwd[0] )
+ {
+ strncpy(data->passwd, getpass("password: "), sizeof(data->passwd));
+ }
+ }
+ }
+ if(!data->user[0]) {
+ failf(data, "USER malformat: user name can't be zero length");
+ return URG_MALFORMAT_USER;
+ }
+ }
+
+ if(data->conf & CONF_PROXYUSERPWD) {
+ if(':' != *data->proxyuserpwd) {
+ if((1 <= sscanf(data->proxyuserpwd, "%127[^:]:%127s",
+ data->proxyuser, data->proxypasswd))) {
+ /* check for password, if no ask for one */
+ if( !data->proxypasswd[0] )
+ {
+ strncpy(data->proxypasswd, getpass("proxy password: "), sizeof(data->proxypasswd));
+ }
+ }
+ }
+ if(!data->proxyuser[0]) {
+ failf(data, " Proxy USER malformat: user name can't be zero length");
+ return URG_MALFORMAT_USER;
+ }
+ }
+
+ name = gname;
+ ppath = path;
+ data->hostname = name;
+
+
+ if(!(data->conf & CONF_PROXY)) {
+ /* If proxy was not specified, we check for default proxy environment
+ variables, to enable i.e Lynx compliance:
+
+ HTTP_PROXY http://some.server.dom:port/
+ HTTPS_PROXY http://some.server.dom:port/
+ FTP_PROXY http://some.server.dom:port/
+ GOPHER_PROXY http://some.server.dom:port/
+ NO_PROXY host.domain.dom (a comma-separated list of hosts which should
+ not be proxied, or an asterisk to override all proxy variables)
+ ALL_PROXY seems to exist for the CERN www lib. Probably the first to
+ check for.
+
+ */
+ char *no_proxy=GetEnv("NO_PROXY");
+ char *proxy=NULL;
+ char proxy_env[128];
+
+ if(!no_proxy || !strequal("*", no_proxy)) {
+ /* NO_PROXY wasn't specified or it wasn't just an asterisk */
+ char *nope;
+
+ nope=no_proxy?strtok(no_proxy, ", "):NULL;
+ while(nope) {
+ if(strlen(nope) <= strlen(name)) {
+ char *checkn=
+ name + strlen(name) - strlen(nope);
+ if(strnequal(nope, checkn, strlen(nope))) {
+ /* no proxy for this host! */
+ break;
+ }
+ }
+ nope=strtok(NULL, ", ");
+ }
+ if(!nope) {
+ /* It was not listed as without proxy */
+ char *protop = proto;
+ char *envp = proxy_env;
+ char *prox;
+
+ /* Now, build <PROTOCOL>_PROXY and check for such a one to use */
+ while(*protop) {
+ *envp++ = toupper(*protop++);
+ }
+ /* append _PROXY */
+ strcpy(envp, "_PROXY");
+#if 0
+ infof(data, "DEBUG: checks the environment variable %s\n", proxy_env);
+#endif
+ /* read the protocol proxy: */
+ prox=GetEnv(proxy_env);
+
+ if(prox && *prox) { /* don't count "" strings */
+ proxy = prox; /* use this */
+ }
+ else
+ proxy = GetEnv("ALL_PROXY"); /* default proxy to use */
+
+ if(proxy && *proxy) {
+ /* we have a proxy here to set */
+ data->proxy = proxy;
+ data->conf |= CONF_PROXY;
+ }
+ } /* if (!nope) - it wasn't specfied non-proxy */
+ } /* NO_PROXY wasn't specified or '*' */
+ } /* if not using proxy */
+
+ if((data->conf & (CONF_PROXY|CONF_NOPROT)) == (CONF_PROXY|CONF_NOPROT) ) {
+ /* We're guessing prefixes here and since we're told to use a proxy, we
+ need to add the protocol prefix to the URL string before we continue!
+ */
+ char *reurl;
+
+ reurl = maprintf("%s://%s", proto, data->url);
+
+ if(!reurl)
+ return URG_OUT_OF_MEMORY;
+
+ data->url = reurl;
+ if(data->freethis)
+ free(data->freethis);
+ data->freethis = reurl;
+
+ data->conf &= ~CONF_NOPROT; /* switch that one off again */
+ }
+
+ /* RESUME on a HTTP page is a tricky business. First, let's just check that
+ 'range' isn't used, then set the range parameter and leave the resume as
+ it is to inform about this situation for later use. We will then
+ "attempt" to resume, and if we're talking to a HTTP/1.1 (or later)
+ server, we will get the document resumed. If we talk to a HTTP/1.0
+ server, we just fail since we can't rewind the file writing from within
+ this function. */
+ if(data->resume_from) {
+ if(!(data->conf & CONF_RANGE)) {
+ /* if it already was in use, we just skip this */
+ sprintf(resumerange, "%d-", data->resume_from);
+ data->range=resumerange; /* tell ourselves to fetch this range */
+ data->conf |= CONF_RANGE; /* switch on range usage */
+ }
+ }
+
+
+ if(data->timeout) {
+ /* We set the timeout on the connection/resolving phase first, separately
+ from the download/upload part to allow a maximum time on everything */
+ myalarm(data->timeout); /* this sends a signal when the timeout fires
+ off, and that will abort system calls */
+ }
+
+ /*
+ * Hmm, if we are using a proxy, then we can skip the GOPHER and the
+ * FTP steps, although we cannot skip the HTTPS step (since the proxy
+ * works differently, depending on whether its SSL or not).
+ */
+
+ if (strequal(proto, "HTTP")) {
+ if(!data->port)
+ data->port = PORT_HTTP;
+ data->remote_port = PORT_HTTP;
+ data->conf |= CONF_HTTP;
+ }
+ else if (strequal(proto, "HTTPS")) {
+#ifdef USE_SSLEAY
+ if(!data->port)
+ data->port = PORT_HTTPS;
+ data->remote_port = PORT_HTTPS;
+ data->conf |= CONF_HTTP;
+ data->conf |= CONF_HTTPS;
+#else /* USE_SSLEAY */
+ failf(data, "SSL is disabled, https: not supported!");
+ return URG_UNSUPPORTED_PROTOCOL;
+#endif /* !USE_SSLEAY */
+ }
+ else if (strequal(proto, "GOPHER")) {
+ if(!data->port)
+ data->port = PORT_GOPHER;
+ data->remote_port = PORT_GOPHER;
+ /* Skip /<item-type>/ in path if present */
+ if (isdigit((int)path[1])) {
+ ppath = strchr(&path[1], '/');
+ if (ppath == NULL)
+ ppath = path;
+ }
+ data->conf |= CONF_GOPHER;
+ }
+ else if(strequal(proto, "FTP")) {
+ char *type;
+ if(!data->port)
+ data->port = PORT_FTP;
+ data->remote_port = PORT_FTP;
+ data->conf |= CONF_FTP;
+
+ ppath++; /* don't include the initial slash */
+
+ /* FTP URLs support an extension like ";type=<typecode>" that
+ we'll try to get now! */
+ type=strstr(ppath, ";type=");
+ if(!type) {
+ type=strstr(gname, ";type=");
+ }
+ if(type) {
+ char command;
+ *type=0;
+ command = toupper(type[6]);
+ switch(command) {
+ case 'A': /* ASCII mode */
+ data->conf |= CONF_FTPASCII;
+ break;
+ case 'D': /* directory mode */
+ data->conf |= CONF_FTPLISTONLY;
+ break;
+ case 'I': /* binary mode */
+ default:
+ /* switch off ASCII */
+ data->conf &= ~CONF_FTPASCII;
+ break;
+ }
+ }
+ }
+ else if(strequal(proto, "TELNET")) {
+ /* telnet testing factory */
+ data->conf |= CONF_TELNET;
+ if(!data->port)
+ data->port = PORT_TELNET;
+ data->remote_port = PORT_TELNET;
+ }
+ else if (strequal(proto, "DICT")) {
+ data->conf |= CONF_DICT;
+ if(!data->port)
+ data->port = PORT_DICT;
+ data->remote_port = PORT_DICT;
+ }
+ else if (strequal(proto, "LDAP")) {
+ data->conf |= CONF_LDAP;
+ if(!data->port)
+ data->port = PORT_LDAP;
+ data->remote_port = PORT_LDAP;
+ }
+ /* file:// is handled above */
+ /* else if (strequal(proto, "FILE")) {
+ data->conf |= CONF_FILE;
+
+ result = file(data, path, &bytecount);
+ if(result)
+ return result;
+
+ return URG_OK;
+ }*/
+ else {
+ failf(data, "Unsupported protocol: %s", proto);
+ return URG_UNSUPPORTED_PROTOCOL;
+ }
+
+ if(data->conf & CONF_NETRC) {
+ if(ParseNetrc(data->hostname, data->user, data->passwd)) {
+ infof(data, "Couldn't find host %s in the .netrc file, using defaults",
+ data->hostname);
+ }
+ /* weather we failed or not, we don't know which fields that were filled
+ in anyway */
+ if(!data->user[0])
+ strcpy(data->user, CURL_DEFAULT_USER);
+ if(!data->passwd[0])
+ strcpy(data->passwd, CURL_DEFAULT_PASSWORD);
+ if(data->conf & CONF_HTTP) {
+ data->conf |= CONF_USERPWD;
+ }
+ }
+ else if(!(data->conf & CONF_USERPWD) &&
+ (data->conf & (CONF_FTP|CONF_HTTP)) ) {
+ /* This is a FTP or HTTP URL, and we haven't got the user+password in
+ the extra parameter, we will now try to extract the possible
+ user+password pair in a string like:
+ ftp://user:password@ftp.my.site:8021/README */
+ char *ptr=NULL; /* assign to remove possible warnings */
+ if(':' == *name) {
+ failf(data, "URL malformat: user can't be zero length");
+ return URG_URL_MALFORMAT_USER;
+ }
+ if((1 <= sscanf(name, "%127[^:]:%127[^@]",
+ data->user, data->passwd)) && (ptr=strchr(name, '@'))) {
+ name = ++ptr;
+ data->conf |= CONF_USERPWD;
+ }
+ else {
+ strcpy(data->user, CURL_DEFAULT_USER);
+ strcpy(data->passwd, CURL_DEFAULT_PASSWORD);
+ }
+ }
+
+ if(!(data->conf & CONF_PROXY)) {
+ /* If not connecting via a proxy, extract the port from the URL, if it is
+ * there, thus overriding any defaults that might have been set above. */
+ tmp = strchr(name, ':');
+ if (tmp) {
+ *tmp++ = '\0';
+ data->port = atoi(tmp);
+ }
+
+ /* Connect to target host right on */
+ if(!(hp = GetHost(data, name))) {
+ failf(data, "Couldn't resolv host '%s'", name);
+ return URG_COULDNT_RESOLVE_HOST;
+ }
+ }
+ else {
+ char *prox_portno;
+ char *endofprot;
+
+ /* we use proxy all right, but we wanna know the remote port for SSL
+ reasons */
+ tmp = strchr(name, ':');
+ if (tmp) {
+ *tmp++ = '\0'; /* cut off the name there */
+ data->remote_port = atoi(tmp);
+ }
+
+ /* Daniel Dec 10, 1998:
+ We do the proxy host string parsing here. We want the host name and the
+ port name. Accept a protocol:// prefix, even though it should just be
+ ignored. */
+
+ /* 1. skip the protocol part if present */
+ endofprot=strstr(data->proxy, "://");
+ if(endofprot) {
+ data->proxy = endofprot+3;
+ }
+
+ /* allow user to specify proxy.server.com:1080 if desired */
+ prox_portno = strchr (data->proxy, ':');
+ if (prox_portno) {
+ *prox_portno = 0x0; /* cut off number from host name */
+ prox_portno ++;
+ /* now set the local port number */
+ data->port = atoi(prox_portno);
+ }
+
+ /* connect to proxy */
+ if(!(hp = GetHost(data, data->proxy))) {
+ failf(data, "Couldn't resolv proxy '%s'", data->proxy);
+ return URG_COULDNT_RESOLVE_PROXY;
+ }
+ }
+
+ data->firstsocket = socket(AF_INET, SOCK_STREAM, 0);
+
+ memset((char *) &serv_addr, '\0', sizeof(serv_addr));
+ memcpy((char *)&(serv_addr.sin_addr), hp->h_addr, hp->h_length);
+ serv_addr.sin_family = hp->h_addrtype;
+
+ serv_addr.sin_port = htons(data->port);
+
+ if (connect(data->firstsocket, (struct sockaddr *) &serv_addr,
+ sizeof(serv_addr)) < 0) {
+ switch(errno) {
+#ifdef ECONNREFUSED
+ /* this should be made nicer */
+ case ECONNREFUSED:
+ failf(data, "Connection refused");
+ break;
+#endif
+#ifdef EINTR
+ case EINTR:
+ failf(data, "Connection timeouted");
+ break;
+#endif
+ default:
+ failf(data, "Can't connect to server: %d", errno);
+ break;
+ }
+ return URG_COULDNT_CONNECT;
+ }
+
+ if(data->conf & CONF_PROXYUSERPWD) {
+ char authorization[512];
+ sprintf(data->buffer, "%s:%s", data->proxyuser, data->proxypasswd);
+ base64Encode(data->buffer, authorization);
+
+ data->ptr_proxyuserpwd = maprintf("Proxy-authorization: Basic %s\015\012",
+ authorization);
+ }
+ if(data->conf & (CONF_HTTPS|CONF_HTTP)) {
+ if(data->useragent) {
+ data->ptr_uagent = maprintf("User-Agent: %s\015\012", data->useragent);
+ }
+ }
+
+
+ /* If we are not using a proxy and we want a secure connection,
+ * perform SSL initialization & connection now.
+ * If using a proxy with https, then we must tell the proxy to CONNECT
+ * us to the host we want to talk to. Only after the connect
+ * has occured, can we start talking SSL
+ */
+ if (data->conf & CONF_HTTPS) {
+ if (data->conf & CONF_PROXY) {
+
+ /* OK, now send the connect statment */
+ sendf(data->firstsocket, data,
+ "CONNECT %s:%d HTTP/1.0\015\012"
+ "%s"
+ "%s"
+ "\r\n",
+ data->hostname, data->remote_port,
+ (data->conf&CONF_PROXYUSERPWD)?data->ptr_proxyuserpwd:"",
+ (data->useragent?data->ptr_uagent:"")
+ );
+
+ /* wait for the proxy to send us a HTTP/1.0 200 OK header */
+ /* Daniel rewrote this part Nov 5 1998 to make it more obvious */
+ {
+ int httperror=0;
+ int subversion=0;
+ while(GetLine(data->firstsocket, data->buffer, data)) {
+ if('\r' == data->buffer[0])
+ break; /* end of headers */
+ if(2 == sscanf(data->buffer, "HTTP/1.%d %d",
+ &subversion,
+ &httperror)) {
+ ;
+ }
+ }
+ if(200 != httperror) {
+ if(407 == httperror)
+ /* Added Nov 6 1998 */
+ failf(data, "Proxy requires authorization!");
+ else
+ failf(data, "Received error code %d from proxy", httperror);
+ return URG_READ_ERROR;
+ }
+ }
+ infof (data, "Proxy has replied to CONNECT request\n");
+ }
+
+ /* now, perform the SSL initialization for this socket */
+ if(UrgSSLConnect (data)) {
+ return URG_SSL_CONNECT_ERROR;
+ }
+ }
+
+ now = tvnow(); /* time this *after* the connect is done */
+ bytecount = 0;
+
+ /* Figure out the ip-number and the first host name it shows: */
+ {
+ struct in_addr in;
+ (void) memcpy(&in.s_addr, *hp->h_addr_list, sizeof (in.s_addr));
+ infof(data, "Connected to %s (%s)\n", hp->h_name, inet_ntoa(in));
+ }
+
+ if((data->conf&(CONF_FTP|CONF_PROXY)) == CONF_FTP) {
+ result = ftp(data, &bytecount, data->user, data->passwd, ppath);
+ if(result)
+ return result;
+ }
+ else if(data->conf & CONF_TELNET) {
+ result=telnet(data);
+ if(result)
+ return result;
+ }
+ else if (data->conf & CONF_LDAP) {
+ result = ldap(data, path, &bytecount);
+ if (result)
+ return result;
+ }
+ else if (data->conf & CONF_DICT) {
+ result = dict(data, path, &bytecount);
+ if(result)
+ return result;
+ }
+ else {
+ result = http(data, ppath, name, &bytecount);
+ if(result)
+ return result;
+ }
+ if(bytecount) {
+ double ittook = tvdiff (tvnow(), now);
+ infof(data, "%i bytes transfered in %.3lf seconds (%.0lf bytes/sec).\n",
+ bytecount, ittook, (double)bytecount/(ittook!=0.0?ittook:1));
+ }
+ return URG_OK;
+}
+
diff --git a/lib/url.h b/lib/url.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/lib/url.h
diff --git a/lib/urldata.h b/lib/urldata.h
new file mode 100644
index 000000000..f171cd096
--- /dev/null
+++ b/lib/urldata.h
@@ -0,0 +1,212 @@
+#ifndef __URLDATA_H
+#define __URLDATA_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+/* This file is for lib internal stuff */
+
+#include "setup.h"
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 256
+#endif
+
+#define PORT_FTP 21
+#define PORT_TELNET 23
+#define PORT_GOPHER 70
+#define PORT_HTTP 80
+#define PORT_HTTPS 443
+#define PORT_DICT 2628
+#define PORT_LDAP 389
+
+#define DICT_MATCH "/MATCH:"
+#define DICT_MATCH2 "/M:"
+#define DICT_MATCH3 "/FIND:"
+#define DICT_DEFINE "/DEFINE:"
+#define DICT_DEFINE2 "/D:"
+#define DICT_DEFINE3 "/LOOKUP:"
+
+#define CURL_DEFAULT_USER "anonymous"
+#define CURL_DEFAULT_PASSWORD "curl_by_Daniel.Stenberg@haxx.nu"
+
+#include "cookie.h"
+
+#ifdef USE_SSLEAY
+/* SSLeay stuff usually in /usr/local/ssl/include */
+#ifdef USE_OPENSSL
+#include "openssl/rsa.h"
+#include "openssl/crypto.h"
+#include "openssl/x509.h"
+#include "openssl/pem.h"
+#include "openssl/ssl.h"
+#include "openssl/err.h"
+#else
+#include "rsa.h"
+#include "crypto.h"
+#include "x509.h"
+#include "pem.h"
+#include "ssl.h"
+#include "err.h"
+#endif
+#endif
+
+
+/* Download buffer size, keep it fairly big for speed reasons */
+#define BUFSIZE (1024*50)
+
+/* Initial size of the buffer to store headers in, it'll be enlarged in case
+ of need. */
+#define HEADERSIZE 256
+
+struct UrlData {
+ FILE *out; /* the fetched file goes here */
+ FILE *in; /* the uploaded file is read from here */
+ FILE *err; /* the stderr writes goes here */
+ FILE *writeheader; /* write the header to this is non-NULL */
+ char *url; /* what to get */
+ char *freethis; /* if non-NULL, an allocated string for the URL */
+ char *hostname; /* hostname to contect, as parsed from url */
+ unsigned short port; /* which port to use (if non-protocol bind) set
+ CONF_PORT to use this */
+ unsigned short remote_port; /* what remote port to connect to, not the proxy
+ port! */
+ char *proxy; /* if proxy, set it here, set CONF_PROXY to use this */
+ long conf; /* configure flags */
+ char *userpwd; /* <user:password>, if used */
+ char *proxyuserpwd; /* Proxy <user:password>, if used */
+ char *range; /* range, if used. See README for detailed specification on
+ this syntax. */
+ char *postfields; /* if POST, set the fields' values here */
+ char *referer;
+ char *errorbuffer; /* store failure messages in here */
+ char *useragent; /* User-Agent string */
+
+ char *ftpport; /* port to send with the PORT command */
+
+ /* function that stores the output:*/
+ size_t (*fwrite)(char *buffer,
+ size_t size,
+ size_t nitems,
+ FILE *outstream);
+
+ /* function that reads the input:*/
+ size_t (*fread)(char *buffer,
+ size_t size,
+ size_t nitems,
+ FILE *outstream);
+
+ long timeout; /* in seconds, 0 means no timeout */
+ long infilesize; /* size of file to upload, -1 means unknown */
+
+ long maxdownload; /* in bytes, the maximum amount of data to fetch, 0
+ means unlimited */
+
+ /* fields only set and used within _urlget() */
+ int firstsocket; /* the main socket to use */
+ int secondarysocket; /* for i.e ftp transfers */
+
+ char buffer[BUFSIZE+1]; /* buffer with size BUFSIZE */
+
+ double current_speed; /* the ProgressShow() funcion sets this */
+
+ long low_speed_limit; /* bytes/second */
+ long low_speed_time; /* number of seconds */
+
+ int resume_from; /* continue [ftp] transfer from here */
+
+ char *cookie; /* HTTP cookie string to send */
+
+ short use_ssl; /* use ssl encrypted communications */
+
+ char *newurl; /* This can only be set if a Location: was in the
+ document headers */
+
+#ifdef MULTIDOC
+ struct MoreDoc *moredoc; /* linked list of more docs to get */
+#endif
+ struct HttpHeader *headers; /* linked list of extra headers */
+ struct HttpPost *httppost; /* linked list of POST data */
+
+ char *cert; /* PEM-formatted certificate */
+ char *cert_passwd; /* plain text certificate password */
+
+ struct CookieInfo *cookies;
+
+ long ssl_version; /* what version the client wants to use */
+#ifdef USE_SSLEAY
+ SSL_CTX* ctx;
+ SSL* ssl;
+ X509* server_cert;
+#endif /* USE_SSLEAY */
+ long crlf;
+ struct curl_slist *quote;
+
+ TimeCond timecondition;
+ time_t timevalue;
+
+ char *customrequest; /* http/ftp request to use */
+
+ char *headerbuff; /* allocated buffer to store headers in */
+ int headersize; /* size of the allocation */
+ int progressmode; /* what kind of progress meter to display */
+
+#define MAX_CURL_USER_LENGTH 128
+#define MAX_CURL_PASSWORD_LENGTH 128
+
+ char user[MAX_CURL_USER_LENGTH];
+ char passwd[MAX_CURL_PASSWORD_LENGTH];
+ char proxyuser[MAX_CURL_USER_LENGTH];
+ char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
+
+ /**** Dynamicly allocated strings, may need to be freed on return ****/
+ char *ptr_proxyuserpwd; /* free later if not NULL! */
+ char *ptr_uagent; /* free later if not NULL! */
+ char *ptr_userpwd; /* free later if not NULL! */
+ char *ptr_rangeline; /* free later if not NULL! */
+ char *ptr_ref; /* free later if not NULL! */
+ char *ptr_cookie; /* free later if not NULL! */
+ char *ptr_host; /* free later if not NULL */
+};
+
+#define LIBCURL_NAME "libcurl"
+#define LIBCURL_ID LIBCURL_NAME " " LIBCURL_VERSION " " SSL_ID
+
+
+#endif
diff --git a/lib/version.c b/lib/version.c
new file mode 100644
index 000000000..73be0d7f9
--- /dev/null
+++ b/lib/version.c
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <string.h>
+#include <stdio.h>
+
+#include "setup.h"
+#include <curl/curl.h>
+#include "urldata.h"
+
+char *curl_version(void)
+{
+ static char version[200];
+ char *ptr;
+#if defined(USE_SSLEAY)
+ static char sub[2];
+#endif
+ strcpy(version, LIBCURL_NAME " " LIBCURL_VERSION );
+ ptr=strchr(version, '\0');
+
+#ifdef USE_SSLEAY
+
+#if (SSLEAY_VERSION_NUMBER >= 0x900000)
+ sprintf(ptr, " (SSL %x.%x.%x)",
+ (SSLEAY_VERSION_NUMBER>>28)&0xff,
+ (SSLEAY_VERSION_NUMBER>>20)&0xff,
+ (SSLEAY_VERSION_NUMBER>>12)&0xf);
+#else
+ if(SSLEAY_VERSION_NUMBER&0x0f) {
+ sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;
+ }
+ else
+ sub[0]=0;
+
+ sprintf(ptr, " (SSL %x.%x.%x%s)",
+ (SSLEAY_VERSION_NUMBER>>12)&0xff,
+ (SSLEAY_VERSION_NUMBER>>8)&0xf,
+ (SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
+
+#endif
+ ptr=strchr(ptr, '\0');
+#endif
+
+#ifdef USE_ZLIB
+ sprintf(ptr, " (zlib %s)", zlibVersion());
+#endif
+
+ return version;
+}
diff --git a/maketgz b/maketgz
new file mode 100755
index 000000000..6ad429b5d
--- /dev/null
+++ b/maketgz
@@ -0,0 +1,152 @@
+#! /bin/sh
+# Script to build release-archives with
+#
+
+echo "LIB version number?"
+read version
+
+libversion="$version"
+
+echo "CURL version number?"
+read curlversion
+
+HEADER=include/curl/curl.h
+CHEADER=src/version.h
+
+
+# Replace version number in header file:
+sed 's/#define LIBCURL_VERSION.*/#define LIBCURL_VERSION "'$libversion'"/g' $HEADER >$HEADER.new
+
+# Save old header file
+cp -p $HEADER $HEADER.old
+
+# Make new header:
+mv $HEADER.new $HEADER
+
+# Replace version number in header file:
+sed 's/#define CURL_VERSION.*/#define CURL_VERSION "'$curlversion'"/g' $CHEADER >$CHEADER.new
+
+# Save old header file
+cp -p $CHEADER $CHEADER.old
+
+# Make new header:
+mv $CHEADER.new $CHEADER
+
+findprog()
+{
+ file="$1"
+ for part in `echo $PATH| tr ':' ' '`; do
+ path="$part/$file"
+ if [ -x "$path" ]; then
+ # there it is!
+ return 1
+ fi
+ done
+
+ # no such executable
+ return 0
+}
+
+############################################################################
+#
+# If we have autoconf we can just as well update configure.in to contain our
+# brand new version number:
+#
+
+if { findprog autoconf >/dev/null 2>/dev/null; } then
+ echo "- No autoconf found, we leave configure as it is"
+else
+ # Replace version number in configure.in file:
+
+ CONF="configure.in"
+
+ sed 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE(curl,"'$version'")/g' $CONF >$CONF.new
+
+ # Save old file
+ cp -p $CONF $CONF.old
+
+ # Make new configure.in
+ mv $CONF.new $CONF
+
+ # Update the configure script
+ echo "Runs autoconf"
+ autoconf
+fi
+
+############################################################################
+#
+# automake is needed to run to make a non-GNU Makefile.in if Makefile.am has
+# been modified.
+#
+
+if { findprog automake >/dev/null 2>/dev/null; } then
+ echo "- Could not find or run automake, I hope you know what you're doing!"
+else
+ echo "Runs automake --include-deps"
+ automake --include-deps
+fi
+
+############################################################################
+#
+# Now run make first to make the file dates decent and make sure that it
+# compiles just before release!
+#
+
+make
+
+# get current dir
+dir=`pwd`
+
+# Get basename
+orig=`basename $dir`
+
+# Get the left part of the dash (-)
+new=`echo $orig | cut -d- -f1`
+
+# Build new directory name
+n=$new-$version;
+
+# Tell the world what we're doing
+echo "Copying files into distribution archive";
+
+if [ -r $n ]; then
+ echo "Directory already exists!"
+ exit
+fi
+
+# Create the new dir
+mkdir $n
+
+# Copy all relevant files, with path and permissions!
+tar -cf - `cat FILES` | (cd $n; tar -xBpf -)
+
+# Create the distribution root Makefile from Makefile.dist
+cp -p Makefile.dist $n/Makefile
+
+############################################################################
+#
+# Replace @SHELL@ with /bin/sh in the Makefile.in files!
+#
+echo "Replace @SHELL@ with /bin/sh in the Makefile.in files"
+temp=/tmp/curl$$
+for file in Makefile.in lib/Makefile.in src/Makefile.in; do
+ in="$n/$file"
+ sed "s:@SHELL@:/bin/sh:g" $in >$temp
+ cp $temp $in
+done
+rm -rf $temp
+
+# Tell the world what we're doing
+echo "creates $n.tar.gz";
+
+# Make a tar archive of it all
+tar -cvf $n.tar $n
+
+# gzip the archive
+gzip $n.tar
+
+# Make it world readable
+chmod a+r $n.tar.gz ;
+
+# Delete the temp dir
+rm -rf $n
diff --git a/missing b/missing
new file mode 100755
index 000000000..cbe2b0ef0
--- /dev/null
+++ b/missing
@@ -0,0 +1,188 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program 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, or (at your option)
+# any later version.
+
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
+ if test -z "$files"; then
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
+ test -z "$files" || files="$files.in"
+ else
+ files=`echo "$files" | sed -e 's/:/ /g'`
+ fi
+ test -z "$files" && files="config.h.in"
+ touch $files
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print \
+ | sed 's/^\(.*\).am$/touch \1.in/' \
+ | sh
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755
index 000000000..d0fd194fd
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id$
+
+errstatus=0
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/perl/README b/perl/README
new file mode 100644
index 000000000..bb8757aea
--- /dev/null
+++ b/perl/README
@@ -0,0 +1,33 @@
+This is just a small collection of perl scripts that use curl to do
+their jobs.
+
+If you need a proxy configuration in order to get HTTP or FTP
+documents, do edit your .curlrc file in your HOME dir to contain:
+-x <proxy host>:<proxy port>
+
+These scripts are all written by Daniel Stenberg.
+
+checklinks.pl
+=============
+ This script fetches an HTML page, extracts all links and references to
+ other documents and then goes through them to check that they work.
+ Reports progress in a format intended for machine-parsing.
+
+getlinks.pl
+===========
+ You ever wanted to download a bunch of programs a certain HTML page has
+ links to? This program extracts all links and references from a web page
+ and then compares them to the regex you supply. All matches will be
+ downloaded in the target directory of your choice.
+
+recursiveftpget.pl
+==================
+ This script recursively downloads all files from a directory on an ftp site
+ and all subdirectories it has. Optional depth-level.
+
+formfind.pl
+===========
+ Downloads an HTML page (or reads stdin) and reports a human readable report
+ about the FORM(s) present. What method, what URL, which input or select
+ field, what default values they have and what submit buttons there are. It
+ is useful if you intend to use curl to properly fake a form submission.
diff --git a/perl/checklinks.pl b/perl/checklinks.pl
new file mode 100644
index 000000000..347416ac9
--- /dev/null
+++ b/perl/checklinks.pl
@@ -0,0 +1,336 @@
+#!/usr/local/bin/perl
+#
+# checklinks.pl
+#
+# This script extracts all links from a HTML page and checks their validity.
+# Written to use 'curl' for URL checking.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.7 Sept 30, 1998
+#
+# HISTORY
+#
+# 0.5 - Cuts off the #-part from links before checking.
+#
+# 0.6 - Now deals with error codes 3XX better and follows the Location:
+# properly.
+# - Added the -x flag that only checks http:// -links
+#
+# 0.7 - Ok, http://www.viunga.se/main.html didn't realize this had no path
+# but a document. Now it does.
+#
+#
+
+$in="";
+
+ argv:
+if($ARGV[0] eq "-v" ) {
+ $verbose = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-i" ) {
+ $usestdin = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-l" ) {
+ $linenumber = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-h" ) {
+ $help = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-x" ) {
+ $external = 1;
+ shift @ARGV;
+ goto argv;
+}
+
+$geturl = $ARGV[0];
+
+if(($geturl eq "") || $help) {
+ print "Usage: $0 [-hilvx] <full URL>\n",
+ " Use a traling slash for directory URLs!\n",
+ " -h This help text\n",
+ " -i Read the initial page from stdin\n",
+ " -l Line number report for BAD links\n",
+ " -v Verbose mode\n",
+ " -x Check non-local (external?) links only\n";
+ exit;
+}
+
+if($ARGV[1] eq "-") {
+ print "We use stdin!\n";
+ $usestdin = 1;
+}
+
+# This is necessary from where I tried this:
+#$proxy =" -x 194.237.142.41:80";
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I$proxy";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i$proxy";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s$proxy";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+&SplitURL($geturl);
+
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+if(!$usestdin) {
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+#print length($in)."\n";
+
+sub LinkWorks {
+ my $check = $_[0];
+
+# URL encode:
+# $check =~s/([^a-zA-Z0-9_:\/.-])/uc sprintf("%%%02x",ord($1))/eg;
+
+ @doc = `$linkcheck \"$check\"`;
+
+ $head = 1;
+
+# print "COMMAND: $linkcheck \"$check\"\n";
+# print $doc[0]."\n";
+
+ boo:
+ if( $doc[0] =~ /^HTTP[^ ]+ (\d+)/ ) {
+ $error = $1;
+
+ if($error < 400 ) {
+ return "GOOD";
+ }
+ else {
+
+ if($head && ($error >= 500)) {
+ # This server doesn't like HEAD!
+ @doc = `$linkcheckfull \"$check\"`;
+ $head = 0;
+ goto boo;
+ }
+ return "BAD";
+ }
+ }
+ return "BAD";
+}
+
+
+sub GetLinks {
+ my $in = $_[0];
+ my @result;
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if($tag =~ /(src|href|background|archive) *= *(\"[^\"]\"|[^ )>]*)/i) {
+ $url=$2;
+ if($url =~ /^\"(.*)\"$/) {
+ # this was a "string" now $1 has removed the quotes:
+ $url=$1;
+ }
+
+
+ $url =~ s/([^\#]*)\#.*/$1/g;
+
+ if($url eq "") {
+ # if the link was nothing than a #-link it may now have
+ # been emptied completely so then we skip the rest
+ next getlinkloop;
+ }
+
+ if($done{$url}) {
+ # if this url already is done, do next
+ $done{$url}++;
+ next getlinkloop;
+ }
+
+ $done{$url} = 1; # this is "done"
+
+ push @result, $url;
+ if($tag =~ /< *([^ ]+)/) {
+# print "TAG: $1\n";
+ $tagtype{$url}=$1;
+ }
+ }
+ }
+ }
+ return @result;
+}
+
+@links = &GetLinks($in);
+
+ linkloop:
+for(@links) {
+ $url = $_;
+
+ if($url =~ /^([^:]+):/) {
+ $prot = $1;
+# if($prot !~ /(http|ftp|gopher)/i) {
+ if($prot !~ /http/i) {
+ # this is an unsupported protocol, we ignore this
+ next linkloop;
+ }
+ $link = $url;
+ }
+ else {
+ if($external) {
+ next linkloop;
+ }
+
+ # this is a link on the save server:
+ if($url =~ /^\//) {
+ # from root
+ $link = "$getprotocol://$getserver$url";
+ }
+ else {
+ # from the scanned page's dir
+ $nyurl=$url;
+
+ if(length($getpath) &&
+ ($getpath !~ /\/$/) &&
+ ($nyurl !~ /^\//)) {
+ # lacks ending slash, add one to the document part:
+ $nyurl = "/".$nyurl;
+ }
+ $link = "$getprotocol://$getserver/$getpath$nyurl";
+ }
+ }
+
+#print "test $link\n";
+#$success = "GOOD";
+
+ $success = &LinkWorks($link);
+
+ $count = $done{$url};
+
+ $allcount += $count;
+
+ print "$success $count <".$tagtype{$url}."> $link $url\n";
+
+# If bad and -l, present the line numbers of the usage
+ if("BAD" eq $success) {
+ $badlinks++;
+ if($linenumber) {
+ $line =1;
+ for(@indoc) {
+ if($_ =~ /$url/) {
+ print " line $line\n";
+ }
+ $line++;
+ }
+ }
+ }
+
+}
+
+if($verbose) {
+ print "$allcount links were checked";
+ if($badlinks > 0) {
+ print ", $badlinks were found bad";
+ }
+ print "\n";
+}
diff --git a/perl/checklinks.pl.in b/perl/checklinks.pl.in
new file mode 100755
index 000000000..17032b36a
--- /dev/null
+++ b/perl/checklinks.pl.in
@@ -0,0 +1,336 @@
+#!@PERL@
+#
+# checklinks.pl
+#
+# This script extracts all links from a HTML page and checks their validity.
+# Written to use 'curl' for URL checking.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.7 Sept 30, 1998
+#
+# HISTORY
+#
+# 0.5 - Cuts off the #-part from links before checking.
+#
+# 0.6 - Now deals with error codes 3XX better and follows the Location:
+# properly.
+# - Added the -x flag that only checks http:// -links
+#
+# 0.7 - Ok, http://www.viunga.se/main.html didn't realize this had no path
+# but a document. Now it does.
+#
+#
+
+$in="";
+
+ argv:
+if($ARGV[0] eq "-v" ) {
+ $verbose = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-i" ) {
+ $usestdin = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-l" ) {
+ $linenumber = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-h" ) {
+ $help = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-x" ) {
+ $external = 1;
+ shift @ARGV;
+ goto argv;
+}
+
+$geturl = $ARGV[0];
+
+if(($geturl eq "") || $help) {
+ print "Usage: $0 [-hilvx] <full URL>\n",
+ " Use a traling slash for directory URLs!\n",
+ " -h This help text\n",
+ " -i Read the initial page from stdin\n",
+ " -l Line number report for BAD links\n",
+ " -v Verbose mode\n",
+ " -x Check non-local (external?) links only\n";
+ exit;
+}
+
+if($ARGV[1] eq "-") {
+ print "We use stdin!\n";
+ $usestdin = 1;
+}
+
+# This is necessary from where I tried this:
+#$proxy =" -x 194.237.142.41:80";
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I$proxy";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i$proxy";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s$proxy";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+&SplitURL($geturl);
+
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+if(!$usestdin) {
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+#print length($in)."\n";
+
+sub LinkWorks {
+ my $check = $_[0];
+
+# URL encode:
+# $check =~s/([^a-zA-Z0-9_:\/.-])/uc sprintf("%%%02x",ord($1))/eg;
+
+ @doc = `$linkcheck \"$check\"`;
+
+ $head = 1;
+
+# print "COMMAND: $linkcheck \"$check\"\n";
+# print $doc[0]."\n";
+
+ boo:
+ if( $doc[0] =~ /^HTTP[^ ]+ (\d+)/ ) {
+ $error = $1;
+
+ if($error < 400 ) {
+ return "GOOD";
+ }
+ else {
+
+ if($head && ($error >= 500)) {
+ # This server doesn't like HEAD!
+ @doc = `$linkcheckfull \"$check\"`;
+ $head = 0;
+ goto boo;
+ }
+ return "BAD";
+ }
+ }
+ return "BAD";
+}
+
+
+sub GetLinks {
+ my $in = $_[0];
+ my @result;
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if($tag =~ /(src|href|background|archive) *= *(\"[^\"]\"|[^ )>]*)/i) {
+ $url=$2;
+ if($url =~ /^\"(.*)\"$/) {
+ # this was a "string" now $1 has removed the quotes:
+ $url=$1;
+ }
+
+
+ $url =~ s/([^\#]*)\#.*/$1/g;
+
+ if($url eq "") {
+ # if the link was nothing than a #-link it may now have
+ # been emptied completely so then we skip the rest
+ next getlinkloop;
+ }
+
+ if($done{$url}) {
+ # if this url already is done, do next
+ $done{$url}++;
+ next getlinkloop;
+ }
+
+ $done{$url} = 1; # this is "done"
+
+ push @result, $url;
+ if($tag =~ /< *([^ ]+)/) {
+# print "TAG: $1\n";
+ $tagtype{$url}=$1;
+ }
+ }
+ }
+ }
+ return @result;
+}
+
+@links = &GetLinks($in);
+
+ linkloop:
+for(@links) {
+ $url = $_;
+
+ if($url =~ /^([^:]+):/) {
+ $prot = $1;
+# if($prot !~ /(http|ftp|gopher)/i) {
+ if($prot !~ /http/i) {
+ # this is an unsupported protocol, we ignore this
+ next linkloop;
+ }
+ $link = $url;
+ }
+ else {
+ if($external) {
+ next linkloop;
+ }
+
+ # this is a link on the save server:
+ if($url =~ /^\//) {
+ # from root
+ $link = "$getprotocol://$getserver$url";
+ }
+ else {
+ # from the scanned page's dir
+ $nyurl=$url;
+
+ if(length($getpath) &&
+ ($getpath !~ /\/$/) &&
+ ($nyurl !~ /^\//)) {
+ # lacks ending slash, add one to the document part:
+ $nyurl = "/".$nyurl;
+ }
+ $link = "$getprotocol://$getserver/$getpath$nyurl";
+ }
+ }
+
+#print "test $link\n";
+#$success = "GOOD";
+
+ $success = &LinkWorks($link);
+
+ $count = $done{$url};
+
+ $allcount += $count;
+
+ print "$success $count <".$tagtype{$url}."> $link $url\n";
+
+# If bad and -l, present the line numbers of the usage
+ if("BAD" eq $success) {
+ $badlinks++;
+ if($linenumber) {
+ $line =1;
+ for(@indoc) {
+ if($_ =~ /$url/) {
+ print " line $line\n";
+ }
+ $line++;
+ }
+ }
+ }
+
+}
+
+if($verbose) {
+ print "$allcount links were checked";
+ if($badlinks > 0) {
+ print ", $badlinks were found bad";
+ }
+ print "\n";
+}
diff --git a/perl/formfind.pl b/perl/formfind.pl
new file mode 100644
index 000000000..cd1997642
--- /dev/null
+++ b/perl/formfind.pl
@@ -0,0 +1,273 @@
+#!/usr/local/bin/perl
+#
+# formfind.pl
+#
+# This script gets a HTML page from the specified URL and presents form
+# information you may need in order to machine-make a respond to the form.
+#
+# Written to use 'curl' for URL fetching.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.1 Nov 12, 1998
+#
+# HISTORY
+#
+# 0.1 - Created now!
+#
+# TODO
+# respect file:// URLs for local file fetches!
+
+$in="";
+
+$usestdin = 0;
+if($ARGV[0] eq "" ) {
+ $usestdin = 1;
+}
+else {
+ $geturl = $ARGV[0];
+}
+
+if(($geturl eq "") && !$usestdin) {
+ print "Usage: $0 <full source URL>\n",
+ " Use a traling slash for directory URLs!\n";
+ exit;
+}
+# If you need a proxy for web access, edit your .curlrc file to feature
+# -x <proxy:port>
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s";
+
+# urlget, URL will be appended to the right of this command line
+# this stores the file with the remote file name in the current dir
+$urlget = "curl -O -s";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+
+if(!$usestdin) {
+
+ &SplitURL($geturl);
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if(!$form &&
+ ($tag =~ /^< *form/i )) {
+ $method= $tag;
+ if($method =~ /method *=/i) {
+ $method=~ s/.*method *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $method="get"; # default method
+ }
+ $action= $tag;
+ $action=~ s/.*action *= *(\"|)([^ \">]*).*/$2/gi;
+
+ $method=uc($method);
+
+ $enctype=$tag;
+ if ($enctype =~ /enctype *=/) {
+ $enctype=~ s/.*enctype *= *(\'|\"|)([^ \"\'>]*).*/$2/gi;
+
+ if($enctype eq "multipart/form-data") {
+ $enctype="multipart form upload [use -F]"
+ }
+ $enctype = "\n--- type: $enctype";
+ }
+ else {
+ $enctype="";
+ }
+
+ print "--- FORM report. Uses $method to URL \"$action\"$enctype\n";
+# print "TAG: $tag\n";
+# print "METHOD: $method\n";
+# print "ACTION: $action\n";
+ $form=1;
+ }
+ elsif($form &&
+ ($tag =~ /< *\/form/i )) {
+# print "TAG: $tag\n";
+ print "--- end of FORM\n";
+ $form=0;
+ if( 0 ) {
+ print "*** Fill in all or any of these: (default assigns may be shown)\n";
+ for(@vars) {
+ $var = $_;
+ $def = $value{$var};
+ print "$var=$def\n";
+ }
+ print "*** Pick one of these:\n";
+ for(@alts) {
+ print "$_\n";
+ }
+ }
+ undef @vars;
+ undef @alts;
+ }
+ elsif($form &&
+ ($tag =~ /^< *(input|select)/i)) {
+ $mtag = $1;
+# print "TAG: $tag\n";
+
+ $name=$tag;
+ if($name =~ /name *=/i) {
+ $name=~ s/.*name *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ # no name given
+ $name="";
+ }
+ # get value tag
+ $value= $tag;
+ if($value =~ /value *=/i) {
+ $value=~ s/.*value *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $value="";
+ }
+
+ if($mtag =~ /select/i) {
+ print "Select: $name\n";
+ push @vars, "$name";
+ $select = 1;
+ }
+ else {
+ $type=$tag;
+ if($type =~ /type *=/i) {
+ $type =~ s/.*type *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $type="text"; # default type
+ }
+ $type=uc($type);
+ if(lc($type) eq "reset") {
+ # reset types are for UI only, ignore.
+ }
+ elsif($name eq "") {
+ # let's read the value parameter
+
+ print "Button: \"$value\" ($type)\n";
+ push @alts, "$value";
+ }
+ else {
+ $info="";
+ if($value ne "") {
+ $info="=$value";
+ }
+ print "Input: $name$info ($type)\n";
+ push @vars, "$name";
+ # store default value:
+ $value{$name}=$value;
+ }
+ }
+ }
+ elsif($select &&
+ ($tag =~ /^< *\/ *select/i)) {
+ $select = 0;
+ }
+ }
+ }
+
diff --git a/perl/formfind.pl.in b/perl/formfind.pl.in
new file mode 100755
index 000000000..6428e991e
--- /dev/null
+++ b/perl/formfind.pl.in
@@ -0,0 +1,273 @@
+#!@PERL@
+#
+# formfind.pl
+#
+# This script gets a HTML page from the specified URL and presents form
+# information you may need in order to machine-make a respond to the form.
+#
+# Written to use 'curl' for URL fetching.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.1 Nov 12, 1998
+#
+# HISTORY
+#
+# 0.1 - Created now!
+#
+# TODO
+# respect file:// URLs for local file fetches!
+
+$in="";
+
+$usestdin = 0;
+if($ARGV[0] eq "" ) {
+ $usestdin = 1;
+}
+else {
+ $geturl = $ARGV[0];
+}
+
+if(($geturl eq "") && !$usestdin) {
+ print "Usage: $0 <full source URL>\n",
+ " Use a traling slash for directory URLs!\n";
+ exit;
+}
+# If you need a proxy for web access, edit your .curlrc file to feature
+# -x <proxy:port>
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s";
+
+# urlget, URL will be appended to the right of this command line
+# this stores the file with the remote file name in the current dir
+$urlget = "curl -O -s";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+
+if(!$usestdin) {
+
+ &SplitURL($geturl);
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if(!$form &&
+ ($tag =~ /^< *form/i )) {
+ $method= $tag;
+ if($method =~ /method *=/i) {
+ $method=~ s/.*method *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $method="get"; # default method
+ }
+ $action= $tag;
+ $action=~ s/.*action *= *(\"|)([^ \">]*).*/$2/gi;
+
+ $method=uc($method);
+
+ $enctype=$tag;
+ if ($enctype =~ /enctype *=/) {
+ $enctype=~ s/.*enctype *= *(\'|\"|)([^ \"\'>]*).*/$2/gi;
+
+ if($enctype eq "multipart/form-data") {
+ $enctype="multipart form upload [use -F]"
+ }
+ $enctype = "\n--- type: $enctype";
+ }
+ else {
+ $enctype="";
+ }
+
+ print "--- FORM report. Uses $method to URL \"$action\"$enctype\n";
+# print "TAG: $tag\n";
+# print "METHOD: $method\n";
+# print "ACTION: $action\n";
+ $form=1;
+ }
+ elsif($form &&
+ ($tag =~ /< *\/form/i )) {
+# print "TAG: $tag\n";
+ print "--- end of FORM\n";
+ $form=0;
+ if( 0 ) {
+ print "*** Fill in all or any of these: (default assigns may be shown)\n";
+ for(@vars) {
+ $var = $_;
+ $def = $value{$var};
+ print "$var=$def\n";
+ }
+ print "*** Pick one of these:\n";
+ for(@alts) {
+ print "$_\n";
+ }
+ }
+ undef @vars;
+ undef @alts;
+ }
+ elsif($form &&
+ ($tag =~ /^< *(input|select)/i)) {
+ $mtag = $1;
+# print "TAG: $tag\n";
+
+ $name=$tag;
+ if($name =~ /name *=/i) {
+ $name=~ s/.*name *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ # no name given
+ $name="";
+ }
+ # get value tag
+ $value= $tag;
+ if($value =~ /value *=/i) {
+ $value=~ s/.*value *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $value="";
+ }
+
+ if($mtag =~ /select/i) {
+ print "Select: $name\n";
+ push @vars, "$name";
+ $select = 1;
+ }
+ else {
+ $type=$tag;
+ if($type =~ /type *=/i) {
+ $type =~ s/.*type *= *(\"|)([^ \">]*).*/$2/gi;
+ }
+ else {
+ $type="text"; # default type
+ }
+ $type=uc($type);
+ if(lc($type) eq "reset") {
+ # reset types are for UI only, ignore.
+ }
+ elsif($name eq "") {
+ # let's read the value parameter
+
+ print "Button: \"$value\" ($type)\n";
+ push @alts, "$value";
+ }
+ else {
+ $info="";
+ if($value ne "") {
+ $info="=$value";
+ }
+ print "Input: $name$info ($type)\n";
+ push @vars, "$name";
+ # store default value:
+ $value{$name}=$value;
+ }
+ }
+ }
+ elsif($select &&
+ ($tag =~ /^< *\/ *select/i)) {
+ $select = 0;
+ }
+ }
+ }
+
diff --git a/perl/getlinks.pl b/perl/getlinks.pl
new file mode 100644
index 000000000..06da56e30
--- /dev/null
+++ b/perl/getlinks.pl
@@ -0,0 +1,261 @@
+#!/usr/local/bin/perl
+#
+# getlinks.pl
+#
+# This script extracts all links from a HTML page, compares them to a pattern
+# entered on the command line and then downloads matching links into the
+# target dir (also specified on the command line).
+#
+# Written to use 'curl' for URL fetching, uses the source file names in the
+# target directory.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.1 Oct 7, 1998
+#
+# HISTORY
+#
+# 0.1 - Created now!
+#
+
+$in="";
+
+ argv:
+if($ARGV[0] eq "-v" ) {
+ $verbose = 1;
+ shift @ARGV;
+ goto argv;
+}
+if($ARGV[0] eq "-d" ) {
+ $display = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-h" ) {
+ $help = 1;
+ shift @ARGV;
+ goto argv;
+}
+
+$geturl = $ARGV[0];
+$getdir = $ARGV[1];
+$getregex = $ARGV[2];
+
+if(($geturl eq "") ||
+ (($getdir eq "") && !$display) ||
+ $help) {
+ print "Usage: $0 [-hv] <full source URL> <target dir> [regex]\n",
+ " Use a traling slash for directory URLs!\n",
+ " Use \"quotes\" around the regex!\n",
+ " -h This help text\n",
+ " -d Display matches only instead of downloading\n",
+ " -v Verbose mode\n";
+ exit;
+}
+
+# change to target directory:
+chdir $getdir ||
+ die "couldn't cd into $getdir";
+
+# This is necessary from where I tried this:
+#$proxy =" -x 194.237.142.41:80";
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I$proxy";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i$proxy";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s$proxy";
+
+# urlget, URL will be appended to the right of this command line
+# this stores the file with the remote file name in the current dir
+$urlget = "curl -O -s$proxy";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+&SplitURL($geturl);
+
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+if(!$usestdin) {
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+sub GetLinks {
+ my $in = $_[0];
+ my @result;
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if($tag =~ /(src|href|background|archive) *= *(\"[^\"]\"|[^ )>]*)/i) {
+ $url=$2;
+ if($url =~ /^\"(.*)\"$/) {
+ # this was a "string" now $1 has removed the quotes:
+ $url=$1;
+ }
+
+
+ $url =~ s/([^\#]*)\#.*/$1/g;
+
+ if($url eq "") {
+ # if the link was nothing than a #-link it may now have
+ # been emptied completely so then we skip the rest
+ next getlinkloop;
+ }
+
+ if($done{$url}) {
+ # if this url already is done, do next
+ $done{$url}++;
+ next getlinkloop;
+ }
+
+ $done{$url} = 1; # this is "done"
+
+ push @result, $url;
+ if($tag =~ /< *([^ ]+)/) {
+# print "TAG: $1\n";
+ $tagtype{$url}=$1;
+ }
+ }
+ }
+ }
+ return @result;
+}
+
+@links = &GetLinks($in);
+
+ linkloop:
+for(@links) {
+ $url = $_;
+
+ if($url =~ /^([^:]+):/) {
+ $link = $url;
+ }
+ else {
+ # this is an absolute link on the same server:
+ if($url =~ /^\//) {
+ # from root
+ $link = "$getprotocol://$getserver$url";
+ }
+ else {
+ # from the scanned page's dir
+ $nyurl=$url;
+
+ if(length($getpath) &&
+ ($getpath !~ /\/$/) &&
+ ($nyurl !~ /^\//)) {
+ # lacks ending slash, add one to the document part:
+ $nyurl = "/".$nyurl;
+ }
+ $link = "$getprotocol://$getserver/$getpath$nyurl";
+ }
+ }
+
+ if($link =~ /$getregex/) {
+ if($display) {
+ print "$link\n";
+ }
+ else {
+ if($verbose) {
+ print "Gets $link\n";
+ }
+ print `$urlget $link`;
+ }
+ }
+
+
+}
diff --git a/perl/getlinks.pl.in b/perl/getlinks.pl.in
new file mode 100755
index 000000000..1ef0d3e27
--- /dev/null
+++ b/perl/getlinks.pl.in
@@ -0,0 +1,261 @@
+#!@PERL@
+#
+# getlinks.pl
+#
+# This script extracts all links from a HTML page, compares them to a pattern
+# entered on the command line and then downloads matching links into the
+# target dir (also specified on the command line).
+#
+# Written to use 'curl' for URL fetching, uses the source file names in the
+# target directory.
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Version: 0.1 Oct 7, 1998
+#
+# HISTORY
+#
+# 0.1 - Created now!
+#
+
+$in="";
+
+ argv:
+if($ARGV[0] eq "-v" ) {
+ $verbose = 1;
+ shift @ARGV;
+ goto argv;
+}
+if($ARGV[0] eq "-d" ) {
+ $display = 1;
+ shift @ARGV;
+ goto argv;
+}
+elsif($ARGV[0] eq "-h" ) {
+ $help = 1;
+ shift @ARGV;
+ goto argv;
+}
+
+$geturl = $ARGV[0];
+$getdir = $ARGV[1];
+$getregex = $ARGV[2];
+
+if(($geturl eq "") ||
+ (($getdir eq "") && !$display) ||
+ $help) {
+ print "Usage: $0 [-hv] <full source URL> <target dir> [regex]\n",
+ " Use a traling slash for directory URLs!\n",
+ " Use \"quotes\" around the regex!\n",
+ " -h This help text\n",
+ " -d Display matches only instead of downloading\n",
+ " -v Verbose mode\n";
+ exit;
+}
+
+# change to target directory:
+chdir $getdir ||
+ die "couldn't cd into $getdir";
+
+# This is necessary from where I tried this:
+#$proxy =" -x 194.237.142.41:80";
+
+# linkchecker, URL will be appended to the right of this command line
+# this is the one using HEAD:
+$linkcheck = "curl -s -m 20 -I$proxy";
+
+# as a second attempt, this will be used. This is not using HEAD but will
+# get the whole frigging document!
+$linkcheckfull = "curl -s -m 20 -i$proxy";
+
+# htmlget, URL will be appended to the right of this command line
+$htmlget = "curl -s$proxy";
+
+# urlget, URL will be appended to the right of this command line
+# this stores the file with the remote file name in the current dir
+$urlget = "curl -O -s$proxy";
+
+# Parse the input URL and split it into the relevant parts:
+
+sub SplitURL {
+ my $inurl = $_[0];
+
+ if($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = $4;
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/([^\/]*)\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = $3;
+ $getdocument = "";
+
+ if($getpath !~ /\//) {
+ $getpath ="";
+ $getdocument = $3;
+ }
+
+ }
+ elsif ($inurl=~ /^([^:]+):\/\/(.*)/ ) {
+ $getprotocol = $1;
+ $getserver = $2;
+ $getpath = "";
+ $getdocument = "";
+ }
+ else {
+ print "Couldn't parse the specified URL, retry please!\n";
+ exit;
+ }
+}
+
+&SplitURL($geturl);
+
+#print "protocol = $getprotocol\n";
+#print "server = $getserver\n";
+#print "path = $getpath\n";
+#print "document = $getdocument\n";
+#exit;
+
+if(!$usestdin) {
+ open(HEADGET, "$linkcheck $geturl|") ||
+ die "Couldn't get web page for some reason";
+ headget:
+ while(<HEADGET>) {
+# print $_;
+ if($_ =~ /HTTP\/.*3\d\d /) {
+ $pagemoved=1;
+ }
+ elsif($pagemoved &&
+ ($_ =~ /^Location: (.*)/)) {
+ $geturl = $1;
+
+ &SplitURL($geturl);
+
+ $pagemoved++;
+ last headget;
+ }
+ }
+ close(HEADGET);
+
+ if($pagemoved == 1) {
+ print "Page is moved but we don't know where. Did you forget the ",
+ "traling slash?\n";
+ exit;
+ }
+
+ open(WEBGET, "$htmlget $geturl|") ||
+ die "Couldn't get web page for some reason";
+
+ while(<WEBGET>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+# print $line."\n";
+ $in=$in.$line;
+ }
+
+ close(WEBGET);
+}
+else {
+ while(<STDIN>) {
+ $line = $_;
+ push @indoc, $line;
+ $line=~ s/\n//g;
+ $line=~ s/\r//g;
+ $in=$in.$line;
+ }
+}
+
+sub GetLinks {
+ my $in = $_[0];
+ my @result;
+
+ getlinkloop:
+ while($in =~ /[^<]*(<[^>]+>)/g ) {
+ # we have a tag in $1
+ $tag = $1;
+
+ if($tag =~ /^<!--/) {
+ # this is a comment tag, ignore it
+ }
+ else {
+ if($tag =~ /(src|href|background|archive) *= *(\"[^\"]\"|[^ )>]*)/i) {
+ $url=$2;
+ if($url =~ /^\"(.*)\"$/) {
+ # this was a "string" now $1 has removed the quotes:
+ $url=$1;
+ }
+
+
+ $url =~ s/([^\#]*)\#.*/$1/g;
+
+ if($url eq "") {
+ # if the link was nothing than a #-link it may now have
+ # been emptied completely so then we skip the rest
+ next getlinkloop;
+ }
+
+ if($done{$url}) {
+ # if this url already is done, do next
+ $done{$url}++;
+ next getlinkloop;
+ }
+
+ $done{$url} = 1; # this is "done"
+
+ push @result, $url;
+ if($tag =~ /< *([^ ]+)/) {
+# print "TAG: $1\n";
+ $tagtype{$url}=$1;
+ }
+ }
+ }
+ }
+ return @result;
+}
+
+@links = &GetLinks($in);
+
+ linkloop:
+for(@links) {
+ $url = $_;
+
+ if($url =~ /^([^:]+):/) {
+ $link = $url;
+ }
+ else {
+ # this is an absolute link on the same server:
+ if($url =~ /^\//) {
+ # from root
+ $link = "$getprotocol://$getserver$url";
+ }
+ else {
+ # from the scanned page's dir
+ $nyurl=$url;
+
+ if(length($getpath) &&
+ ($getpath !~ /\/$/) &&
+ ($nyurl !~ /^\//)) {
+ # lacks ending slash, add one to the document part:
+ $nyurl = "/".$nyurl;
+ }
+ $link = "$getprotocol://$getserver/$getpath$nyurl";
+ }
+ }
+
+ if($link =~ /$getregex/) {
+ if($display) {
+ print "$link\n";
+ }
+ else {
+ if($verbose) {
+ print "Gets $link\n";
+ }
+ print `$urlget $link`;
+ }
+ }
+
+
+}
diff --git a/perl/recursiveftpget.pl b/perl/recursiveftpget.pl
new file mode 100644
index 000000000..02299b00d
--- /dev/null
+++ b/perl/recursiveftpget.pl
@@ -0,0 +1,67 @@
+#!/usr/local/bin/perl
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Date: August 25 1998
+# Version: 0.1
+#
+# This is just meant as an example of why we wrote curl in the first place.
+# Quick n' easy scripting use.
+#
+
+$dir = $ARGV[0];
+
+$target = $ARGV[1];
+
+$maxdepth = $ARGV[2];
+
+if($dir eq "" || $target eq "") {
+ print "Usage: <URL> <dir> [max depth level] \n";
+ print " End the URL with a slash if a directory is specified, please\n";
+ exit;
+}
+
+if(($maxdepth ne "") && ($maxdepth == 0)) {
+ # reached maximum depth, die
+ print "Reached maximum recursive depth level ($maxdepth), exiting...\n";
+ exit;
+}
+
+# get dir
+@all = `curl -s $dir`;
+
+if($all[0] ne "") {
+ print "Got the main $dir dir\n";
+}
+
+line:
+for(@all) {
+ chop; # cut off newline
+ @linep= split(" ", $_);
+
+ $name = $linep[$#linep];
+
+ $firstletter=substr($linep[0], 0, 1);
+
+ if($firstletter eq "d") {
+ # this is a subdir, recurse
+ # if not . or .. of course
+
+ if(($name eq ".") || ($name eq "..")) {
+ next line;
+ }
+ print "Recursing for dir $dir$name in target $target/$name\n";
+
+ $nextdepth=$maxdepth-1;
+ print `$0 $dir$name/ $target/$name $nextdepth`;
+ }
+ elsif($firstletter eq "-") {
+ # this is a file, get it
+ # oh, make sure the target dir exists first
+
+ if(! -r $target ) {
+ mkdir($target,0777);
+ }
+ print "Getting file $dir$name in target $target/$name\n";
+ print `curl -s $dir$name >$target/$name`;
+ }
+}
diff --git a/perl/recursiveftpget.pl.in b/perl/recursiveftpget.pl.in
new file mode 100755
index 000000000..7d9cf8eb8
--- /dev/null
+++ b/perl/recursiveftpget.pl.in
@@ -0,0 +1,67 @@
+#!@PERL@
+#
+# Author: Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
+# Date: August 25 1998
+# Version: 0.1
+#
+# This is just meant as an example of why we wrote curl in the first place.
+# Quick n' easy scripting use.
+#
+
+$dir = $ARGV[0];
+
+$target = $ARGV[1];
+
+$maxdepth = $ARGV[2];
+
+if($dir eq "" || $target eq "") {
+ print "Usage: <URL> <dir> [max depth level] \n";
+ print " End the URL with a slash if a directory is specified, please\n";
+ exit;
+}
+
+if(($maxdepth ne "") && ($maxdepth == 0)) {
+ # reached maximum depth, die
+ print "Reached maximum recursive depth level ($maxdepth), exiting...\n";
+ exit;
+}
+
+# get dir
+@all = `curl -s $dir`;
+
+if($all[0] ne "") {
+ print "Got the main $dir dir\n";
+}
+
+line:
+for(@all) {
+ chop; # cut off newline
+ @linep= split(" ", $_);
+
+ $name = $linep[$#linep];
+
+ $firstletter=substr($linep[0], 0, 1);
+
+ if($firstletter eq "d") {
+ # this is a subdir, recurse
+ # if not . or .. of course
+
+ if(($name eq ".") || ($name eq "..")) {
+ next line;
+ }
+ print "Recursing for dir $dir$name in target $target/$name\n";
+
+ $nextdepth=$maxdepth-1;
+ print `$0 $dir$name/ $target/$name $nextdepth`;
+ }
+ elsif($firstletter eq "-") {
+ # this is a file, get it
+ # oh, make sure the target dir exists first
+
+ if(! -r $target ) {
+ mkdir($target,0777);
+ }
+ print "Getting file $dir$name in target $target/$name\n";
+ print `curl -s $dir$name >$target/$name`;
+ }
+}
diff --git a/reconf b/reconf
new file mode 100755
index 000000000..8d29a075b
--- /dev/null
+++ b/reconf
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# $Id$
+#
+# re autoconf/automake shell script
+#
+
+die(){
+ echo "$@" ; exit
+}
+
+aclocal || die "ahhhhh"
+autoheader || die "ahhhhh"
+automake || die "ahhhhh"
+autoconf || die "ahhhhh"
+
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 000000000..a4b373e22
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,334 @@
+# Generated automatically from Makefile.in by configure.
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+
+
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = ..
+prefix = /usr/local
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+mandir = ${prefix}/man
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/curl
+pkglibdir = $(libdir)/curl
+pkgincludedir = $(includedir)/curl
+
+top_builddir = ..
+
+ACLOCAL = aclocal
+AUTOCONF = autoconf
+AUTOMAKE = automake
+AUTOHEADER = autoheader
+
+INSTALL = .././install-sh -c
+INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL_PROGRAM}
+transform = s,x,x,
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = sparc-sun-solaris2.6
+host_triplet = sparc-sun-solaris2.6
+CC = gcc
+MAKEINFO = makeinfo
+PACKAGE = curl
+PERL = /usr/local/bin/perl
+RANLIB = ranlib
+VERSION = 6.3.1
+YACC = bison -y
+
+CPPFLAGS = -DGLOBURL -DCURL_SEPARATORS
+
+INCLUDES = -I$(top_srcdir)/include
+
+bin_PROGRAMS = curl
+
+curl_SOURCES = main.c hugehelp.c urlglob.c
+curl_LDADD = ../lib/libcurl.a
+curl_DEPENDENCIES = ../lib/libcurl.a
+BUILT_SOURCES = hugehelp.c
+CLEANFILES = hugehelp.c
+NROFF = /bin/nroff
+
+EXTRA_DIST = mkhelp.pl Makefile.vc6
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(bin_PROGRAMS)
+
+
+DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I.. -I.
+LDFLAGS =
+LIBS = -lssl -lcrypto -ldl -lsocket -lnsl -L/home/dast/lib
+curl_OBJECTS = main.o hugehelp.o urlglob.o
+curl_LDFLAGS =
+CFLAGS = -g -O2
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = ./stamp-h2.in Makefile.am Makefile.in config.h.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(curl_SOURCES)
+OBJECTS = $(curl_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps src/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+config.h: stamp-h2
+ @if test ! -f $@; then \
+ rm -f stamp-h2; \
+ $(MAKE) stamp-h2; \
+ else :; fi
+stamp-h2: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h2 2> /dev/null
+$(srcdir)/config.h.in: $(srcdir)/stamp-h2.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h2.in; \
+ $(MAKE) $(srcdir)/stamp-h2.in; \
+ else :; fi
+$(srcdir)/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h2.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+curl: $(curl_OBJECTS) $(curl_DEPENDENCIES)
+ @rm -f curl
+ $(LINK) $(curl_LDFLAGS) $(curl_OBJECTS) $(curl_LDADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-binPROGRAMS
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS) config.h
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
+ mostlyclean-compile mostlyclean-tags \
+ mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
+ clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
+ distclean-tags distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+check-am installcheck-am installcheck all-recursive-am install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# This generates the hugehelp.c file
+hugehelp.c: $(top_srcdir)/README.curl $(top_srcdir)/curl.1 mkhelp.pl
+ rm -f hugehelp.c
+ $(NROFF) -man $(top_srcdir)/curl.1 | $(PERL) $(top_srcdir)/src/mkhelp.pl $(top_srcdir)/README.curl > hugehelp.c
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 000000000..561142ed3
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,27 @@
+#
+# $Id$
+#
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+CPPFLAGS = -DGLOBURL -DCURL_SEPARATORS
+
+INCLUDES = -I$(top_srcdir)/include
+
+bin_PROGRAMS = curl
+
+curl_SOURCES = main.c hugehelp.c urlglob.c
+curl_LDADD = ../lib/libcurl.a
+curl_DEPENDENCIES = ../lib/libcurl.a
+BUILT_SOURCES = hugehelp.c
+CLEANFILES = hugehelp.c
+NROFF=@NROFF@
+
+EXTRA_DIST = mkhelp.pl Makefile.vc6
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+
+# This generates the hugehelp.c file
+hugehelp.c: $(top_srcdir)/README.curl $(top_srcdir)/curl.1 mkhelp.pl
+ rm -f hugehelp.c
+ $(NROFF) -man $(top_srcdir)/curl.1 | $(PERL) $(top_srcdir)/src/mkhelp.pl $(top_srcdir)/README.curl > hugehelp.c
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 000000000..f7afbd977
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,334 @@
+# Makefile.in generated automatically by automake 1.4 from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+#
+# $Id$
+#
+
+# Some flags needed when trying to cause warnings ;-)
+# CFLAGS = -Wall -pedantic
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PERL = @PERL@
+RANLIB = @RANLIB@
+VERSION = @VERSION@
+YACC = @YACC@
+
+CPPFLAGS = -DGLOBURL -DCURL_SEPARATORS
+
+INCLUDES = -I$(top_srcdir)/include
+
+bin_PROGRAMS = curl
+
+curl_SOURCES = main.c hugehelp.c urlglob.c
+curl_LDADD = ../lib/libcurl.a
+curl_DEPENDENCIES = ../lib/libcurl.a
+BUILT_SOURCES = hugehelp.c
+CLEANFILES = hugehelp.c
+NROFF = @NROFF@
+
+EXTRA_DIST = mkhelp.pl Makefile.vc6
+
+AUTOMAKE_OPTIONS = foreign no-dependencies
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(bin_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I.
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+curl_OBJECTS = main.o hugehelp.o urlglob.o
+curl_LDFLAGS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = ./stamp-h2.in Makefile.am Makefile.in config.h.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = tar
+GZIP_ENV = --best
+SOURCES = $(curl_SOURCES)
+OBJECTS = $(curl_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps src/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+config.h: stamp-h2
+ @if test ! -f $@; then \
+ rm -f stamp-h2; \
+ $(MAKE) stamp-h2; \
+ else :; fi
+stamp-h2: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=src/config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h2 2> /dev/null
+$(srcdir)/config.h.in: $(srcdir)/stamp-h2.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h2.in; \
+ $(MAKE) $(srcdir)/stamp-h2.in; \
+ else :; fi
+$(srcdir)/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h2.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+curl: $(curl_OBJECTS) $(curl_DEPENDENCIES)
+ @rm -f curl
+ $(LINK) $(curl_LDFLAGS) $(curl_OBJECTS) $(curl_LDADD) $(LIBS)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-binPROGRAMS
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS) config.h
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
+ mostlyclean-compile mostlyclean-tags \
+ mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
+ clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
+ distclean-tags distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
+check-am installcheck-am installcheck all-recursive-am install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# This generates the hugehelp.c file
+hugehelp.c: $(top_srcdir)/README.curl $(top_srcdir)/curl.1 mkhelp.pl
+ rm -f hugehelp.c
+ $(NROFF) -man $(top_srcdir)/curl.1 | $(PERL) $(top_srcdir)/src/mkhelp.pl $(top_srcdir)/README.curl > hugehelp.c
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/Makefile.m32 b/src/Makefile.m32
new file mode 100644
index 000000000..d398083fb
--- /dev/null
+++ b/src/Makefile.m32
@@ -0,0 +1,65 @@
+#############################################################
+## Makefile for building curl.exe with MingW32 (GCC-2.95) and
+## optionally OpenSSL (0.9.4)
+##
+## Use: make -f Makefile.m32 [SSL=1]
+##
+## Comments to: Troy Engel <tengel@sonic.net> or
+## Joern Hartroth <hartroth@acm.org>
+
+CC = gcc
+STRIP = strip -s
+OPENSSL_PATH = ../../openssl-0.9.4
+
+# We may need these someday
+# PERL = perl
+# NROFF = nroff
+
+########################################################
+## Nothing more to do below this line!
+
+INCLUDES = -I. -I.. -I../include
+CFLAGS = -g -O2 -DGLOBURL -DCURL_SEPARATORS
+LDFLAGS =
+COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
+LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+
+curl_PROGRAMS = curl.exe
+curl_OBJECTS = main.o hugehelp.o urlglob.o
+curl_SOURCES = main.c hugehelp.c urlglob.c
+curl_DEPENDENCIES = ../lib/libcurl.a
+curl_LDADD = -L../lib -lcurl -lwsock32
+ifdef SSL
+ curl_LDADD += -L$(OPENSSL_PATH)/out -leay32 -lssl32 -lRSAglue
+endif
+
+PROGRAMS = $(curl_PROGRAMS)
+SOURCES = $(curl_SOURCES)
+OBJECTS = $(curl_OBJECTS)
+
+all: curl
+
+curl: $(curl_OBJECTS) $(curl_DEPENDENCIES)
+ -@erase curl.exe
+ $(LINK) $(curl_OBJECTS) $(curl_LDADD)
+ $(STRIP) $(curl_PROGRAMS)
+
+# We don't have nroff normally under win32
+# hugehelp.c: ../README.curl ../curl.1 mkhelp.pl
+# -@erase hugehelp.c
+# $(NROFF) -man ../curl.1 | $(PERL) mkhelp.pl ../README.curl > hugehelp.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+clean:
+ -@erase $(curl_OBJECTS)
+
+distrib: clean
+ -@erase $(curl_PROGRAMS)
diff --git a/src/Makefile.vc6 b/src/Makefile.vc6
new file mode 100644
index 000000000..1502b0218
--- /dev/null
+++ b/src/Makefile.vc6
@@ -0,0 +1,68 @@
+########################################################
+## Makefile for building curl.exe with MSVC6
+## Use: nmake -f makefile.vc6 [release | debug]
+## (default is release)
+##
+## Comments to: Troy Engel <tengel@sonic.net>
+
+PROGRAM_NAME = curl.exe
+
+########################################################
+## Nothing more to do below this line!
+
+## Release
+CCR = cl.exe /ML /O2 /D "NDEBUG"
+LINKR = link.exe /incremental:no /libpath:"../lib"
+
+## Debug
+CCD = cl.exe /MLd /Gm /ZI /Od /D "_DEBUG" /GZ
+LINKD = link.exe /incremental:yes /debug
+
+CFLAGS = /nologo /W3 /GX /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:I386
+LINKLIBS = kernel32.lib wsock32.lib libcurl.lib
+
+RELEASE_OBJS= \
+ hugehelpr.obj \
+ mainr.obj
+
+DEBUG_OBJS= \
+ hugehelpd.obj \
+ maind.obj
+
+LINK_OBJS= \
+ hugehelp.obj \
+ main.obj
+
+all : release
+
+release: $(RELEASE_OBJS)
+ $(LINKR) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
+
+debug: $(DEBUG_OBJS)
+ $(LINKD) $(LFLAGS) $(LINKLIBS) $(LINK_OBJS)
+
+## Release
+hugehelpr.obj: hugehelp.c
+ $(CCR) $(CFLAGS) /Zm200 hugehelp.c
+mainr.obj: main.c
+ $(CCR) $(CFLAGS) main.c
+
+## Debug
+hugehelpd.obj: hugehelp.c
+ $(CCD) $(CFLAGS) /Zm200 hugehelp.c
+maind.obj: main.c
+ $(CCD) $(CFLAGS) main.c
+
+clean:
+ -@erase hugehelp.obj
+ -@erase main.obj
+ -@erase vc60.idb
+ -@erase vc60.pdb
+ -@erase vc60.pch
+ -@erase curl.ilk
+ -@erase curl.pdb
+
+distrib: clean
+ -@erase $(PROGRAM_NAME)
+
diff --git a/src/config-win32.h b/src/config-win32.h
new file mode 100644
index 000000000..42264ecff
--- /dev/null
+++ b/src/config-win32.h
@@ -0,0 +1,12 @@
+/* src/config.h. Generated automatically by configure. */
+/* Define if you have the strcasecmp function. */
+/*#define HAVE_STRCASECMP 1*/
+
+/* Define cpu-machine-OS */
+#define OS "win32"
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <io.h> header file. */
+#define HAVE_IO_H 1
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 000000000..e741a236c
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,13 @@
+/* src/config.h. Generated automatically by configure. */
+/* src/config.h. Generated automatically by configure. */
+/* Define if you have the strcasecmp function. */
+#define HAVE_STRCASECMP 1
+
+/* Define cpu-machine-OS */
+#define OS "sparc-sun-solaris2.6"
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644
index 000000000..2e210ede8
--- /dev/null
+++ b/src/config.h.in
@@ -0,0 +1,12 @@
+/* src/config.h. Generated automatically by configure. */
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define cpu-machine-OS */
+#undef OS
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <io.h> header file. */
+#undef HAVE_IO_H
diff --git a/src/curl b/src/curl
new file mode 100755
index 000000000..cba40a4c0
--- /dev/null
+++ b/src/curl
Binary files differ
diff --git a/src/hugehelp.c b/src/hugehelp.c
new file mode 100644
index 000000000..390221935
--- /dev/null
+++ b/src/hugehelp.c
@@ -0,0 +1,1049 @@
+/* NEVER EVER edit this manually, fix the mkhelp script instead! */
+#include <stdio.h>
+void hugehelp(void)
+{
+puts (
+" _ _ ____ _ \n"
+" Project ___| | | | _ \\| | \n"
+" / __| | | | |_) | | \n"
+" | (__| |_| | _ <| |___ \n"
+" \\___|\\___/|_| \\_\\_____|\n"
+"NAME\n"
+" curl - get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE,\n"
+" HTTP or HTTPS syntax.\n"
+"\n"
+"SYNOPSIS\n"
+" curl [options] url\n"
+"\n"
+"DESCRIPTION\n"
+" curl is a client to get documents/files from servers, using\n"
+" any of the supported protocols. The command is designed to\n"
+" work without user interaction or any kind of interactivity.\n"
+"\n"
+" curl offers a busload of useful tricks like proxy support,\n"
+" user authentication, ftp upload, HTTP post, SSL (https:)\n"
+" connections, cookies, file transfer resume and more.\n"
+"\n"
+"URL\n"
+" The URL syntax is protocol dependent. You'll find a detailed\n"
+" description in RFC 2396.\n"
+"\n"
+" You can specify multiple URLs or parts of URLs by writing\n"
+" part sets within braces as in:\n"
+"\n"
+" http://site.{one,two,three}.com\n"
+"\n"
+" or you can get sequences of alphanumeric series by using []\n"
+" as in:\n"
+"\n"
+" ftp://ftp.numericals.com/file[1-100].txt\n"
+" ftp://ftp.numericals.com/file[001-100].txt (with leading\n"
+" zeros)\n"
+" ftp://ftp.letters.com/file[a-z].txt\n"
+"\n"
+" It is possible to specify up to 9 sets or series for a URL,\n"
+" but no nesting is supported at the moment:\n"
+"\n"
+" http://www.any.org/archive[1996-1999]/volume[1-\n"
+" 4]part{a,b,c,index}.html\n"
+"\n"
+"OPTIONS\n"
+" -a/--append\n"
+" (FTP) When used in a ftp upload, this will tell curl to\n"
+" append to the target file instead of overwriting it. If\n"
+" the file doesn't exist, it will be created.\n"
+"\n"
+" -A/--user-agent <agent string>\n"
+" (HTTP) Specify the User-Agent string to send to the\n"
+" HTTP server. Some badly done CGIs fail if its not set\n"
+" to \"Mozilla/4.0\". To encode blanks in the string, sur-\n"
+" round the string with single quote marks. This can\n"
+" also be set with the -H/--header flag of course.\n"
+" -b/--cookie <name=data>\n"
+" (HTTP) Pass the data to the HTTP server as a cookie. It\n"
+" is supposedly the data previously received from the\n"
+" server in a \"Set-Cookie:\" line. The data should be in\n"
+" the format \"NAME1=VALUE1; NAME2=VALUE2\".\n"
+"\n"
+" If no '=' letter is used in the line, it is treated as\n"
+" a filename to use to read previously stored cookie\n"
+" lines from, which should be used in this session if\n"
+" they match. Using this method also activates the\n"
+" \"cookie parser\" which will make curl record incoming\n"
+" cookies too, which may be handy if you're using this in\n"
+" combination with the -L/--location option. The file\n"
+" format of the file to read cookies from should be plain\n"
+" HTTP headers or the netscape cookie file format.\n"
+"\n"
+" -B/--ftp-ascii\n"
+" (FTP/LDAP) Use ASCII transfer when getting an FTP file\n"
+" or LDAP info. For FTP, this can also be enforced by\n"
+" using an URL that ends with \";type=A\".\n"
+"\n"
+" -c/--continue\n"
+" Continue/Resume a previous file transfer. This\n"
+" instructs curl to continue appending data on the file\n"
+" where it was previously left, possibly because of a\n"
+" broken connection to the server. There must be a named\n"
+" physical file to append to for this to work. Note:\n"
+" Upload resume is depening on a command named SIZE not\n"
+" always present in all ftp servers! Upload resume is for\n"
+" FTP only. HTTP resume is only possible with HTTP/1.1\n"
+" or later servers.\n"
+"\n"
+" -C/--continue-at <offset>\n"
+" Continue/Resume a previous file transfer at the given\n"
+" offset. The given offset is the exact number of bytes\n"
+" that will be skipped counted from the beginning of the\n"
+" source file before it is transfered to the destination.\n"
+" If used with uploads, the ftp server command SIZE will\n"
+" not be used by curl. Upload resume is for FTP only.\n"
+" HTTP resume is only possible with HTTP/1.1 or later\n"
+" servers.\n"
+"\n"
+" -d/--data <data>\n"
+" (HTTP) Sends the specified data in a POST request to\n"
+" the HTTP server. Note that the data is sent exactly as\n"
+" specified with no extra processing. The data is\n"
+" expected to be \"url-encoded\". This will cause curl to\n"
+" pass the data to the server using the content-type\n"
+" application/x-www-form-urlencoded. Compare to -F.\n"
+"\n"
+" If you start the data with the letter @, the rest\n"
+" should be a file name to read the data from, or - if\n"
+" you want curl to read the data from stdin. The con-\n"
+" tents of the file must already be url-encoded.\n"
+"\n"
+" -D/--dump-header <file>\n"
+" (HTTP/FTP) Write the HTTP headers to this file. Write\n"
+" the FTP file info to this file if -I/--head is used.\n"
+"\n"
+" -e/--referer <URL>\n"
+" (HTTP) Sends the \"Referer Page\" information to the HTTP\n"
+" server. Some badly done CGIs fail if it's not set. This\n"
+" can also be set with the -H/--header flag of course.\n"
+"\n"
+" -E/--cert <certificate[:password]>\n"
+" (HTTPS) Tells curl to use the specified certificate\n"
+" file when getting a file with HTTPS. The certificate\n"
+" must be in PEM format. If the optional password isn't\n"
+" specified, it will be queried for on the terminal. Note\n"
+" that this certificate is the private key and the\n"
+" private certificate concatenated!\n"
+"\n"
+" -f/--fail\n"
+" (HTTP) Fail silently (no output at all) on server\n"
+" errors. This is mostly done like this to better enable\n"
+" scripts etc to better deal with failed attempts. In\n"
+" normal cases when a HTTP server fails to deliver a\n"
+" document, it returns a HTML document stating so (which\n"
+" often also describes why and more). This flag will\n"
+" prevent curl from outputting that and fail silently\n"
+" instead.\n"
+"\n"
+" -F/--form <name=content>\n"
+" (HTTP) This lets curl emulate a filled in form in which\n"
+" a user has pressed the submit button. This causes curl\n"
+" to POST data using the content-type multipart/form-data\n"
+" according to RFC1867. This enables uploading of binary\n"
+" files etc. To force the 'content' part to be read from\n"
+" a file, prefix the file name with an @ sign. Example,\n"
+" to send your password file to the server, where 'pass-\n"
+" word' is the name of the form-field to which\n"
+" /etc/passwd will be the input:\n"
+"\n"
+" curl -F password=@/etc/passwd www.mypasswords.com\n"
+"\n"
+" To read the file's content from stdin insted of a file,\n"
+" use - where the file name should've been.\n"
+"\n"
+" -h/--help\n"
+" Usage help.\n"
+"\n"
+" -H/--header <header>\n"
+" (HTTP) Extra header to use when getting a web page. You\n"
+" may specify any number of extra headers. Note that if\n"
+" you should add a custom header that has the same name\n"
+" as one of the internal ones curl would use, your exter-\n"
+" nally set header will be used instead of the internal\n"
+" one. This allows you to make even trickier stuff than\n"
+" curl would normally do. You should not replace inter-\n"
+" nally set headers without knowing perfectly well what\n"
+" you're doing.\n"
+"\n"
+" -i/--include\n"
+" (HTTP) Include the HTTP-header in the output. The\n"
+" HTTP-header includes things like server-name, date of\n"
+" the document, HTTP-version and more...\n"
+"\n"
+" -I/--head\n"
+" (HTTP/FTP) Fetch the HTTP-header only! HTTP-servers\n"
+" feature the command HEAD which this uses to get nothing\n"
+" but the header of a document. When used on a FTP file,\n"
+" curl displays the file size only.\n"
+"\n"
+" -K/--config <config file>\n"
+" Specify which config file to read curl arguments from.\n"
+" The config file is a text file in which command line\n"
+" arguments can be written which then will be used as if\n"
+" they were written on the actual command line. If the\n"
+" first column of a config line is a '#' character, the\n"
+" rest of the line will be treated as a comment.\n"
+"\n"
+" Specify the filename as '-' to make curl read the file\n"
+" from stdin.\n"
+"\n"
+" -l/--list-only\n"
+" (FTP) When listing an FTP directory, this switch forces\n"
+" a name-only view. Especially useful if you want to\n"
+" machine-parse the contents of an FTP directory since\n"
+" the normal directory view doesn't use a standard look\n"
+" or format.\n"
+"\n"
+" -L/--location\n"
+" (HTTP/HTTPS) If the server reports that the requested\n"
+" page has a different location (indicated with the\n"
+" header line Location:) this flag will let curl attempt\n"
+" to reattempt the get on the new place. If used together\n"
+" with -i or -I, headers from all requested pages will be\n"
+" shown.\n"
+"\n"
+" -m/--max-time <seconds>\n"
+" Maximum time in seconds that you allow the whole opera-\n"
+" tion to take. This is useful for preventing your batch\n"
+" jobs from hanging for hours due to slow networks or\n"
+" links going down. This doesn't work properly in win32\n"
+" systems.\n"
+" -M/--manual\n"
+" Manual. Display the huge help text.\n"
+"\n"
+" -n/--netrc\n"
+" Makes curl scan the .netrc file in the user's home\n"
+" directory for login name and password. This is typi-\n"
+" cally used for ftp on unix. If used with http, curl\n"
+" will enable user authentication. See netrc(4) for\n"
+" details on the file format. Curl will not complain if\n"
+" that file hasn't the right permissions (it should not\n"
+" be world nor group readable). The environment variable\n"
+" \"HOME\" is used to find the home directory.\n"
+"\n"
+" A quick and very simple example of how to setup a\n"
+" .netrc to allow curl to ftp to the machine\n"
+" host.domain.com with user name\n"
+"\n"
+" machine host.domain.com user myself password secret\n"
+"\n"
+" -o/--output <file>\n"
+" Write output to <file> instead of stdout. If you are\n"
+" using {} or [] to fetch multiple documents, you can use\n"
+" #<num> in the <file> specifier. That variable will be\n"
+" replaced with the current string for the URL being\n"
+" fetched. Like in:\n"
+"\n"
+" curl http://{one,two}.site.com -o \"file_#1.txt\"\n"
+"\n"
+" or use several variables like:\n"
+"\n"
+" curl http://{site,host}.host[1-5].com -o \"#1_#2\"\n"
+"\n"
+" -O/--remote-name\n"
+" Write output to a local file named like the remote file\n"
+" we get. (Only the file part of the remote file is used,\n"
+" the path is cut off.)\n"
+"\n"
+" -P/--ftpport <address>\n"
+" (FTP) Reverses the initiator/listenor roles when con-\n"
+" necting with ftp. This switch makes Curl use the PORT\n"
+" command instead of PASV. In practice, PORT tells the\n"
+" server to connect to the client's specified address and\n"
+" port, while PASV asks the server for an ip address and\n"
+" port to connect to. <address> should be one of:\n"
+" interface - i.e \"eth0\" to specify which interface's IP\n"
+" address you want to use (Unix only)\n"
+" IP address - i.e \"192.168.10.1\" to specify exact IP\n"
+" number\n"
+" host name - i.e \"my.host.domain\" to specify machine\n"
+" \"-\" - (any single-letter string) to make it pick\n"
+" the machine's default\n"
+" -q If used as the first parameter on the command line, the\n"
+" $HOME/.curlrc file will not be read and used as a con-\n"
+" fig file.\n"
+"\n"
+" -Q/--quote <comand>\n"
+" (FTP) Send an arbitrary command to the remote FTP\n"
+" server, by using the QUOTE command of the server. Not\n"
+" all servers support this command, and the set of QUOTE\n"
+" commands are server specific!\n"
+"\n"
+" -r/--range <range>\n"
+" (HTTP/FTP) Retrieve a byte range (i.e a partial docu-\n"
+" ment) from a HTTP/1.1 or FTP server. Ranges can be\n"
+" specified in a number of ways.\n"
+" 0-499 - specifies the first 500 bytes\n"
+" 500-999 - specifies the second 500 bytes\n"
+" -500 - specifies the last 500 bytes\n"
+" 9500- - specifies the bytes from offset 9500\n"
+" and forward\n"
+" 0-0,-1 - specifies the first and last byte\n"
+" only(*)(H)\n"
+" 500-700,600-799 - specifies 300 bytes from offset\n"
+" 500(H)\n"
+" 100-199,500-599 - specifies two separate 100 bytes\n"
+" ranges(*)(H)\n"
+"\n"
+" (*) = NOTE that this will cause the server to reply\n"
+" with a multipart response!\n"
+"\n"
+" You should also be aware that many HTTP/1.1 servers do\n"
+" not have this feature enabled, so that when you attempt\n"
+" to get a range, you'll instead get the whole document.\n"
+"\n"
+" FTP range downloads only support the simple syntax\n"
+" 'start-stop' (optionally with one of the numbers omit-\n"
+" ted). It depends on the non-RFC command SIZE.\n"
+"\n"
+" -s/--silent\n"
+" Silent mode. Don't show progress meter or error mes-\n"
+" sages. Makes Curl mute.\n"
+"\n"
+" -S/--show-error\n"
+" When used with -s it makes curl show error message if\n"
+" it fails.\n"
+"\n"
+" -t/--upload\n"
+" Transfer the stdin data to the specified file. Curl\n"
+" will read everything from stdin until EOF and store\n"
+" with the supplied name. If this is used on a http(s)\n"
+" server, the PUT command will be used.\n"
+"\n"
+" -T/--upload-file <file>\n"
+" Like -t, but this transfers the specified local file.\n"
+" If there is no file part in the specified URL, Curl\n"
+" will append the local file name. NOTE that you must use\n"
+" a trailing / on the last directory to really prove to\n"
+" Curl that there is no file name or curl will think that\n"
+" your last directory name is the remote file name to\n"
+" use. That will most likely cause the upload operation\n"
+" to fail. If this is used on a http(s) server, the PUT\n"
+" command will be used.\n"
+"\n"
+" -u/--user <user:password>\n"
+" Specify user and password to use when fetching. See\n"
+" README.curl for detailed examples of how to use this.\n"
+" If no password is specified, curl will ask for it\n"
+" interactively.\n"
+"\n"
+" -U/--proxy-user <user:password>\n"
+" Specify user and password to use for Proxy authentica-\n"
+" tion. If no password is specified, curl will ask for it\n"
+" interactively.\n"
+"\n"
+" -v/--verbose\n"
+" Makes the fetching more verbose/talkative. Mostly\n"
+" usable for debugging. Lines starting with '>' means\n"
+" data sent by curl, '<' means data received by curl that\n"
+" is hidden in normal cases and lines starting with '*'\n"
+" means additional info provided by curl.\n"
+"\n"
+" -V/--version\n"
+" Displays the full version of curl, libcurl and other\n"
+" 3rd party libraries linked with the executable.\n"
+"\n"
+" -x/--proxy <proxyhost[:port]>\n"
+" Use specified proxy. If the port number is not speci-\n"
+" fied, it is assumed at port 1080.\n"
+"\n"
+" -X/--request <command>\n"
+" (HTTP) Specifies a custom request to use when communi-\n"
+" cating with the HTTP server. The specified request\n"
+" will be used instead of the standard GET. Read the HTTP\n"
+" 1.1 specification for details and explanations.\n"
+"\n"
+" (FTP) Specifies a custom FTP command to use instead of\n"
+" LIST when doing file lists with ftp.\n"
+"\n"
+" -y/--speed-time <speed>\n"
+" Speed Limit. If a download is slower than this given\n"
+" speed, in bytes per second, for Speed Time seconds it\n"
+" gets aborted. Speed Time is set with -Y and is 30 if\n"
+" not set.\n"
+"\n"
+" -Y/--speed-limit <time>\n"
+" Speed Time. If a download is slower than Speed Limit\n"
+" bytes per second during a Speed Time period, the down-\n"
+" load gets aborted. If Speed Time is used, the default\n"
+" Speed Limit will be 1 unless set with -y.\n"
+"\n"
+" -z/--time-cond <date expression>\n"
+" (HTTP) Request to get a file that has been modified\n"
+" later than the given time and date, or one that has\n"
+" been modified before that time. The date expression can\n"
+" be all sorts of date strings or if it doesn't match any\n"
+" internal ones, it tries to get the time from a given\n"
+" file name instead! See the GNU date(1) man page for\n"
+" date expression details.\n"
+"\n"
+" Start the date expression with a dash (-) to make it\n"
+" request for a document that is older than the given\n"
+" date/time, default is a document that is newer than the\n"
+" specified date/time.\n"
+"\n"
+" -3/--sslv3\n"
+" (HTTPS) Forces curl to use SSL version 3 when negotiat-\n"
+" ing with a remote SSL server.\n"
+"\n"
+" -2/--sslv2\n"
+" (HTTPS) Forces curl to use SSL version 2 when negotiat-\n"
+" ing with a remote SSL server.\n"
+"\n"
+" -#/--progress-bar\n"
+" Make curl display progress information as a progress\n"
+" bar instead of the default statistics.\n"
+"\n"
+" --crlf\n"
+" (FTP) Convert LF to CRLF in upload. Useful for MVS\n"
+" (OS/390).\n"
+"\n"
+" --stderr <file>\n"
+" Redirect all writes to stderr to the specified file\n"
+" instead. If the file name is a plain '-', it is instead\n"
+" written to stdout. This option has no point when you're\n"
+" using a shell with decent redirecting capabilities.\n"
+"\n"
+"FILES\n"
+" ~/.curlrc\n"
+" Default config file.\n"
+"\n"
+"ENVIRONMENT\n"
+" HTTP_PROXY [protocol://]<host>[:port]\n"
+" Sets proxy server to use for HTTP.\n"
+"\n"
+" HTTPS_PROXY [protocol://]<host>[:port]\n"
+" Sets proxy server to use for HTTPS.\n"
+" FTP_PROXY [protocol://]<host>[:port]\n"
+" Sets proxy server to use for FTP.\n"
+"\n"
+" GOPHER_PROXY [protocol://]<host>[:port]\n"
+" Sets proxy server to use for GOPHER.\n"
+"\n"
+" ALL_PROXY [protocol://]<host>[:port]\n"
+" Sets proxy server to use if no protocol-specific proxy\n"
+" is set.\n"
+"\n"
+" NO_PROXY <comma-separated list of hosts>\n"
+" list of host names that shouldn't go through any proxy.\n"
+" If se\n"
+"\n"
+"LATEST VERSION\n"
+"\n"
+" You always find news about what's going on as well as the latest versions\n"
+" from the curl web pages, located at:\n"
+"\n"
+" http://curl.haxx.nu\n"
+"\n"
+"SIMPLE USAGE\n"
+"\n"
+" Get the main page from netscape's web-server:\n"
+"\n"
+" curl http://www.netscape.com/\n"
+"\n"
+" Get the root README file from funet's ftp-server:\n"
+"\n"
+" curl ftp://ftp.funet.fi/README\n"
+"\n"
+" Get a gopher document from funet's gopher server:\n"
+"\n"
+" curl gopher://gopher.funet.fi\n"
+"\n"
+" Get a web page from a server using port 8000:\n"
+"\n"
+" curl http://www.weirdserver.com:8000/\n"
+"\n"
+" Get a list of the root directory of an FTP site:\n"
+"\n"
+" curl ftp://ftp.fts.frontec.se/\n"
+"\n"
+" Get the definition of curl from a dictionary:\n"
+"\n"
+" curl dict://dict.org/m:curl\n"
+"\n"
+"DOWNLOAD TO A FILE\n"
+"\n"
+" Get a web page and store in a local file:\n"
+"\n"
+" curl -o thatpage.html http://www.netscape.com/\n"
+"\n"
+" Get a web page and store in a local file, make the local file get the name\n"
+" of the remote document (if no file name part is specified in the URL, this\n"
+" will fail):\n"
+"\n"
+" curl -O http://www.netscape.com/index.html\n"
+"\n"
+"USING PASSWORDS\n"
+"\n"
+" FTP\n"
+"\n"
+" To ftp files using name+passwd, include them in the URL like:\n"
+"\n"
+" curl ftp://name:passwd@machine.domain:port/full/path/to/file\n"
+"\n"
+" or specify them with the -u flag like\n"
+"\n"
+" curl -u name:passwd ftp://machine.domain:port/full/path/to/file\n"
+"\n"
+" HTTP\n"
+"\n"
+" The HTTP URL doesn't support user and password in the URL string. Curl\n"
+" does support that anyway to provide a ftp-style interface and thus you can\n"
+" pick a file like:\n"
+"\n"
+" curl http://name:passwd@machine.domain/full/path/to/file\n"
+"\n"
+" or specify user and password separately like in\n"
+"\n"
+" curl -u name:passwd http://machine.domain/full/path/to/file\n"
+"\n"
+" NOTE! Since HTTP URLs don't support user and password, you can't use that\n"
+" style when using Curl via a proxy. You _must_ use the -u style fetch\n"
+" during such circumstances.\n"
+"\n"
+" HTTPS\n"
+"\n"
+" Probably most commonly used with private certificates, as explained below.\n"
+"\n"
+" GOPHER\n"
+"\n"
+" Curl features no password support for gopher.\n"
+"\n"
+"PROXY\n"
+"\n"
+" Get an ftp file using a proxy named my-proxy that uses port 888:\n"
+"\n"
+" curl -x my-proxy:888 ftp://ftp.leachsite.com/README\n"
+"\n"
+" Get a file from a HTTP server that requires user and password, using the\n"
+" same proxy as above:\n"
+"\n"
+" curl -u user:passwd -x my-proxy:888 http://www.get.this/\n"
+"\n"
+" Some proxies require special authentication. Specify by using -U as above:\n"
+"\n"
+" curl -U user:passwd -x my-proxy:888 http://www.get.this/\n"
+"\n"
+" See also the environment variables Curl support that offer further proxy\n"
+" control.\n"
+"\n"
+"RANGES\n"
+"\n"
+" With HTTP 1.1 byte-ranges were introduced. Using this, a client can request\n"
+" to get only one or more subparts of a specified document. Curl supports\n"
+" this with the -r flag.\n"
+"\n"
+" Get the first 100 bytes of a document:\n"
+"\n"
+" curl -r 0-99 http://www.get.this/\n"
+"\n"
+" Get the last 500 bytes of a document:\n"
+"\n"
+" curl -r -500 http://www.get.this/\n"
+"\n"
+" Curl also supports simple ranges for FTP files as well. Then you can only\n"
+" specify start and stop position.\n"
+"\n"
+" Get the first 100 bytes of a document using FTP:\n"
+"\n"
+" curl -r 0-99 ftp://www.get.this/README \n"
+"\n"
+"UPLOADING\n"
+"\n"
+" FTP\n"
+"\n"
+" Upload all data on stdin to a specified ftp site:\n"
+"\n"
+" curl -t ftp://ftp.upload.com/myfile\n"
+"\n"
+" Upload data from a specified file, login with user and password:\n"
+"\n"
+" curl -T uploadfile -u user:passwd ftp://ftp.upload.com/myfile\n"
+"\n"
+" Upload a local file to the remote site, and use the local file name remote\n"
+" too:\n"
+" \n"
+" curl -T uploadfile -u user:passwd ftp://ftp.upload.com/\n"
+"\n"
+" NOTE: Curl is not currently supporing ftp upload through a proxy! The reason\n"
+" for this is simply that proxies are seldomly configured to allow this and\n"
+" that no author has supplied code that makes it possible!\n"
+"\n"
+" HTTP\n"
+"\n"
+" Upload all data on stdin to a specified http site:\n"
+"\n"
+" curl -t http://www.upload.com/myfile\n"
+"\n"
+" Note that the http server must've been configured to accept PUT before this\n"
+" can be done successfully.\n"
+"\n"
+" For other ways to do http data upload, see the POST section below.\n"
+"\n"
+"VERBOSE / DEBUG\n"
+"\n"
+" If curl fails where it isn't supposed to, if the servers don't let you\n"
+" in, if you can't understand the responses: use the -v flag to get VERBOSE\n"
+" fetching. Curl will output lots of info and all data it sends and\n"
+" receives in order to let the user see all client-server interaction.\n"
+"\n"
+" curl -v ftp://ftp.upload.com/\n"
+"\n"
+"DETAILED INFORMATION\n"
+"\n"
+" Different protocols provide different ways of getting detailed information\n"
+" about specific files/documents. To get curl to show detailed information\n"
+" about a single file, you should use -I/--head option. It displays all\n"
+" available info on a single file for HTTP and FTP. The HTTP information is a\n"
+" lot more extensive.\n"
+"\n"
+" For HTTP, you can get the header information (the same as -I would show)\n"
+" shown before the data by using -i/--include. Curl understands the\n"
+" -D/--dump-header option when getting files from both FTP and HTTP, and it\n"
+" will then store the headers in the specified file.\n"
+"\n"
+" Store the HTTP headers in a separate file:\n"
+"\n"
+" curl --dump-header headers.txt curl.haxx.nu\n"
+"\n"
+" Note that headers stored in a separate file can be very useful at a later\n"
+" time if you want curl to use cookies sent by the server. More about that in\n"
+" the cookies section.\n"
+"\n"
+"POST (HTTP)\n"
+"\n"
+" It's easy to post data using curl. This is done using the -d <data>\n"
+" option. The post data must be urlencoded.\n"
+"\n"
+" Post a simple \"name\" and \"phone\" guestbook.\n"
+"\n"
+" curl -d \"name=Rafael%20Sagula&phone=3320780\" \\\n"
+" http://www.where.com/guest.cgi\n"
+"\n"
+" While -d uses the application/x-www-form-urlencoded mime-type, generally\n"
+" understood by CGI's and similar, curl also supports the more capable\n"
+" multipart/form-data type. This latter type supports things like file upload.\n"
+"\n"
+" -F accepts parameters like -F \"name=contents\". If you want the contents to\n"
+" be read from a file, use <@filename> as contents. When specifying a file,\n"
+" you can also specify which content type the file is, by appending\n"
+" ';type=<mime type>' to the file name. You can also post contents of several\n"
+" files in one field. So that the field name 'coolfiles' can be sent three\n"
+" files with different content types in a manner similar to:\n"
+"\n"
+" curl -F \"coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html\" \\\n"
+" http://www.post.com/postit.cgi\n"
+"\n"
+" If content-type is not specified, curl will try to guess from the extension\n"
+" (it only knows a few), or use the previously specified type (from an earlier\n"
+" file if several files are specified in a list) or finally using the default\n"
+" type 'text/plain'.\n"
+"\n"
+" Emulate a fill-in form with -F. Let's say you fill in three fields in a\n"
+" form. One field is a file name which to post, one field is your name and one\n"
+" field is a file description. We want to post the file we have written named\n"
+" \"cooltext.txt\". To let curl do the posting of this data instead of your\n"
+" favourite browser, you have to check out the HTML of the form page to get to\n"
+" know the names of the input fields. In our example, the input field names are\n"
+" 'file', 'yourname' and 'filedescription'.\n"
+"\n"
+" curl -F \"file=@cooltext.txt\" -F \"yourname=Daniel\" \\\n"
+" -F \"filedescription=Cool text file with cool text inside\" \\\n"
+" http://www.post.com/postit.cgi\n"
+"\n"
+" So, to send two files in one post you can do it in two ways:\n"
+"\n"
+" 1. Send multiple files in a single \"field\" with a single field name:\n"
+" \n"
+" curl -F \"pictures=@dog.gif,cat.gif\" \n"
+" \n"
+" 2. Send two fields with two field names: \n"
+"\n"
+" curl -F \"docpicture=@dog.gif\" -F \"catpicture=@cat.gif\" \n"
+"\n"
+"REFERER\n"
+"\n"
+" A HTTP request has the option to include information about which address\n"
+" that referred to actual page, and curl allows the user to specify that\n"
+" referrer to get specified on the command line. It is especially useful to\n"
+" fool or trick stupid servers or CGI scripts that rely on that information\n"
+" being available or contain certain data.\n"
+"\n"
+" curl -e www.coolsite.com http://www.showme.com/\n"
+"\n"
+"USER AGENT\n"
+"\n"
+" A HTTP request has the option to include information about the browser\n"
+" that generated the request. Curl allows it to be specified on the command\n"
+" line. It is especially useful to fool or trick stupid servers or CGI\n"
+" scripts that only accept certain browsers.\n"
+"\n"
+" Example:\n"
+"\n"
+" curl -A 'Mozilla/3.0 (Win95; I)' http://www.nationsbank.com/\n"
+"\n"
+" Other common strings:\n"
+" 'Mozilla/3.0 (Win95; I)' Netscape Version 3 for Windows 95\n"
+" 'Mozilla/3.04 (Win95; U)' Netscape Version 3 for Windows 95\n"
+" 'Mozilla/2.02 (OS/2; U)' Netscape Version 2 for OS/2\n"
+" 'Mozilla/4.04 [en] (X11; U; AIX 4.2; Nav)' NS for AIX\n"
+" 'Mozilla/4.05 [en] (X11; U; Linux 2.0.32 i586)' NS for Linux\n"
+"\n"
+" Note that Internet Explorer tries hard to be compatible in every way:\n"
+" 'Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)' MSIE for W95\n"
+"\n"
+" Mozilla is not the only possible User-Agent name:\n"
+" 'Konqueror/1.0' KDE File Manager desktop client\n"
+" 'Lynx/2.7.1 libwww-FM/2.14' Lynx command line browser\n"
+"\n"
+"COOKIES\n"
+"\n"
+" Cookies are generally used by web servers to keep state information at the\n"
+" client's side. The server sets cookies by sending a response line in the\n"
+" headers that looks like 'Set-Cookie: <data>' where the data part then\n"
+" typically contains a set of NAME=VALUE pairs (separated by semicolons ';'\n"
+" like \"NAME1=VALUE1; NAME2=VALUE2;\"). The server can also specify for what\n"
+" path the \"cookie\" should be used for (by specifying \"path=value\"), when the\n"
+" cookie should expire (\"expire=DATE\"), for what domain to use it\n"
+" (\"domain=NAME\") and if it should be used on secure connections only\n"
+" (\"secure\").\n"
+"\n"
+" If you've received a page from a server that contains a header like:\n"
+" Set-Cookie: sessionid=boo123; path=\"/foo\";\n"
+"\n"
+" it means the server wants that first pair passed on when we get anything in\n"
+" a path beginning with \"/foo\".\n"
+"\n"
+" Example, get a page that wants my name passed in a cookie:\n"
+"\n"
+" curl -b \"name=Daniel\" www.sillypage.com\n"
+"\n"
+" Curl also has the ability to use previously received cookies in following\n"
+" sessions. If you get cookies from a server and store them in a file in a\n"
+" manner similar to:\n"
+"\n"
+" curl --dump-header headers www.example.com\n"
+"\n"
+" ... you can then in a second connect to that (or another) site, use the\n"
+" cookies from the 'headers' file like:\n"
+"\n"
+" curl -b headers www.example.com\n"
+"\n"
+" Note that by specifying -b you enable the \"cookie awareness\" and with -L\n"
+" you can make curl follow a location: (which often is used in combination\n"
+" with cookies). So that if a site sends cookies and a location, you can\n"
+" use a non-existing file to trig the cookie awareness like:\n"
+"\n"
+" curl -L -b empty-file www.example.com\n"
+"\n"
+" The file to read cookies from must be formatted using plain HTTP headers OR\n"
+" as netscape's cookie file. Curl will determine what kind it is based on the\n"
+" file contents.\n"
+"\n"
+"PROGRESS METER\n"
+"\n"
+" The progress meter was introduced to better show a user that something\n"
+" actually is happening. The different fields in the output have the following\n"
+" meaning:\n"
+"\n"
+" % Received Total Speed Time left Total Curr.Speed\n"
+" 13 524140 3841536 4296 0:12:52 0:14:54 292 \n"
+"\n"
+" From left-to-right:\n"
+" - The first column, is the percentage of the file currently transfered.\n"
+" - Received means the total number of bytes that has been transfered.\n"
+" - Total is the total number of bytes expected to transfer.\n"
+" - Speed is average speed in bytes per second for the whole transfer so far.\n"
+" - Time left is the estimated time left for this transfer to finnish if the\n"
+" current average speed will remain steady.\n"
+" - Total is the estimated total transfer time.\n"
+" - Curr.Speed is the average transfer speed the last 5 seconds (the first\n"
+" 5 seconds of a transfer is based on less time of course.)\n"
+"\n"
+" NOTE: Much of the output is based on the fact that the size of the transfer\n"
+" is known before it takes place. If it isn't, a much less fancy display will\n"
+" be used.\n"
+"\n"
+"SPEED LIMIT\n"
+"\n"
+" Curl offers the user to set conditions regarding transfer speed that must\n"
+" be met to let the transfer keep going. By using the switch -y and -Y you\n"
+" can make curl abort transfers if the transfer speed doesn't exceed your\n"
+" given lowest limit for a specified time.\n"
+"\n"
+" To let curl abandon downloading this page if its slower than 3000 bytes per\n"
+" second for 1 minute, run:\n"
+"\n"
+" curl -y 3000 -Y 60 www.far-away-site.com\n"
+"\n"
+" This can very well be used in combination with the overall time limit, so\n"
+" that the above operatioin must be completed in whole within 30 minutes:\n"
+"\n"
+" curl -m 1800 -y 3000 -Y 60 www.far-away-site.com\n"
+"\n"
+"CONFIG FILE\n"
+"\n"
+" Curl automatically tries to read the .curlrc file (or _curlrc file on win32\n"
+" systems) from the user's home dir on startup. The config file should be\n"
+" made up with normal command line switches. Comments can be used within the\n"
+" file. If the first letter on a line is a '#'-letter the rest of the line\n"
+" is treated as a comment.\n"
+"\n"
+" Example, set default time out and proxy in a config file:\n"
+"\n"
+" # We want a 30 minute timeout:\n"
+" -m 1800\n"
+" # ... and we use a proxy for all accesses:\n"
+" -x proxy.our.domain.com:8080\n"
+"\n"
+" White spaces ARE significant at the end of lines, but all white spaces\n"
+" leading up to the first characters of each line are ignored.\n"
+"\n"
+" Prevent curl from reading the default file by using -q as the first command\n"
+" line parameter, like:\n"
+"\n"
+" curl -q www.thatsite.com\n"
+"\n"
+" Force curl to get and display a local help page in case it is invoked\n"
+" without URL by making a config file similar to:\n"
+"\n"
+" # default url to get\n"
+" http://help.with.curl.com/curlhelp.html\n"
+"\n"
+" You can specify another config file to be read by using the -K/--config\n"
+" flag. If you set config file name to \"-\" it'll read the config from stdin,\n"
+" which can be handy if you want to hide options from being visible in process\n"
+" tables etc:\n"
+"\n"
+" echo \"-u user:passwd\" | curl -K - http://that.secret.site.com\n"
+"\n"
+"EXTRA HEADERS\n"
+"\n"
+" When using curl in your own very special programs, you may end up needing\n"
+" to pass on your own custom headers when getting a web page. You can do\n"
+" this by using the -H flag.\n"
+"\n"
+" Example, send the header \"X-you-and-me: yes\" to the server when getting a\n"
+" page:\n"
+"\n"
+" curl -H \"X-you-and-me: yes\" www.love.com\n"
+"\n"
+" This can also be useful in case you want curl to send a different text in\n"
+" a header than it normally does. The -H header you specify then replaces the\n"
+" header curl would normally send.\n"
+"\n"
+"FTP and PATH NAMES\n"
+"\n"
+" Do note that when getting files with the ftp:// URL, the given path is\n"
+" relative the directory you enter. To get the file 'README' from your home\n"
+" directory at your ftp site, do:\n"
+"\n"
+" curl ftp://user:passwd@my.site.com/README\n"
+"\n"
+" But if you want the README file from the root directory of that very same\n"
+" site, you need to specify the absolute file name:\n"
+"\n"
+" curl ftp://user:passwd@my.site.com//README\n"
+"\n"
+" (I.e with an extra slash in front of the file name.)\n"
+"\n"
+"FTP and firewalls\n"
+"\n"
+" The FTP protocol requires one of the involved parties to open a second\n"
+" connction as soon as data is about to get transfered. There are two ways to\n"
+" do this.\n"
+"\n"
+" The default way for curl is to issue the PASV command which causes the\n"
+" server to open another port and await another connection performed by the\n"
+" client. This is good if the client is behind a firewall that don't allow\n"
+" incoming connections.\n"
+"\n"
+" curl ftp.download.com\n"
+"\n"
+" If the server for example, is behind a firewall that don't allow connections\n"
+" on other ports than 21 (or if it just doesn't support the PASV command), the\n"
+" other way to do it is to use the PORT command and instruct the server to\n"
+" connect to the client on the given (as parameters to the PORT command) IP\n"
+" number and port.\n"
+"\n"
+" The -P flag to curl allows for different options. Your machine may have\n"
+" several IP-addresses and/or network interfaces and curl allows you to select\n"
+" which of them to use. Default address can also be used:\n"
+"\n"
+" curl -P - ftp.download.com\n"
+"\n"
+" Download with PORT but use the IP address of our 'le0' interface:\n"
+"\n"
+" curl -P le0 ftp.download.com\n"
+"\n"
+" Download with PORT but use 192.168.0.10 as our IP address to use:\n"
+"\n"
+" curl -P 192.168.0.10 ftp.download.com\n"
+"\n"
+"HTTPS\n"
+"\n"
+" Secure HTTP requires SSLeay to be installed and used when curl is built. If\n"
+" that is done, curl is capable of retrieving and posting documents using the\n"
+" HTTPS procotol.\n"
+"\n"
+" Example:\n"
+"\n"
+" curl https://www.secure-site.com\n"
+"\n"
+" Curl is also capable of using your personal certificates to get/post files\n"
+" from sites that require valid certificates. The only drawback is that the\n"
+" certificate needs to be in PEM-format. PEM is a standard and open format to\n"
+" store certificates with, but it is not used by the most commonly used\n"
+" browsers (Netscape and MSEI both use the so called PKCS#12 format). If you\n"
+" want curl to use the certificates you use with your (favourite) browser, you\n"
+" may need to download/compile a converter that can convert your browser's\n"
+" formatted certificates to PEM formatted ones. Dr Stephen N. Henson has\n"
+" written a patch for SSLeay that adds this functionality. You can get his\n"
+" patch (that requires an SSLeay installation) from his site at:\n"
+" http://www.drh-consultancy.demon.co.uk/\n"
+"\n"
+" Example on how to automatically retrieve a document using a certificate with\n"
+" a personal password:\n"
+"\n"
+" curl -E /path/to/cert.pem:password https://secure.site.com/\n"
+"\n"
+" If you neglect to specify the password on the command line, you will be\n"
+" prompted for the correct password before any data can be received.\n"
+"\n"
+" Many older SSL-servers have problems with SSLv3 or TLS, that newer versions\n"
+" of OpenSSL etc is using, therefore it is sometimes useful to specify what\n"
+" SSL-version curl should use. Use -3 or -2 to specify that exact SSL version\n"
+" to use:\n"
+"\n"
+" curl -2 https://secure.site.com/\n"
+"\n"
+" Otherwise, curl will first attempt to use v3 and then v2.\n"
+"\n"
+"RESUMING FILE TRANSFERS\n"
+"\n"
+" To continue a file transfer where it was previously aborted, curl supports\n"
+" resume on http(s) downloads as well as ftp uploads and downloads.\n"
+"\n"
+" Continue downloading a document:\n"
+"\n"
+" curl -c -o file ftp://ftp.server.com/path/file\n"
+"\n"
+" Continue uploading a document(*1):\n"
+"\n"
+" curl -c -T file ftp://ftp.server.com/path/file\n"
+"\n"
+" Continue downloading a document from a web server(*2):\n"
+"\n"
+" curl -c -o file http://www.server.com/\n"
+"\n"
+" (*1) = This requires that the ftp server supports the non-standard command\n"
+" SIZE. If it doesn't, curl will say so.\n"
+"\n"
+" (*2) = This requires that the wb server supports at least HTTP/1.1. If it\n"
+" doesn't, curl will say so.\n"
+"\n"
+"TIME CONDITIONS\n"
+"\n"
+" HTTP allows a client to specify a time condition for the document it\n"
+" requests. It is If-Modified-Since or If-Unmodified-Since. Curl allow you to\n"
+" specify them with the -z/--time-cond flag.\n"
+"\n"
+" For example, you can easily make a download that only gets performed if the\n"
+" remote file is newer than a local copy. It would be made like:\n"
+"\n"
+" curl -z local.html http://remote.server.com/remote.html\n"
+"\n"
+" Or you can download a file only if the local file is newer than the remote\n"
+" one. Do this by prepending the date string with a '-', as in:\n"
+"\n"
+" curl -z -local.html http://remote.server.com/remote.html\n"
+"\n"
+" You can specify a \"free text\" date as condition. Tell curl to only download\n"
+" the file if it was updated since yesterday:\n"
+"\n"
+" curl -z yesterday http://remote.server.com/remote.html\n"
+"\n"
+" Curl will then accept a wide range of date formats. You always make the date\n"
+" check the other way around by prepending it with a dash '-'.\n"
+"\n"
+"DICT\n"
+"\n"
+" For fun try\n"
+"\n"
+" curl dict://dict.org/m:curl\n"
+" curl dict://dict.org/d:heisenbug:jargon\n"
+" curl dict://dict.org/d:daniel:web1913\n"
+"\n"
+" Aliases for 'm' are 'match' and 'find', and aliases for 'd' are 'define'\n"
+" and 'lookup'. For example,\n"
+"\n"
+" curl dict://dict.org/find:curl\n"
+"\n"
+" Commands that break the URL description of the RFC (but not the DICT\n"
+" protocol) are\n"
+"\n"
+" curl dict://dict.org/show:db\n"
+" curl dict://dict.org/show:strat\n"
+"\n"
+" Authentication is still missing (but this is not required by the RFC)\n"
+"\n"
+"LDAP\n"
+"\n"
+" If you have installed the OpenLDAP library, curl can take advantage of it\n"
+" and offer ldap:// support.\n"
+"\n"
+" LDAP is a complex thing and writing an LDAP query is not an easy task. I do\n"
+" advice you to dig up the syntax description for that elsewhere, RFC 1959 if\n"
+" no other place is better.\n"
+"\n"
+" To show you an example, this is now I can get all people from my local LDAP\n"
+" server that has a certain sub-domain in their email address:\n"
+"\n"
+" curl -B \"ldap://ldap.frontec.se/o=frontec??sub?mail=*sth.frontec.se\"\n"
+"\n"
+" If I want the same info in HTML format, I can get it by not using the -B\n"
+" (enforce ASCII) flag.\n"
+"\n"
+"ENVIRONMENT VARIABLES\n"
+"\n"
+" Curl reads and understands the following environment variables:\n"
+"\n"
+" HTTP_PROXY, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY\n"
+"\n"
+" They should be set for protocol-specific proxies. General proxy should be\n"
+" set with\n"
+" \n"
+" ALL_PROXY\n"
+"\n"
+" A comma-separated list of host names that shouldn't go through any proxy is\n"
+" set in (only an asterisk, '*' matches all hosts)\n"
+"\n"
+" NO_PROXY\n"
+"\n"
+" If a tail substring of the domain-path for a host matches one of these\n"
+" strings, transactions with that node will not be proxied.\n"
+"\n"
+"\n"
+" The usage of the -x/--proxy flag overrides the environment variables.\n"
+"\n"
+"MAILING LIST\n"
+"\n"
+" We have an open mailing list to discuss curl, its development and things\n"
+" relevant to this.\n"
+"\n"
+" To subscribe, mail curl-request@contactor.se with \"subscribe <your email\n"
+" address>\" in the body.\n"
+"\n"
+" To post to the list, mail curl@contactor.se.\n"
+"\n"
+" To unsubcribe, mail curl-request@contactor.se with \"unsubscribe <your\n"
+" subscribed email address>\" in the body.\n"
+"\n"
+ ) ;
+}
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 000000000..5666c777e
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,1154 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <ctype.h>
+
+#include <curl/curl.h>
+#include <curl/mprintf.h>
+#include "../lib/getdate.h"
+#ifdef GLOBURL
+#include "urlglob.h"
+#define CURLseparator "--_curl_--"
+#define MIMEseparator "_curl_"
+#endif
+
+/* This is now designed to have its own local setup.h */
+#include "setup.h"
+
+#include "version.h"
+
+#ifdef HAVE_IO_H /* typical win32 habit */
+#include <io.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+extern void hugehelp(void);
+
+static void helpf(char *fmt, ...)
+{
+ va_list ap;
+ if(fmt) {
+ va_start(ap, fmt);
+ fputs("curl: ", stderr); /* prefix it */
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
+ fprintf(stderr, "curl: try 'curl --help' for more information\n");
+}
+
+static void help(void)
+{
+ printf(CURL_ID "%s\n"
+ "Usage: curl [options...] <url>\n"
+ "Options: (H) means HTTP/HTTPS only, (F) means FTP only\n"
+ " -a/--append Append to target file when uploading (F)\n"
+ " -A/--user-agent <string> User-Agent to send to server (H)\n"
+ " -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
+ " -B/--ftp-ascii Use ASCII transfer (F)\n"
+ " -c/--continue Resume a previous transfer where we left it\n"
+ " -C/--continue-at <offset> Specify absolute resume offset\n"
+ " -d/--data POST data (H)\n"
+ " -D/--dump-header <file> Write the headers to this file\n"
+ " -e/--referer Referer page (H)\n"
+ " -E/--cert <cert:passwd> Specifies your certificate file and password (HTTPS)\n"
+ " -f/--fail Fail silently (no output at all) on errors (H)\n"
+ " -F/--form <name=content> Specify HTTP POST data (H)\n"
+
+ " -h/--help This help text\n"
+ " -H/--header <line> Custom header to pass to server. (H)\n"
+ " -i/--include Include the HTTP-header in the output (H)\n"
+ " -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n"
+ " -K/--config Specify which config file to read\n"
+ " -l/--list-only List only names of an FTP directory (F)\n"
+ " -L/--location Follow Location: hints (H)\n"
+ " -m/--max-time <seconds> Maximum time allowed for the transfer\n"
+ " -M/--manual Display huge help text\n"
+ " -n/--netrc Read .netrc for user name and password\n"
+ " -o/--output <file> Write output to <file> instead of stdout\n"
+ " -O/--remote-name Write output to a file named as the remote file\n"
+#if 0
+ " -p/--port <port> Use port other than default for current protocol.\n"
+#endif
+ " -P/--ftpport <address> Use PORT with address instead of PASV when ftping (F)\n"
+ " -q When used as the first parameter disables .curlrc\n"
+ " -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)\n"
+ " -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n"
+ " -s/--silent Silent mode. Don't output anything\n"
+ " -S/--show-error Show error. With -s, make curl show errors when they occur\n"
+ " -t/--upload Transfer/upload stdin to remote site\n"
+ " -T/--upload-file <file> Transfer/upload <file> to remote site\n"
+ " -u/--user <user:password> Specify user and password to use\n"
+ " -U/--proxy-user <user:password> Specify Proxy authentication\n"
+ " -v/--verbose Makes the operation more talkative\n"
+ " -V/--version Outputs version number then quits\n"
+ " -x/--proxy <host> Use proxy. (Default port is 1080)\n"
+ " -X/--request <command> Specific request command to use\n"
+ " -y/--speed-limit Stop transfer if below speed-limit for 'speed-time' secs\n"
+ " -Y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
+ " -z/--time-cond <time> Includes a time condition to the server (H)\n"
+ " -2/--sslv2 Force usage of SSLv2 (H)\n"
+ " -3/--sslv3 Force usage of SSLv3 (H)\n"
+ " -#/--progress-bar Display transfer progress as a progress bar\n"
+ " --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)\n"
+ " --stderr <file> Where to redirect stderr. - means stdout.\n",
+ curl_version()
+ );
+}
+
+struct LongShort {
+ char *letter;
+ char *lname;
+ bool extraparam;
+};
+
+struct Configurable {
+ char *useragent;
+ char *cookie;
+ bool use_resume;
+ int resume_from;
+ char *postfields;
+ char *referer;
+ long timeout;
+ char *outfile;
+ char *headerfile;
+ char remotefile;
+ char *ftpport;
+ unsigned short porttouse;
+ char *range;
+ int low_speed_limit;
+ int low_speed_time;
+ bool showerror;
+ char *infile;
+ char *userpwd;
+ char *proxyuserpwd;
+ char *proxy;
+ bool configread;
+ long conf;
+ char *url;
+ char *cert;
+ char *cert_passwd;
+ bool crlf;
+ char *cookiefile;
+ char *customrequest;
+ bool progressmode;
+
+ FILE *errors; /* if stderr redirect is requested */
+
+ struct curl_slist *quote;
+
+ long ssl_version;
+ TimeCond timecond;
+ time_t condtime;
+
+ struct HttpHeader *headers;
+ struct HttpHeader *last_header;
+
+ struct HttpPost *httppost;
+ struct HttpPost *last_post;
+};
+
+static int parseconfig(char *filename,
+ struct Configurable *config);
+
+static void GetStr(char **string,
+ char *value)
+{
+ if(*string)
+ free(*string);
+ *string = strdup(value);
+}
+
+static char *file2string(FILE *file)
+{
+ char buffer[256];
+ char *ptr;
+ char *string=NULL;
+ int len=0;
+ int stringlen;
+
+ if(file) {
+ while(fgets(buffer, sizeof(buffer), file)) {
+ ptr= strchr(buffer, '\r');
+ if(ptr)
+ *ptr=0;
+ ptr= strchr(buffer, '\n');
+ if(ptr)
+ *ptr=0;
+ stringlen=strlen(buffer);
+ if(string)
+ string = realloc(string, len+stringlen+1);
+ else
+ string = malloc(stringlen+1);
+
+ strcpy(string+len, buffer);
+
+ len+=stringlen;
+ }
+ return string;
+ }
+ else
+ return NULL; /* no string */
+}
+
+static int getparameter(char *flag, /* f or -long-flag */
+ char *nextarg, /* NULL if unset */
+ bool *usedarg, /* set to TRUE if the arg has been
+ used */
+ struct Configurable *config)
+{
+ char letter;
+ char *parse=NULL;
+ int res;
+ struct HttpHeader *head;
+ int j;
+ time_t now;
+ int hit=-1;
+
+ /* single-letter,
+ long-name,
+ boolean whether it takes an additional argument
+ */
+ struct LongShort aliases[]= {
+ {"9", "crlf", FALSE},
+ {"8", "stderr", TRUE},
+
+ {"2", "sslv2", FALSE},
+ {"3", "sslv3", FALSE},
+ {"a", "append", FALSE},
+ {"A", "user-agent", TRUE},
+ {"b", "cookie", TRUE},
+ {"B", "ftp-ascii", FALSE},
+ {"c", "continue", FALSE},
+ {"C", "continue-at", TRUE},
+ {"d", "data", TRUE},
+ {"D", "dump-header", TRUE},
+ {"e", "referer", TRUE},
+ {"E", "cert", TRUE},
+ {"f", "fail", FALSE},
+ {"F", "form", TRUE},
+
+ {"h", "help", FALSE},
+ {"H", "header", TRUE},
+ {"i", "include", FALSE},
+ {"I", "head", FALSE},
+ {"K", "config", TRUE},
+ {"l", "list-only", FALSE},
+ {"L", "location", FALSE},
+ {"m", "max-time", TRUE},
+ {"M", "manual", FALSE},
+ {"n", "netrc", FALSE},
+ {"o", "output", TRUE},
+ {"O", "remote-name", FALSE},
+#if 0
+ {"p", "port", TRUE},
+#endif
+ {"P", "ftpport", TRUE},
+ {"q", "disable", FALSE},
+ {"Q", "quote", TRUE},
+ {"r", "range", TRUE},
+ {"s", "silent", FALSE},
+ {"S", "show-error", FALSE},
+ {"t", "upload", FALSE},
+ {"T", "upload-file", TRUE},
+ {"u", "user", TRUE},
+ {"U", "proxy-user", TRUE},
+ {"v", "verbose", FALSE},
+ {"V", "version", FALSE},
+ {"x", "proxy", TRUE},
+ {"X", "request", TRUE},
+ {"X", "http-request", TRUE}, /* OBSOLETE VERSION */
+ {"y", "speed-time", TRUE},
+ {"Y", "speed-limit", TRUE},
+ {"z", "time-cond", TRUE},
+ {"#", "progress-bar",FALSE},
+ };
+
+ if('-' == flag[0]) {
+ /* try a long name */
+ int fnam=strlen(&flag[1]);
+ for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) {
+ if(strnequal(aliases[j].lname, &flag[1], fnam)) {
+ if(strequal(aliases[j].lname, &flag[1])) {
+ parse = aliases[j].letter;
+ hit = j;
+ break;
+ }
+ if(parse) {
+ /* this is the second match, we can't continue! */
+ helpf("option --%s is ambiguous\n", &flag[1]);
+ return URG_FAILED_INIT;
+ }
+ parse = aliases[j].letter;
+ hit = j;
+ }
+ }
+ if(hit < 0) {
+ helpf("unknown option -%s.\n", flag);
+ return URG_FAILED_INIT;
+ }
+ }
+ else {
+ hit=-1;
+ parse = flag;
+ }
+
+ do {
+ /* we can loop here if we have multiple single-letters */
+
+ letter = parse?*parse:'\0';
+ *usedarg = FALSE; /* default is that we don't use the arg */
+
+#if 0
+ fprintf(stderr, "OPTION: %c %s\n", letter, nextarg?nextarg:"<null>");
+#endif
+ if(hit < 0) {
+ for(j=0; j< sizeof(aliases)/sizeof(aliases[0]); j++) {
+ if(letter == *aliases[j].letter) {
+ hit = j;
+ break;
+ }
+ }
+ if(hit < 0) {
+ helpf("unknown option -%c.\n", letter);
+ return URG_FAILED_INIT;
+ }
+ }
+ if(hit < 0) {
+ helpf("unknown option -%c.\n", letter);
+ return URG_FAILED_INIT;
+ }
+ if(!nextarg && aliases[hit].extraparam) {
+ helpf("option -%s/--%s requires an extra argument!\n",
+ aliases[hit].letter,
+ aliases[hit].lname);
+ return URG_FAILED_INIT;
+ }
+ else if(nextarg && aliases[hit].extraparam)
+ *usedarg = TRUE; /* mark it as used */
+
+ switch(letter) {
+ case 'z': /* time condition coming up */
+ switch(*nextarg) {
+ case '+':
+ nextarg++;
+ default:
+ /* If-Modified-Since: (section 14.28 in RFC2068) */
+ config->timecond = TIMECOND_IFMODSINCE;
+ break;
+ case '-':
+ /* If-Unmodified-Since: (section 14.24 in RFC2068) */
+ config->timecond = TIMECOND_IFUNMODSINCE;
+ nextarg++;
+ break;
+ case '=':
+ /* Last-Modified: (section 14.29 in RFC2068) */
+ config->timecond = TIMECOND_LASTMOD;
+ nextarg++;
+ break;
+ }
+ now=time(NULL);
+ config->condtime=get_date(nextarg, &now);
+ if(-1 == config->condtime) {
+ /* now let's see if it is a file name to get the time from instead! */
+ struct stat statbuf;
+ if(-1 == stat(nextarg, &statbuf)) {
+ /* failed, remove time condition */
+ config->timecond = TIMECOND_NONE;
+ }
+ else {
+ /* pull the time out from the file */
+ config->condtime = statbuf.st_mtime;
+ }
+ }
+ break;
+ case '9': /* there is no short letter for this */
+ /* LF -> CRLF conversinon? */
+ config->crlf = TRUE;
+ break;
+ case '8': /* there is no short letter for this */
+ if(strcmp(nextarg, "-"))
+ config->errors = fopen(nextarg, "wt");
+ else
+ config->errors = stdout;
+ break;
+ case '#': /* added 19990617 larsa */
+ config->progressmode ^= CURL_PROGRESS_BAR;
+ break;
+ case '2':
+ /* SSL version 2 */
+ config->ssl_version = 2;
+ break;
+ case '3':
+ /* SSL version 2 */
+ config->ssl_version = 3;
+ break;
+ case 'a':
+ /* This makes the FTP sessions use APPE instead of STOR */
+ config->conf ^= CONF_FTPAPPEND;
+ break;
+ case 'A':
+ /* This specifies the User-Agent name */
+ GetStr(&config->useragent, nextarg);
+ break;
+ case 'b': /* cookie string coming up: */
+ if(strchr(nextarg, '=')) {
+ /* A cookie string must have a =-letter */
+ GetStr(&config->cookie, nextarg);
+ }
+ else {
+ /* We have a cookie file to read from! */
+ GetStr(&config->cookiefile, nextarg);
+ }
+ break;
+ case 'B':
+ /* use type ASCII when transfering ftp files */
+ config->conf ^= CONF_FTPASCII;
+ break;
+ case 'c':
+ /* This makes us continue an ftp transfer */
+ config->use_resume^=TRUE;
+ break;
+ case 'C':
+ /* This makes us continue an ftp transfer at given position */
+ config->resume_from= atoi(nextarg);
+ config->use_resume=TRUE;
+ break;
+ case 'd':
+ /* postfield data */
+ if('@' == *nextarg) {
+ /* the data begins with a '@' letter, it means that a file name
+ or - (stdin) follows */
+ FILE *file;
+ nextarg++; /* pass the @ */
+ if(strequal("-", nextarg))
+ file = stdin;
+ else
+ file = fopen(nextarg, "r");
+ config->postfields = file2string(file);
+ if(file && (file != stdin))
+ fclose(stdin);
+ }
+ else {
+ GetStr(&config->postfields, nextarg);
+ }
+ if(config->postfields)
+ config->conf |= CONF_POST;
+ break;
+ case 'D':
+ /* dump-header to given file name */
+ GetStr(&config->headerfile, nextarg);
+ break;
+ case 'e':
+ GetStr(&config->referer, nextarg);
+ config->conf |= CONF_REFERER;
+ break;
+ case 'E':
+ {
+ char *ptr = strchr(nextarg, ':');
+ if(ptr) {
+ /* we have a password too */
+ *ptr=0;
+ ptr++;
+ GetStr(&config->cert_passwd, ptr);
+ }
+ GetStr(&config->cert, nextarg);
+ }
+ break;
+ case 'f':
+ /* fail hard on errors */
+ config->conf ^= CONF_FAILONERROR;
+ break;
+ case 'F':
+ /* "form data" simulation, this is a little advanced so lets do our best
+ to sort this out slowly and carefully */
+ if(curl_FormParse(nextarg,
+ &config->httppost,
+ &config->last_post))
+ return URG_FAILED_INIT;
+ config->conf |= CONF_HTTPPOST; /* no toggle, OR! */
+ break;
+
+ case 'h': /* h for help */
+ help();
+ return URG_FAILED_INIT;
+ case 'H':
+ head = (struct HttpHeader *)malloc(sizeof(struct HttpHeader));
+ if(head) {
+ head->next = NULL;
+ head->header = NULL; /* first zero this */
+ GetStr(&head->header, nextarg); /* now get the header line */
+
+ /* point on our new one */
+ if(config->last_header)
+ config->last_header->next = head;
+ else {
+ config->headers = head;
+ }
+
+ config->last_header = head;
+ }
+ break;
+ case 'i':
+ config->conf ^= CONF_HEADER; /* include the HTTP header as well */
+ break;
+ case 'I':
+ config->conf ^= CONF_HEADER; /* include the HTTP header in the output */
+ config->conf ^= CONF_NOBODY; /* don't fetch the body at all */
+ break;
+ case 'K':
+ res = parseconfig(nextarg, config);
+ config->configread = TRUE;
+ if(res)
+ return res;
+ break;
+ case 'l':
+ config->conf ^= CONF_FTPLISTONLY; /* only list the names of the FTP dir */
+ break;
+ case 'L':
+ config->conf ^= CONF_FOLLOWLOCATION; /* Follow Location: HTTP headers */
+ break;
+ case 'm':
+ /* specified max time */
+ config->timeout = atoi(nextarg);
+ break;
+ case 'M': /* M for manual, huge help */
+ hugehelp();
+ return URG_FAILED_INIT;
+ case 'n':
+ /* pick info from .netrc, if this is used for http, curl will
+ automatically enfore user+password with the request */
+ config->conf ^= CONF_NETRC;
+ break;
+ case 'o':
+ /* output file */
+ GetStr(&config->outfile, nextarg); /* write to this file */
+ break;
+ case 'O':
+ /* output file */
+ config->remotefile ^= TRUE;
+ break;
+ case 'P':
+ /* This makes the FTP sessions use PORT instead of PASV */
+ /* use <eth0> or <192.168.10.10> style addresses. Anything except
+ this will make us try to get the "default" address.
+ NOTE: this is a changed behaviour since the released 4.1!
+ */
+ config->conf |= CONF_FTPPORT;
+ GetStr(&config->ftpport, nextarg);
+ break;
+#if 0
+ case 'p':
+ /* specified port */
+ fputs("You've used the -p option, it will be removed in a future version\n",
+ stderr);
+ config->porttouse = atoi(nextarg);
+ config->conf |= CONF_PORT; /* changed port */
+ break;
+#endif
+ case 'q': /* if used first, already taken care of, we do it like
+ this so we don't cause an error! */
+ break;
+ case 'Q':
+ /* QUOTE command to send to FTP server */
+ config->quote = curl_slist_append(config->quote, nextarg);
+ break;
+ case 'r':
+ /* byte range requested */
+ GetStr(&config->range, nextarg);
+ config->conf |= CONF_RANGE;
+ break;
+ case 's':
+ /* don't show progress meter, don't show errors : */
+ config->conf |= (CONF_MUTE|CONF_NOPROGRESS);
+ config->showerror ^= TRUE; /* toggle off */
+ break;
+ case 'S':
+ /* show errors */
+ config->showerror ^= TRUE; /* toggle on if used with -s */
+ break;
+ case 't':
+ /* we are uploading */
+ config->conf ^= CONF_UPLOAD;
+ break;
+ case 'T':
+ /* we are uploading */
+ config->conf |= CONF_UPLOAD;
+ GetStr(&config->infile, nextarg);
+ break;
+ case 'u':
+ /* user:password */
+ GetStr(&config->userpwd, nextarg);
+ config->conf |= CONF_USERPWD;
+ break;
+ case 'U':
+ /* Proxy user:password */
+ GetStr(&config->proxyuserpwd, nextarg);
+ config->conf |= CONF_PROXYUSERPWD;
+ break;
+ case 'v':
+ config->conf ^= CONF_VERBOSE; /* talk a lot */
+ break;
+ case 'V':
+ printf(CURL_ID "%s\n", curl_version());
+ return URG_FAILED_INIT;
+ case 'x':
+ /* proxy */
+ if(!*nextarg) {
+ /* disable proxy when no proxy is given */
+ config->conf &= ~CONF_PROXY;
+ }
+ else {
+ config->conf |= CONF_PROXY;
+ GetStr(&config->proxy, nextarg);
+ }
+ break;
+ case 'X':
+ /* HTTP request */
+ GetStr(&config->customrequest, nextarg);
+ break;
+ case 'Y':
+ /* low speed time */
+ config->low_speed_time = atoi(nextarg);
+ if(!config->low_speed_limit)
+ config->low_speed_limit = 1;
+ break;
+ case 'y':
+ /* low speed limit */
+ config->low_speed_limit = atoi(nextarg);
+ if(!config->low_speed_time)
+ config->low_speed_time=30;
+ break;
+
+ default: /* unknown flag */
+ if(letter)
+ helpf("Unknown option '%c'\n", letter);
+ else
+ helpf("Unknown option\n"); /* short help blurb */
+ return URG_FAILED_INIT;
+ }
+ hit = -1;
+
+ } while(*++parse && !*usedarg);
+
+ return URG_OK;
+}
+
+
+static int parseconfig(char *filename,
+ struct Configurable *config)
+{
+ int res;
+ FILE *file;
+ char configbuffer[4096];
+ char filebuffer[256];
+ bool usedarg;
+
+ if(!filename || !*filename) {
+ /* NULL or no file name attempts to load .curlrc from the homedir! */
+
+#define CURLRC DOT_CHAR "curlrc"
+
+ char *home = curl_GetEnv("HOME"); /* portable environment reader */
+
+ if(!home || (strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))))
+ return URG_OK;
+
+ sprintf(filebuffer, "%s%s%s", home, DIR_CHAR, CURLRC);
+
+ filename = filebuffer;
+ }
+
+ if(strcmp(filename,"-"))
+ file = fopen(filename, "r");
+ else
+ file = stdin;
+
+ if(file) {
+ char *tok;
+ char *tok2;
+ while(fgets(configbuffer, sizeof(configbuffer), file)) {
+ /* lines with # in the fist column is a comment! */
+
+#if 0
+ fprintf(stderr, "%s", configbuffer);
+#endif
+ if('#' == configbuffer[0])
+ continue;
+ tok = configbuffer;
+
+ while(*tok && isspace((int)*tok))
+ tok++;
+/* tok=strtok(configbuffer, " \t\n"); */
+#if 0
+ fprintf(stderr, "TOK: %s\n", tok);
+#endif
+ if('-' != tok[0]) {
+ char *nl;
+ if(config->url)
+ free(config->url);
+ config->url = strdup(tok);
+ nl = strchr(config->url, '\n');
+ if(nl)
+ *nl=0;
+ }
+ while(('-' == tok[0])) {
+ /* this is a flag */
+ char *firsttok = strdup(tok);
+ char *nl;
+
+ /* remove newline from firsttok */
+ nl = strchr(firsttok, '\n');
+ if(nl)
+ *nl=0;
+
+ /* pass the -flag */
+ tok2=tok;
+ while(*tok2 && !isspace((int)*tok2))
+ tok2++;
+
+ /* pass the following white space */
+ while(*tok2 && isspace((int)*tok2))
+ tok2++;
+
+ while(!*tok2 &&
+ fgets(configbuffer, sizeof(configbuffer), file)) {
+ /* lines with # in the fist column is a comment! */
+#if 0
+ fprintf(stderr, "%s", configbuffer);
+#endif
+ if('#' == configbuffer[0])
+ continue;
+ tok2 = configbuffer;
+ /* tok2=strtok(configbuffer, " \t\n"); */
+ /* pass white space */
+ while(*tok2 && isspace((int)*tok2))
+ tok2++;
+ }
+ /* remove newline from tok2 */
+ nl = strchr(tok2, '\n');
+ if(nl)
+ *nl=0;
+
+ res = getparameter(firsttok+1,
+ *tok2?tok2:NULL,
+ &usedarg,
+ config);
+ free(firsttok);
+#if 0
+ fprintf(stderr, "TOK %s TOK2: %s RES: %d\n",
+ firsttok, tok2?tok2:"NULL", res);
+#endif
+ if(res)
+ return res;
+ if(!usedarg) {
+ /* tok2 is unused, */
+ tok = tok2;
+ }
+ else
+ break; /* we've used both our words */
+ }
+ }
+ if(file != stdin)
+ fclose(file);
+ }
+ return URG_OK;
+}
+
+struct OutStruct {
+ char *filename;
+ FILE *stream;
+};
+
+int my_fwrite(void *buffer, size_t size, size_t nmemb, FILE *stream)
+{
+ struct OutStruct *out=(struct OutStruct *)stream;
+ if(out && !out->stream) {
+ /* open file for writing */
+ out->stream=fopen(out->filename, "wb");
+ if(!out->stream)
+ return -1; /* failure */
+ }
+ return fwrite(buffer, size, nmemb, out->stream);
+}
+
+
+int main(int argc, char *argv[])
+{
+ char errorbuffer[URLGET_ERROR_SIZE];
+
+ struct OutStruct outs;
+
+ char *url = NULL;
+#ifdef GLOBURL
+ URLGlob *urls;
+ int urlnum;
+ char *outfiles = NULL;
+ int separator = 0;
+#endif
+
+ FILE *infd = stdin;
+ FILE *headerfilep = NULL;
+ char *urlbuffer=NULL;
+ int infilesize=-1; /* -1 means unknown */
+ bool stillflags=TRUE;
+
+ int res=URG_OK;
+ int i;
+ struct Configurable config;
+
+ outs.stream = stdout;
+
+ memset(&config, 0, sizeof(struct Configurable));
+
+ /* set non-zero default values: */
+ config.useragent= maprintf(CURL_NAME "/" CURL_VERSION " (" OS ") "
+ "%s", curl_version());
+ config.showerror=TRUE;
+ config.conf=CONF_DEFAULT;
+ config.crlf=FALSE;
+ config.quote=NULL;
+
+ if(argc>1 &&
+ (!strnequal("--", argv[1], 2) && (argv[1][0] == '-')) &&
+ strchr(argv[1], 'q')) {
+ /*
+ * The first flag, that is not a verbose name, but a shortname
+ * and it includes the 'q' flag!
+ */
+#if 0
+ fprintf(stderr, "I TURNED OFF THE CRAP\n");
+#endif
+ ;
+ }
+ else {
+ res = parseconfig(NULL, &config);
+ if(res)
+ return res;
+ }
+
+ if ((argc < 2) && !config.url) {
+ helpf(NULL);
+ return URG_FAILED_INIT;
+ }
+
+ /* Parse options */
+ for (i = 1; i < argc; i++) {
+ if(stillflags &&
+ ('-' == argv[i][0])) {
+ char *nextarg;
+ bool passarg;
+
+ char *flag = &argv[i][1];
+
+ if(strequal("--", argv[i]))
+ /* this indicates the end of the flags and thus enables the
+ following (URL) argument to start with -. */
+ stillflags=FALSE;
+ else {
+ nextarg= (i < argc - 1)? argv[i+1]: NULL;
+
+ res = getparameter ( flag,
+ nextarg,
+ &passarg,
+ &config );
+ if(res)
+ return res;
+
+ if(passarg) /* we're supposed to skip this */
+ i++;
+ }
+ }
+ else {
+ if(url) {
+ helpf("only one URL is supported!\n");
+ return URG_FAILED_INIT;
+ }
+ url = argv[i];
+ }
+ }
+
+ /* if no URL was specified and there was one in the config file, get that
+ one */
+ if(!url && config.url)
+ url = config.url;
+
+ if(!url) {
+ helpf("no URL specified!\n");
+ return URG_FAILED_INIT;
+ }
+#if 0
+ fprintf(stderr, "URL: %s PROXY: %s\n", url, config.proxy?config.proxy:"none");
+#endif
+
+#ifdef GLOBURL
+ urlnum = glob_url(&urls, url); /* expand '{...}' and '[...]' expressions and return
+ total number of URLs in pattern set */
+ outfiles = config.outfile; /* save outfile pattern befor expansion */
+ if (!outfiles && !config.remotefile && urlnum > 1) {
+#ifdef CURL_SEPARATORS
+ /* multiple files extracted to stdout, insert separators! */
+ separator = 1;
+#endif
+#ifdef MIME_SEPARATORS
+ /* multiple files extracted to stdout, insert MIME separators! */
+ separator = 1;
+ printf("MIME-Version: 1.0\n");
+ printf("Content-Type: multipart/mixed; boundary=%s\n\n", MIMEseparator);
+#endif
+ }
+ for (i = 0; (url = next_url(urls)); ++i) {
+ if (outfiles)
+ config.outfile = strdup(outfiles);
+#endif
+
+ if(config.outfile && config.infile) {
+ helpf("you can't both upload and download!\n");
+ return URG_FAILED_INIT;
+ }
+
+ if (config.outfile || config.remotefile) {
+ /*
+ * We have specified a file name to store the result in, or we have
+ * decided we want to use the remote file name.
+ */
+
+ if(config.remotefile) {
+ /* Find and get the remote file name */
+ config.outfile=strstr(url, "://");
+ if(config.outfile)
+ config.outfile+=3;
+ else
+ config.outfile=url;
+ config.outfile = strrchr(config.outfile, '/');
+ if(!config.outfile || !strlen(++config.outfile)) {
+ helpf("Remote file name has no length!\n");
+ return URG_WRITE_ERROR;
+ }
+ }
+#ifdef GLOBURL
+ else /* fill '#1' ... '#9' terms from URL pattern */
+ config.outfile = match_url(config.outfile, *urls);
+#endif
+
+ if((0 == config.resume_from) && config.use_resume) {
+ /* we're told to continue where we are now, then we get the size of the
+ file as it is now and open it for append instead */
+ struct stat fileinfo;
+
+ if(0 == stat(config.outfile, &fileinfo)) {
+ /* set offset to current file size: */
+ config.resume_from = fileinfo.st_size;
+ }
+ /* else let offset remain 0 */
+ }
+
+ if(config.resume_from) {
+ /* open file for output: */
+ outs.stream=(FILE *) fopen(config.outfile, config.resume_from?"ab":"wb");
+ if (!outs.stream) {
+ helpf("Can't open '%s'!\n", config.outfile);
+ return URG_WRITE_ERROR;
+ }
+ }
+ else {
+ outs.filename = config.outfile;
+ outs.stream = NULL; /* open when needed */
+ }
+ }
+ if (config.infile) {
+ /*
+ * We have specified a file to upload
+ */
+ struct stat fileinfo;
+
+ /* If no file name part is given in the URL, we add this file name */
+ char *ptr=strstr(url, "://");
+ if(ptr)
+ ptr+=3;
+ else
+ ptr=url;
+ ptr = strrchr(ptr, '/');
+ if(!ptr || !strlen(++ptr)) {
+ /* The URL has no file name part, add the local file name. In order
+ to be able to do so, we have to create a new URL in another buffer.*/
+ urlbuffer=(char *)malloc(strlen(url) + strlen(config.infile) + 3);
+ if(!urlbuffer) {
+ helpf("out of memory\n");
+ return URG_OUT_OF_MEMORY;
+ }
+ if(ptr)
+ /* there is a trailing slash on the URL */
+ sprintf(urlbuffer, "%s%s", url, config.infile);
+ else
+ /* thers is no trailing slash on the URL */
+ sprintf(urlbuffer, "%s/%s", url, config.infile);
+
+ url = urlbuffer; /* use our new URL instead! */
+ }
+
+ infd=(FILE *) fopen(config.infile, "rb");
+ if (!infd || stat(config.infile, &fileinfo)) {
+ helpf("Can't open '%s'!\n", config.infile);
+ return URG_READ_ERROR;
+ }
+ infilesize=fileinfo.st_size;
+
+ }
+ if((config.conf&CONF_UPLOAD) &&
+ config.use_resume &&
+ (0==config.resume_from)) {
+ config.resume_from = -1; /* -1 will then force get-it-yourself */
+ }
+ if(config.headerfile) {
+ /* open file for output: */
+ if(strcmp(config.headerfile,"-"))
+ {
+ headerfilep=(FILE *) fopen(config.headerfile, "wb");
+ if (!headerfilep) {
+ helpf("Can't open '%s'!\n", config.headerfile);
+ return URG_WRITE_ERROR;
+ }
+ }
+ else
+ headerfilep=stdout;
+ }
+
+ /* This was previously done in urlget, but that was wrong place to do it */
+ if(outs.stream && isatty(fileno(outs.stream)))
+ /* we send the output to a tty, and therefor we switch off the progress
+ meter right away */
+ config.conf |= CONF_NOPROGRESS;
+
+#ifdef GLOBURL
+ if (urlnum > 1) {
+ fprintf(stderr, "\n[%d/%d]: %s --> %s\n", i+1, urlnum, url, config.outfile ? config.outfile : "<stdout>");
+ if (separator) {
+#ifdef CURL_SEPARATORS
+ printf("%s%s\n", CURLseparator, url);
+#endif
+#ifdef MIME_SEPARATORS
+ printf("--%s\n", MIMEseparator);
+ printf("Content-ID: %s\n\n", url);
+#endif
+ }
+ }
+#endif
+
+ if(!config.errors)
+ config.errors = stderr;
+
+ res = curl_urlget(URGTAG_FILE, (FILE *)&outs, /* where to store */
+ URGTAG_WRITEFUNCTION, my_fwrite, /* what call to write */
+ URGTAG_INFILE, infd, /* for uploads */
+ URGTAG_INFILESIZE, infilesize, /* size of uploaded file */
+ URGTAG_URL, url, /* what to fetch */
+ URGTAG_PROXY, config.proxy, /* proxy to use */
+ URGTAG_FLAGS, config.conf, /* flags */
+ URGTAG_USERPWD, config.userpwd, /* user + passwd */
+ URGTAG_PROXYUSERPWD, config.proxyuserpwd, /* Proxy user + passwd */
+ URGTAG_RANGE, config.range, /* range of document */
+ URGTAG_ERRORBUFFER, errorbuffer,
+ URGTAG_TIMEOUT, config.timeout,
+ URGTAG_POSTFIELDS, config.postfields,
+ URGTAG_REFERER, config.referer,
+ URGTAG_USERAGENT, config.useragent,
+ URGTAG_FTPPORT, config.ftpport,
+ URGTAG_LOW_SPEED_LIMIT, config.low_speed_limit,
+ URGTAG_LOW_SPEED_TIME, config.low_speed_time,
+ URGTAG_RESUME_FROM, config.use_resume?config.resume_from:0,
+ URGTAG_COOKIE, config.cookie,
+ URGTAG_HTTPHEADER, config.headers,
+ URGTAG_HTTPPOST, config.httppost,
+ URGTAG_SSLCERT, config.cert,
+ URGTAG_SSLCERTPASSWD, config.cert_passwd,
+ URGTAG_CRLF, config.crlf,
+ URGTAG_QUOTE, config.quote,
+ URGTAG_WRITEHEADER, headerfilep,
+ URGTAG_COOKIEFILE, config.cookiefile,
+ URGTAG_SSLVERSION, config.ssl_version,
+ URGTAG_TIMECONDITION, config.timecond,
+ URGTAG_TIMEVALUE, config.condtime,
+ URGTAG_CUSTOMREQUEST, config.customrequest,
+ URGTAG_STDERR, config.errors,
+ URGTAG_DONE); /* always terminate the list of tags */
+ if((res!=URG_OK) && config.showerror)
+ fprintf(config.errors, "curl: (%d) %s\n", res, errorbuffer);
+
+ if((config.errors != stderr) &&
+ (config.errors != stdout))
+ /* it wasn't directed to stdout or stderr so close the file! */
+ fclose(config.errors);
+
+ if(urlbuffer)
+ free(urlbuffer);
+ if (config.outfile && outs.stream)
+ fclose(outs.stream);
+ if (config.infile)
+ fclose(infd);
+ if(headerfilep)
+ fclose(headerfilep);
+
+ if(config.url)
+ free(config.url);
+
+#ifdef GLOBURL
+ if(url)
+ free(url);
+ if(config.outfile && !config.remotefile)
+ free(config.outfile);
+ }
+#ifdef MIME_SEPARATORS
+ if (separator)
+ printf("--%s--\n", MIMEseparator);
+#endif
+#endif
+
+ curl_slist_free_all(config.quote); /* the checks for config.quote == NULL */
+
+ return(res);
+}
diff --git a/src/mkhelp.pl b/src/mkhelp.pl
new file mode 100644
index 000000000..842a42f59
--- /dev/null
+++ b/src/mkhelp.pl
@@ -0,0 +1,85 @@
+#!/usr/local/bin/perl
+
+# Yeah, I know, probably 1000 other persons already wrote a script like
+# this, but I'll tell ya:
+
+# THEY DON'T FIT ME :-)
+
+# Get readme file as parameter:
+$README = $ARGV[0];
+
+if($README eq "") {
+ print "usage: mkreadme.pl <README>\n";
+ exit;
+}
+
+
+push @out, " _ _ ____ _ \n";
+push @out, " Project ___| | | | _ \\| | \n";
+push @out, " / __| | | | |_) | | \n";
+push @out, " | (__| |_| | _ <| |___ \n";
+push @out, " \\___|\\___/|_| \\_\\_____|\n";
+
+$head=0;
+loop:
+while (<STDIN>) {
+ $line = $_;
+
+ # this kind should be removed first:
+ $line =~ s/_//g;
+
+ # then this:
+ $line =~ s/.//g;
+
+ if($line =~ /^curl/i) {
+ # cut off the page headers
+ $head=1;
+ next loop;
+ }
+
+ if($line =~ /^[ \t]*\n/) {
+ $wline++;
+ # we only make one empty line max
+ next loop;
+ }
+ if($wline) {
+ $wline = 0;
+ if(!$head) {
+ push @out, "\n";
+ }
+ $head =0;
+ }
+ push @out, $line;
+}
+push @out, "\n"; # just an extra newline
+
+open(READ, "<$README") ||
+ die "couldn't read the README infile";
+
+while(<READ>) {
+ push @out, $_;
+}
+close(READ);
+
+
+print "/* NEVER EVER edit this manually, fix the mkhelp script instead! */\n"
+;
+print "#include <stdio.h>\n";
+print "void hugehelp(void)\n";
+print "{\n";
+print "puts (\n";
+
+for(@out) {
+ chop;
+
+ $new = $_;
+
+ $new =~ s/\\/\\\\/g;
+ $new =~ s/\"/\\\"/g;
+
+ printf("\"%s\\n\"\n", $new);
+
+}
+
+print " ) ;\n}\n"
+
diff --git a/src/setup.h b/src/setup.h
new file mode 100644
index 000000000..78103f9ce
--- /dev/null
+++ b/src/setup.h
@@ -0,0 +1,91 @@
+#ifndef __SETUP_H
+#define __SETUP_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+
+#if !defined(WIN32) && defined(_WIN32)
+/* This _might_ be a good Borland fix. Please report whether this works or
+ not! */
+#define WIN32
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h" /* the configure script results */
+#else
+#ifdef WIN32
+/* include the hand-modified win32 adjusted config.h! */
+#include "config-win32.h"
+#endif
+#endif
+
+#ifndef OS
+#define OS "unknown"
+#endif
+
+#ifdef HAVE_STRCASECMP
+#define strnequal(x,y,z) !(strncasecmp)(x,y,z)
+#define strequal(x,y) !(strcasecmp)(x,y)
+
+/* this is for "-ansi -Wall -pedantic" to stop complaining! */
+extern int (strcasecmp)(const char *s1, const char *s2);
+extern int (strncasecmp)(const char *s1, const char *s2, size_t n);
+#ifndef fileno /* sunos 4 have this as a macro! */
+int fileno( FILE *stream);
+#endif
+
+#else
+#define strnequal(x,y,z) !strnicmp(x,y,z)
+#define strequal(x,y) !stricmp(x,y)
+#endif
+
+#ifdef WIN32
+#define PATH_CHAR ";"
+#define DIR_CHAR "\\"
+#define DOT_CHAR "_"
+#else
+#define PATH_CHAR ":"
+#define DIR_CHAR "/"
+#define DOT_CHAR "."
+
+#endif
+
+#endif /* __SETUP_H */
diff --git a/src/stamp-h2 b/src/stamp-h2
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/src/stamp-h2
@@ -0,0 +1 @@
+timestamp
diff --git a/src/stamp-h2.in b/src/stamp-h2.in
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/src/stamp-h2.in
@@ -0,0 +1 @@
+timestamp
diff --git a/src/urlglob.c b/src/urlglob.c
new file mode 100644
index 000000000..846f86c2f
--- /dev/null
+++ b/src/urlglob.c
@@ -0,0 +1,332 @@
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <curl/curl.h>
+#include "urlglob.h"
+
+char glob_buffer[URL_MAX_LENGTH];
+URLGlob *glob_expand;
+
+int glob_word(char*, int);
+
+int glob_set(char *pattern, int pos) {
+ /* processes a set expression with the point behind the opening '{'
+ ','-separated elements are collected until the next closing '}'
+ */
+ char* buf = glob_buffer;
+ URLPattern *pat;
+
+ pat = (URLPattern*)&glob_expand->pattern[glob_expand->size / 2];
+ /* patterns 0,1,2,... correspond to size=1,3,5,... */
+ pat->type = UPTSet;
+ pat->content.Set.size = 0;
+ pat->content.Set.ptr_s = 0;
+ pat->content.Set.elements = (char**)malloc(0);
+ ++glob_expand->size;
+
+ while (1) {
+ switch (*pattern) {
+ case '\0': /* URL ended while set was still open */
+ printf("error: unmatched brace at pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ case '{':
+ case '[': /* no nested expressions at this time */
+ printf("error: nested braces not supported %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ case ',':
+ case '}': /* set element completed */
+ *buf = '\0';
+ pat->content.Set.elements = realloc(pat->content.Set.elements, (pat->content.Set.size + 1) * sizeof(char*));
+ if (!pat->content.Set.elements) {
+ printf("out of memory in set pattern\n");
+ exit(URG_OUT_OF_MEMORY);
+ }
+ pat->content.Set.elements[pat->content.Set.size] = strdup(glob_buffer);
+ ++pat->content.Set.size;
+
+ if (*pattern == '}') /* entire set pattern completed */
+ /* always check for a literal (may be "") between patterns */
+ return pat->content.Set.size * glob_word(++pattern, ++pos);
+
+ buf = glob_buffer;
+ ++pattern;
+ ++pos;
+ break;
+ case ']': /* illegal closing bracket */
+ printf("error: illegal pattern at pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ case '\\': /* escaped character, skip '\' */
+ if (*(buf+1) == '\0') { /* but no escaping of '\0'! */
+ printf("error: illegal pattern at pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ }
+ ++pattern;
+ ++pos; /* intentional fallthrough */
+ default:
+ *buf++ = *pattern++; /* copy character to set element */
+ ++pos;
+ }
+ }
+ exit (URG_FAILED_INIT);
+}
+
+int glob_range(char *pattern, int pos) {
+ /* processes a range expression with the point behind the opening '['
+ - char range: e.g. "a-z]", "B-Q]"
+ - num range: e.g. "0-9]", "17-2000]"
+ - num range with leading zeros: e.g. "001-999]"
+ expression is checked for well-formedness and collected until the next ']'
+ */
+ URLPattern *pat;
+ char *c;
+
+ pat = (URLPattern*)&glob_expand->pattern[glob_expand->size / 2];
+ /* patterns 0,1,2,... correspond to size=1,3,5,... */
+ ++glob_expand->size;
+
+ if (isalpha((int)*pattern)) { /* character range detected */
+ pat->type = UPTCharRange;
+ if (sscanf(pattern, "%c-%c]", &pat->content.CharRange.min_c, &pat->content.CharRange.max_c) != 2 ||
+ pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
+ pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') {
+ /* the pattern is not well-formed */
+ printf("error: illegal pattern or range specification after pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ }
+ pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
+ /* always check for a literal (may be "") between patterns */
+ return (pat->content.CharRange.max_c - pat->content.CharRange.min_c + 1) *
+ glob_word(pattern + 4, pos + 4);
+ }
+ if (isdigit((int)*pattern)) { /* numeric range detected */
+ pat->type = UPTNumRange;
+ pat->content.NumRange.padlength = 0;
+ if (sscanf(pattern, "%d-%d]", &pat->content.NumRange.min_n, &pat->content.NumRange.max_n) != 2 ||
+ pat->content.NumRange.min_n >= pat->content.NumRange.max_n) {
+ /* the pattern is not well-formed */
+ printf("error: illegal pattern or range specification after pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ }
+ if (*pattern == '0') { /* leading zero specified */
+ c = pattern;
+ while (isdigit((int)*c++))
+ ++pat->content.NumRange.padlength; /* padding length is set for all instances
+ of this pattern */
+ }
+ pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
+ c = (char*)(strchr(pattern, ']') + 1); /* continue after next ']' */
+ /* always check for a literal (may be "") between patterns */
+ return (pat->content.NumRange.max_n - pat->content.NumRange.min_n + 1) *
+ glob_word(c, pos + (c - pattern));
+ }
+ printf("error: illegal character in range specification at pos %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+}
+
+int glob_word(char *pattern, int pos) {
+ /* processes a literal string component of a URL
+ special characters '{' and '[' branch to set/range processing functions
+ */
+ char* buf = glob_buffer;
+ int litindex;
+
+ while (*pattern != '\0' && *pattern != '{' && *pattern != '[') {
+ if (*pattern == '}' || *pattern == ']') {
+ printf("illegal character at position %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ }
+ if (*pattern == '\\') { /* escape character, skip '\' */
+ ++pattern;
+ ++pos;
+ if (*pattern == '\0') { /* but no escaping of '\0'! */
+ printf("illegal character at position %d\n", pos);
+ exit (URG_URL_MALFORMAT);
+ }
+ }
+ *buf++ = *pattern++; /* copy character to literal */
+ ++pos;
+ }
+ *buf = '\0';
+ litindex = glob_expand->size / 2;
+ /* literals 0,1,2,... correspond to size=0,2,4,... */
+ glob_expand->literal[litindex] = strdup(glob_buffer);
+ ++glob_expand->size;
+ if (*pattern == '\0')
+ return 1; /* singular URL processed */
+ if (*pattern == '{') {
+ return glob_set(++pattern, ++pos); /* process set pattern */
+ }
+ if (*pattern == '[') {
+ return glob_range(++pattern, ++pos);/* process range pattern */
+ }
+ printf("internal error\n");
+ exit (URG_FAILED_INIT);
+}
+
+int glob_url(URLGlob** glob, char* url) {
+ int urlnum; /* counts instances of a globbed pattern */
+
+ glob_expand = (URLGlob*)malloc(sizeof(URLGlob));
+ glob_expand->size = 0;
+ urlnum = glob_word(url, 1);
+ *glob = glob_expand;
+ return urlnum;
+}
+
+char *next_url(URLGlob *glob) {
+ static int beenhere = 0;
+ char *buf = glob_buffer;
+ URLPattern *pat;
+ char *lit;
+ signed int i;
+ int carry;
+
+ if (!beenhere)
+ beenhere = 1;
+ else {
+ carry = 1;
+
+ /* implement a counter over the index ranges of all patterns,
+ starting with the rightmost pattern */
+ for (i = glob->size / 2 - 1; carry && i >= 0; --i) {
+ carry = 0;
+ pat = &glob->pattern[i];
+ switch (pat->type) {
+ case UPTSet:
+ if (++pat->content.Set.ptr_s == pat->content.Set.size) {
+ pat->content.Set.ptr_s = 0;
+ carry = 1;
+ }
+ break;
+ case UPTCharRange:
+ if (++pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {
+ pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
+ carry = 1;
+ }
+ break;
+ case UPTNumRange:
+ if (++pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) {
+ pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
+ carry = 1;
+ }
+ break;
+ default:
+ printf("internal error: invalid pattern type (%d)\n", pat->type);
+ exit (URG_FAILED_INIT);
+ }
+ }
+ if (carry) /* first pattern ptr has run into overflow, done! */
+ return NULL;
+ }
+
+ for (i = 0; i < glob->size; ++i) {
+ if (!(i % 2)) { /* every other term (i even) is a literal */
+ lit = glob->literal[i/2];
+ strcpy(buf, lit);
+ buf += strlen(lit);
+ }
+ else { /* the rest (i odd) are patterns */
+ pat = &glob->pattern[i/2];
+ switch(pat->type) {
+ case UPTSet:
+ strcpy(buf, pat->content.Set.elements[pat->content.Set.ptr_s]);
+ buf += strlen(pat->content.Set.elements[pat->content.Set.ptr_s]);
+ break;
+ case UPTCharRange:
+ *buf++ = pat->content.CharRange.ptr_c;
+ break;
+ case UPTNumRange:
+ buf += sprintf(buf, "%0*d", pat->content.NumRange.padlength, pat->content.NumRange.ptr_n);
+ break;
+ default:
+ printf("internal error: invalid pattern type (%d)\n", pat->type);
+ exit (URG_FAILED_INIT);
+ }
+ }
+ }
+ *buf = '\0';
+ return strdup(glob_buffer);
+}
+
+char *match_url(char *filename, URLGlob glob) {
+ char *buf = glob_buffer;
+ URLPattern pat;
+ int i;
+
+ while (*filename != '\0') {
+ if (*filename == '#') {
+ if (!isdigit((int)*++filename) ||
+ *filename == '0') { /* only '#1' ... '#9' allowed */
+ printf("illegal matching expression\n");
+ exit(URG_URL_MALFORMAT);
+ }
+ i = *filename - '1';
+ if (i + 1 > glob.size / 2) {
+ printf("match against nonexisting pattern\n");
+ exit(URG_URL_MALFORMAT);
+ }
+ pat = glob.pattern[i];
+ switch (pat.type) {
+ case UPTSet:
+ strcpy(buf, pat.content.Set.elements[pat.content.Set.ptr_s]);
+ buf += strlen(pat.content.Set.elements[pat.content.Set.ptr_s]);
+ break;
+ case UPTCharRange:
+ *buf++ = pat.content.CharRange.ptr_c;
+ break;
+ case UPTNumRange:
+ buf += sprintf(buf, "%0*d", pat.content.NumRange.padlength, pat.content.NumRange.ptr_n);
+ break;
+ default:
+ printf("internal error: invalid pattern type (%d)\n", pat.type);
+ exit (URG_FAILED_INIT);
+ }
+ ++filename;
+ }
+ else
+ *buf++ = *filename++;
+ }
+ *buf = '\0';
+ return strdup(glob_buffer);
+}
diff --git a/src/urlglob.h b/src/urlglob.h
new file mode 100644
index 000000000..dc52371ee
--- /dev/null
+++ b/src/urlglob.h
@@ -0,0 +1,74 @@
+#ifndef __URLGLOB_H
+#define __URLGLOB_H
+/*****************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is Curl.
+ *
+ * The Initial Developer of the Original Code is Daniel Stenberg.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 1998.
+ * All Rights Reserved.
+ *
+ * ------------------------------------------------------------
+ * Main author:
+ * - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
+ *
+ * http://curl.haxx.nu
+ *
+ * $Source$
+ * $Revision$
+ * $Date$
+ * $Author$
+ * $State$
+ * $Locker$
+ *
+ * ------------------------------------------------------------
+ ****************************************************************************/
+typedef enum {UPTSet=1,UPTCharRange,UPTNumRange} URLPatternType;
+
+typedef struct {
+ URLPatternType type;
+ union {
+ struct {
+ char **elements;
+ short size;
+ short ptr_s;
+ } Set;
+ struct {
+ char min_c, max_c;
+ char ptr_c;
+ } CharRange;
+ struct {
+ int min_n, max_n;
+ short padlength;
+ int ptr_n;
+ } NumRange ;
+ } content;
+} URLPattern;
+
+typedef struct {
+ char* literal[10];
+ URLPattern pattern[9];
+ int size;
+} URLGlob;
+
+int glob_url(URLGlob**, char*);
+char* next_url(URLGlob*);
+char* match_url(char*, URLGlob);
+
+#endif
diff --git a/src/version.h b/src/version.h
new file mode 100644
index 000000000..65ec2d1ef
--- /dev/null
+++ b/src/version.h
@@ -0,0 +1,3 @@
+#define CURL_NAME "curl"
+#define CURL_VERSION "6.3.1"
+#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
diff --git a/stamp-h b/stamp-h
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/stamp-h
@@ -0,0 +1 @@
+timestamp
diff --git a/stamp-h.in b/stamp-h.in
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/stamp-h.in
@@ -0,0 +1 @@
+timestamp
diff --git a/stamp-h1 b/stamp-h1
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/stamp-h1
@@ -0,0 +1 @@
+timestamp
diff --git a/stamp-h1.in b/stamp-h1.in
new file mode 100644
index 000000000..9788f7023
--- /dev/null
+++ b/stamp-h1.in
@@ -0,0 +1 @@
+timestamp