Initial revision

This commit is contained in:
Daniel Stenberg 1999-12-29 14:20:26 +00:00
commit ae1912cb0d
144 changed files with 37273 additions and 0 deletions

1656
CHANGES Normal file

File diff suppressed because it is too large Load Diff

68
CONTRIBUTE Normal file
View File

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

31
FAQ Normal file
View File

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

72
FEATURES Normal file
View File

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

47
FILES Normal file
View File

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

195
INSTALL Normal file
View File

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

21
LEGAL Normal file
View File

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

360
MPL-1.0.txt Normal file
View File

@ -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): ______________________________________.''

426
Makefile Normal file
View File

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

13
Makefile.am Normal file
View File

@ -0,0 +1,13 @@
#
# $Id$
#
AUTOMAKE_OPTIONS = foreign no-dependencies
man_MANS = curl.1
EXTRA_DIST = $(man_MANS)
SUBDIRS = lib src

78
Makefile.dist Normal file
View File

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

426
Makefile.in Normal file
View File

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

28
README Normal file
View File

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

611
README.curl Normal file
View File

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

108
README.libcurl Normal file
View File

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

62
RESOURCES Normal file
View File

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

87
TODO Normal file
View File

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

12
acconfig.h Normal file
View File

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

127
aclocal.m4 vendored Normal file
View File

@ -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)])

168
config-win32.h Normal file
View File

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

86
config.cache Normal file
View File

@ -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'}

997
config.guess vendored Executable file
View File

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

900
config.guess-991124 Executable file
View File

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

220
config.h Normal file
View File

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

219
config.h.in Normal file
View File

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

90
config.log Normal file
View File

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

492
config.status Executable file
View File

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

979
config.sub vendored Executable file
View File

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

952
config.sub-991124 Executable file
View File

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

3091
configure vendored Executable file

File diff suppressed because it is too large Load Diff

210
configure.in Normal file
View File

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

BIN
curl-6.3.1.tar.gz Normal file

Binary file not shown.

52
curl-ssl.spec Normal file
View File

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

402
curl.1 Normal file
View File

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

695
curl.beos-patch Normal file
View File

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

52
curl.spec Normal file
View File

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

1265
curl_631_general.patch Normal file

File diff suppressed because it is too large Load Diff

92
curl_63_form.patch Normal file
View File

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

106
curl_63_partialdl.patch Normal file
View File

@ -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!");

7
head Normal file
View File

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

15
include/README Normal file
View File

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

View File

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

434
include/curl/curl.h Normal file
View File

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

0
include/curl/getdate.h Normal file
View File

93
include/curl/mprintf.h Normal file
View File

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

View File

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

250
install-sh Executable file
View File

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

282
lib/Makefile Normal file
View File

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

31
lib/Makefile.am Normal file
View File

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

282
lib/Makefile.in Normal file
View File

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

67
lib/Makefile.m32 Normal file
View File

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

315
lib/Makefile.vc6 Normal file
View File

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

319
lib/arpa_telnet.h Normal file
View File

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

94
lib/base64.c Normal file
View File

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

44
lib/base64.h Normal file
View File

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

457
lib/cookie.c Normal file
View File

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

45
lib/cookie.h Normal file
View File

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

245
lib/dict.c Normal file
View File

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

45
lib/dict.h Normal file
View File

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

484
lib/download.c Normal file
View File

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

50
lib/download.h Normal file
View File

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

111
lib/escape.c Normal file
View File

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

49
lib/escape.h Normal file
View File

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

175
lib/file.c Normal file
View File

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

45
lib/file.h Normal file
View File

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

BIN
lib/formdata Executable file

Binary file not shown.

617
lib/formdata.c Normal file
View File

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

103
lib/formdata.h Normal file
View File

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

1046
lib/ftp.c Normal file

File diff suppressed because it is too large Load Diff

52
lib/ftp.h Normal file
View File

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

2101
lib/getdate.c Normal file

File diff suppressed because it is too large Load Diff

46
lib/getdate.h Normal file
View File

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

1051
lib/getdate.y Normal file

File diff suppressed because it is too large Load Diff

95
lib/getenv.c Normal file
View File

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

71
lib/getenv.h Normal file
View File

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

185
lib/getpass.c Normal file
View File

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

1
lib/getpass.h Normal file
View File

@ -0,0 +1 @@
char *getpass(const char *prompt);

111
lib/hostip.c Normal file
View File

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

46
lib/hostip.h Normal file
View File

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

381
lib/http.c Normal file
View File

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

45
lib/http.h Normal file
View File

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

110
lib/if2ip.c Normal file
View File

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

50
lib/if2ip.h Normal file
View File

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

226
lib/ldap.c Normal file
View File

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

45
lib/ldap.h Normal file
View File

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

1253
lib/mprintf.c Normal file

File diff suppressed because it is too large Load Diff

182
lib/netrc.c Normal file
View File

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

70
lib/netrc.h Normal file
View File

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

221
lib/progress.c Normal file
View File

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

54
lib/progress.h Normal file
View File

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

115
lib/sendf.c Normal file
View File

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

47
lib/sendf.h Normal file
View File

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

169
lib/setup.h Normal file
View File

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

81
lib/speedcheck.c Normal file
View File

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

50
lib/speedcheck.h Normal file
View File

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

265
lib/ssluse.c Normal file
View File

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

46
lib/ssluse.h Normal file
View File

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

BIN
lib/sta01005 Normal file

Binary file not shown.

BIN
lib/sta18057 Normal file

Binary file not shown.

937
lib/telnet.c Normal file
View File

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

Some files were not shown because too many files have changed in this diff Show More