1
0

Add project files.

This commit is contained in:
sgraves
2017-02-02 21:08:13 -06:00
parent 7377d13134
commit e53ad03dd7
2592 changed files with 532713 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
set(EXE_NAME curl)
if(USE_MANUAL)
find_package(Perl REQUIRED)
# Use the C locale to ensure that only ASCII characters appear in the
# embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
add_custom_command(
OUTPUT tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
"${CURL_SOURCE_DIR}/docs/curl.1" |
"${PERL}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
"${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
"${CURL_SOURCE_DIR}/docs/curl.1" |
"${PERL}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c
"${CURL_SOURCE_DIR}/docs/MANUAL" >> tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
DEPENDS
"${CURL_SOURCE_DIR}/docs/MANUAL"
"${CURL_SOURCE_DIR}/docs/curl.1"
"${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
VERBATIM)
else()
add_custom_command(
OUTPUT tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "/* built-in manual is disabled, blank function */" > tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_hugehelp.h\"" >> tool_hugehelp.c
COMMAND ${CMAKE_COMMAND} -E echo "void hugehelp(void) {}" >> tool_hugehelp.c
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
VERBATIM)
endif()
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake)
if(MSVC)
list(APPEND CURL_SOURCE curl.rc)
endif()
# CURL_FILES comes from Makefile.inc
add_executable(
${EXE_NAME}
${CURL_FILES}
)
source_group("curlX source files" FILES ${CURLX_CFILES})
source_group("curl source files" FILES ${CURL_CFILES})
source_group("curl header files" FILES ${CURL_HFILES})
include_directories(
${CURL_SOURCE_DIR}/lib # To be able to reach "curl_setup_once.h"
${CURL_BINARY_DIR}/lib # To be able to reach "curl_config.h"
${CURL_BINARY_DIR}/include # To be able to reach "curl/curlbuild.h"
# This is needed as tool_hugehelp.c is generated in the binary dir
${CURL_SOURCE_DIR}/src # To be able to reach "tool_hugehelp.h"
)
#Build curl executable
target_link_libraries( ${EXE_NAME} libcurl ${CURL_LIBS})
################################################################################
#SET_TARGET_PROPERTIES(${EXE_NAME} ARCHIVE_OUTPUT_DIRECTORY "blah blah blah")
#SET_TARGET_PROPERTIES(${EXE_NAME} RUNTIME_OUTPUT_DIRECTORY "blah blah blah")
#SET_TARGET_PROPERTIES(${EXE_NAME} LIBRARY_OUTPUT_DIRECTORY "blah blah blah")
# Add the postfix to the executable since it is not added automatically as for modules and shared libraries
set_target_properties(${EXE_NAME} PROPERTIES
DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
#INCLUDE(ModuleInstall OPTIONAL)
install(TARGETS ${EXE_NAME} DESTINATION bin)

View File

@@ -0,0 +1,234 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2005 - 2008, Gisle Vanem <gvanem@yahoo.no>.
# Copyright (C) 2005 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
#
# Watcom / OpenWatcom / Win32 makefile for curl.
#
.ERASE
!if $(__VERSION__) < 1280
!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!message ! This Open Watcom version is too old and is no longer supported !
!message ! Please download latest version from www.openwatcom.org !
!message !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!error Unsupported version of Open Watcom
!endif
!ifndef %watcom
!error WATCOM environment variable not set!
!endif
# In order to process Makefile.inc wmake must be called with -u switch!
!ifndef %MAKEFLAGS
!error You MUST call wmake with the -u switch!
!endif
!ifdef %libname
LIBNAME = $(%libname)
!else
LIBNAME = libcurl
!endif
TARGETS = curl.exe
CC = wcc386
LD = wlink
AR = wlib
RC = wrc
!ifdef __LOADDLL__
! loaddll wcc386 wccd386
! loaddll wpp386 wppd386
! loaddll wlib wlibd
! loaddll wlink wlinkd
!endif
!ifdef __UNIX__
CP = cp
MD = mkdir -p
!else
CP = copy 2>NUL
MD = mkdir
!endif
!if $(__VERSION__) > 1290
RD = rm -rf
!else ifdef __UNIX__
RD = rm -rf
!else
RD = rmdir /q /s 2>NUL
!endif
SYS_INCL = -I"$(%watcom)/h/nt" -I"$(%watcom)/h"
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
-wcd=201 -bt=nt -bc -d+ -dWIN32 -dHAVE_STRTOLL &
-I"../include" -I"../lib" $(SYS_INCL)
!ifdef %debug
DEBUG = -dDEBUG=1 -dDEBUGBUILD
CFLAGS += -d3 $(DEBUG)
!else
CFLAGS += -d0
!endif
!ifdef %use_ipv6
CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
!endif
!ifdef %use_ssl
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_OPENSSL -I"$(OPENSSL_ROOT)/inc32"
!endif
!ifdef %curl_static
CFLAGS += -DCURL_STATICLIB
!else
CFLAGS += -br
!endif
#
# Change to suite.
#
!ifdef %zlib_root
ZLIB_ROOT = $(%zlib_root)
!else
ZLIB_ROOT = ../../zlib-1.2.8
!endif
!ifdef %libssh2_root
LIBSSH2_ROOT = $(%libssh2_root)
!else
LIBSSH2_ROOT = ../../libssh2-1.5.0
!endif
!ifdef %librtmp_root
LIBRTMP_ROOT = $(%librtmp_root)
!else
LIBRTMP_ROOT = ../../rtmpdump-2.3
!endif
!ifdef %openssl_root
OPENSSL_ROOT = $(%openssl_root)
!else
OPENSSL_ROOT = ../../openssl-1.0.2a
!endif
!ifdef %ares_root
ARES_ROOT = $(%ares_root)
!else
ARES_ROOT = ../ares
!endif
OBJ_DIR = WC_Win32.obj
LINK_ARG = $(OBJ_DIR)/wlink.arg
!include Makefile.inc
OBJS1 = $(OBJ_DIR)/$(CURL_CFILES)
!ifndef %curl_static
OBJS1 += $(CURLX_CFILES:../lib/=)
!endif
OBJS2 = $(OBJS1: = $(OBJ_DIR)/)
OBJS = $(OBJS2:.c=.obj)
RESOURCE = $(OBJ_DIR)/curl.res
DIRS = $(OBJ_DIR)
all: tool_hugehelp.c $(DIRS) $(TARGETS) .SYMBOLIC
@echo Welcome to curl
clean: .SYMBOLIC
-rm -f $(OBJS)
-rm -f $(RESOURCE) $(LINK_ARG)
vclean distclean: clean .SYMBOLIC
-$(RD) $(OBJ_DIR)
-rm -f curl.exe curl.sym tool_hugehelp.c
tool_hugehelp.c: tool_hugehelp.c.cvs
$(CP) $[@ $^@
tool_hugehelp.c.cvs: .EXISTSONLY
$(CP) tool_hugehelp.c $^@
$(DIRS):
-$(MD) $^@
curl.exe: $(OBJS) $(RESOURCE)
%create $(LINK_ARG)
@%append $(LINK_ARG) system nt
!ifdef %debug
@%append $(LINK_ARG) debug all
@%append $(LINK_ARG) option symfile
!endif
@%append $(LINK_ARG) option quiet, caseexact, eliminate
@%append $(LINK_ARG) option map=$(OBJ_DIR)/$^&.map
@%append $(LINK_ARG) option res=$(RESOURCE)
@%append $(LINK_ARG) file { $(OBJS) }
!ifndef %curl_static
@%append $(LINK_ARG) library ../lib/$(LIBNAME)_imp.lib
!else
@%append $(LINK_ARG) library ../lib/$(LIBNAME).lib
@%append $(LINK_ARG) library wldap32.lib
! ifdef %use_zlib
@%append $(LINK_ARG) library '$(ZLIB_ROOT)/zlib.lib'
! endif
! ifdef %use_rtmp
@%append $(LINK_ARG) library '$(LIBRTMP_ROOT)/librtmp/librtmp.lib'
@%append $(LINK_ARG) library winmm.lib
! endif
! ifdef %use_ssh2
@%append $(LINK_ARG) library '$(LIBSSH2_ROOT)/win32/libssh2.lib'
! endif
! ifdef %use_ssl
@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/libeay32.lib'
@%append $(LINK_ARG) library '$(OPENSSL_ROOT)/out32/ssleay32.lib'
! endif
! ifdef %use_ares
@%append $(LINK_ARG) library '$(ARES_ROOT)/cares.lib'
! endif
! ifdef %use_winidn
! if $(__VERSION__) > 1290
@%append $(LINK_ARG) library normaliz.lib
! else
@%append $(LINK_ARG) import '_IdnToAscii@20' 'NORMALIZ.DLL'.'IdnToAscii'
@%append $(LINK_ARG) import '_IdnToUnicode@20' 'NORMALIZ.DLL'.'IdnToUnicode'
! endif
! endif
!endif
!ifeq USE_WATT32 1
@%append $(LINK_ARG) library '$(%watt_root)/lib/wattcpw_imp.lib'
!else
@%append $(LINK_ARG) library ws2_32.lib
!endif
$(LD) name $^@ @$(LINK_ARG)
$(RESOURCE): curl.rc
$(RC) $(DEBUG) -q -r -zm -bt=nt -I"../include" $(SYS_INCL) $[@ -fo=$^@
# suffix search path - vpath-like hack
.c: ../lib
.c{$(OBJ_DIR)}.obj:
$(CC) $(CFLAGS) $[@ -fo=$^@

138
3rd-party/curl-7.52.1/src/Makefile.am vendored Normal file
View File

@@ -0,0 +1,138 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
AUTOMAKE_OPTIONS = foreign nostdinc
# remove targets if the command fails
.DELETE_ON_ERROR:
# Specify our include paths here, and do it relative to $(top_srcdir) and
# $(top_builddir), to ensure that these paths which belong to the library
# being currently built and tested are searched before the library which
# might possibly already be installed in the system.
#
# $(top_builddir)/include/curl for generated curlbuild.h included from curl.h
# $(top_builddir)/include for generated curlbuild.h inc. from lib/curl_setup.h
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_builddir)/src is for curl's generated src/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files
AM_CPPFLAGS = -I$(top_builddir)/include/curl \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_builddir)/src \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src
bin_PROGRAMS = curl
if USE_CPPFLAG_CURL_STATICLIB
AM_CPPFLAGS += -DCURL_STATICLIB
endif
include Makefile.inc
# CURL_FILES comes from Makefile.inc
curl_SOURCES = $(CURL_FILES)
# This might hold -Werror
CFLAGS += @CURL_CFLAG_EXTRAS@
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
if USE_EXPLICIT_LIB_DEPS
curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @LIBCURL_LIBS@
else
curl_LDADD = $(top_builddir)/lib/libcurl.la @LIBMETALINK_LIBS@ @NSS_LIBS@ @SSL_LIBS@ @ZLIB_LIBS@ @CURL_NETWORK_AND_TIME_LIBS@
endif
curl_LDFLAGS = @LIBMETALINK_LDFLAGS@
curl_CPPFLAGS = $(AM_CPPFLAGS) $(LIBMETALINK_CPPFLAGS)
curl_DEPENDENCIES = $(top_builddir)/lib/libcurl.la
# if unit tests are enabled, build a static library to link them with
if BUILD_UNITTESTS
noinst_LTLIBRARIES = libcurltool.la
libcurltool_la_CPPFLAGS = $(LIBMETALINK_CPPFLAGS) $(AM_CPPFLAGS) \
-DCURL_STATICLIB -DUNITTESTS
libcurltool_la_CFLAGS =
libcurltool_la_LDFLAGS = -static $(LINKFLAGS)
libcurltool_la_SOURCES = $(curl_SOURCES)
endif
BUILT_SOURCES = tool_hugehelp.c
CLEANFILES = tool_hugehelp.c
# Use the C locale to ensure that only ASCII characters appear in the
# embedded text.
NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 \
Makefile.m32 macos/curl.mcp.xml.sit.hqx macos/MACINSTALL.TXT \
macos/src/curl_GUSIConfig.cpp macos/src/macos_main.cpp makefile.amiga \
curl.rc Makefile.netware Makefile.inc Makefile.Watcom CMakeLists.txt
MANPAGE=$(top_srcdir)/docs/curl.1
README=$(top_srcdir)/docs/MANUAL
MKHELP=$(top_srcdir)/src/mkhelp.pl
HUGE=tool_hugehelp.c
if USE_MANUAL
# Here are the stuff to create a built-in manual
if HAVE_LIBZ
# This generates the tool_hugehelp.c file in both uncompressed and
# compressed formats
$(HUGE): $(README) $(MANPAGE) mkhelp.pl
echo '#include "tool_setup.h"' > $(HUGE)
echo '#ifndef HAVE_LIBZ' >> $(HUGE)
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
echo '#else' >> $(HUGE)
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
else # HAVE_LIBZ
# This generates the tool_hugehelp.c file uncompressed only
$(HUGE): $(README) $(MANPAGE) mkhelp.pl
echo '#include "tool_setup.h"' > $(HUGE)
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
endif
else # USE_MANUAL
# built-in manual has been disabled, make a blank file
$(HUGE):
echo "/* built-in manual is disabled, blank function */" > $(HUGE)
echo '#include "tool_hugehelp.h"' >> $(HUGE)
echo "void hugehelp(void) {}" >>$(HUGE)
endif
# ignore tool_hugehelp.c since it is generated source code and it plays
# by slightly different rules!
checksrc:
@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(srcdir) \
-W$(srcdir)/tool_hugehelp.c $(srcdir)/*.[ch]
if CURLDEBUG
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif

154
3rd-party/curl-7.52.1/src/Makefile.b32 vendored Normal file
View File

@@ -0,0 +1,154 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2000, Jaepil Kim, <pit@paradise.net.nz>.
# Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
############################################################
#
# Makefile.b32 - Borland's C++ Compiler 5.X
#
# 'BCCDIR' has to be set up to point to the base directory
# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55
#
############################################################
!if "$(__MAKE__)" == ""
!error __MAKE__ not defined. Use Borlands's MAKE to process this makefile.
!endif
# Borland's $(MAKEDIR) expands to the path where make.exe is located,
# use this feature to define BCCDIR when user has not defined BCCDIR.
!ifndef BCCDIR
BCCDIR = $(MAKEDIR)\..
!endif
# Edit the path below to point to the base of your Zlib sources.
!ifndef ZLIB_PATH
ZLIB_PATH = ..\..\zlib-1.2.8
!endif
# Edit the path below to point to the base of your OpenSSL package.
!ifndef OPENSSL_PATH
OPENSSL_PATH = ..\..\openssl-1.0.2a
!endif
# Set program's name
PROGNAME = curl.exe
# Setup environment
PP_CMD = cpp32 -q -P-
CC_CMD = bcc32 -q -c
LD = bcc32
RM = del 2>NUL
MKDIR = md
RMDIR = rd /q 2>NUL
COPY = $(COMSPEC) /c copy /y
CC_FLAGS = -5 -O2 -tWM -w -w-aus -w-ccc -w-dup -w-prc -w-pro -w-rch -w-sig -w-spa -w-inl -w-pia -w-pin -Dinline=__inline
LDFLAGS = -q -lq -lap
SRCDIRS = .;..\lib
OBJDIR = .\BCC_objs
INCDIRS = -I.;..\include;..\lib
LINKLIB = $(BCCDIR)\lib\cw32mt.lib $(BCCDIR)\lib\ws2_32.lib
DEFINES = -DNDEBUG -DWIN32
!ifdef DYNAMIC
LIBCURL_LIB = ..\lib\libcurl_imp.lib
!else
LIBCURL_LIB = ..\lib\libcurl.lib
DEFINES = $(DEFINES) -DCURL_STATICLIB
!endif
# ZLIB support is enabled setting WITH_ZLIB=1
!ifdef WITH_ZLIB
DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H
INCDIRS = $(INCDIRS);$(ZLIB_PATH)
LINKLIB = $(LINKLIB) $(ZLIB_PATH)\zlib.lib
!endif
# SSL support is enabled setting WITH_SSL=1
!ifdef WITH_SSL
DEFINES = $(DEFINES) -DUSE_OPENSSL
INCDIRS = $(INCDIRS);$(OPENSSL_PATH)\inc32;$(OPENSSL_PATH)\inc32\openssl
LINKLIB = $(LINKLIB) $(OPENSSL_PATH)\out32\ssleay32.lib $(OPENSSL_PATH)\out32\libeay32.lib
!endif
.autodepend
.path.c = $(SRCDIRS)
.path.obj = $(OBJDIR)
.path.int = $(OBJDIR)
# Makefile.inc provides the CSOURCES and HHEADERS defines
!include Makefile.inc
CSOURCES = $(CURL_CFILES) $(CURLX_CFILES:../lib/=)
OBJECTS = $(CSOURCES:.c=.obj)
PREPROCESSED = $(CSOURCES:.c=.int)
# Borland's command line compiler (BCC32) version 5.5.1 integrated
# preprocessor has a bug which results in silently generating wrong
# definitions for libcurl macros such as CURL_OFF_T_C, on the other
# hand Borland's command line preprocessor (CPP32) version 5.5.1 does
# not have the bug and achieves proper results. In order to avoid the
# silent bug we first preprocess source files and later compile the
# preprocessed result.
.c.obj:
@-$(RM) $(@R).int
$(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(<)
$(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
all: $(OBJDIR) tool_hugehelp $(PROGNAME)
clean:
cd $(OBJDIR)
@-$(RM) $(OBJECTS)
@-$(RM) $(PREPROCESSED)
cd ..
@-$(RMDIR) $(OBJDIR)
@-$(RM) $(PROGNAME)
@-$(RM) curl.tds
$(OBJDIR):
@-$(RMDIR) $(OBJDIR)
@-$(MKDIR) $(OBJDIR)
!ifdef WITH_ZLIB
tool_hugehelp: ..\docs\MANUAL ..\docs\curl.1 mkhelp.pl
groff -Tascii -man -P -c ../docs/curl.1 > tool_hugehelp.tmp
perl -w mkhelp.pl -c ../docs/MANUAL < tool_hugehelp.tmp > tool_hugehelp.c
@-$(RM) tool_hugehelp.tmp
!else
tool_hugehelp:
if exist ..\GIT-INFO $(COPY) tool_hugehelp.c.cvs tool_hugehelp.c
!endif
$(PROGNAME): $(OBJECTS) $(LIBCURL_LIB) $(LINKLIB)
@-$(RM) $(PROGNAME)
$(LD) $(LDFLAGS) -e$@ @&&!
$(**: = ^
)
!
# End of Makefile.b32

2060
3rd-party/curl-7.52.1/src/Makefile.in vendored Normal file

File diff suppressed because it is too large Load Diff

113
3rd-party/curl-7.52.1/src/Makefile.inc vendored Normal file
View File

@@ -0,0 +1,113 @@
# ./src/Makefile.inc
# Using the backslash as line continuation character might be problematic
# with some make flavours, as Watcom's wmake showed us already. If we
# ever want to change this in a portable manner then we should consider
# this idea (posted to the libcurl list by Adam Kellas):
# CSRC1 = file1.c file2.c file3.c
# CSRC2 = file4.c file5.c file6.c
# CSOURCES = $(CSRC1) $(CSRC2)
# libcurl has sources that provide functions named curlx_* that aren't part of
# the official API, but we re-use the code here to avoid duplication.
CURLX_CFILES = \
../lib/strtoofft.c \
../lib/nonblock.c \
../lib/warnless.c
CURLX_HFILES = \
../lib/curl_setup.h \
../lib/strtoofft.h \
../lib/nonblock.h \
../lib/warnless.h
CURL_CFILES = \
slist_wc.c \
tool_binmode.c \
tool_bname.c \
tool_cb_dbg.c \
tool_cb_hdr.c \
tool_cb_prg.c \
tool_cb_rea.c \
tool_cb_see.c \
tool_cb_wrt.c \
tool_cfgable.c \
tool_convert.c \
tool_dirhie.c \
tool_doswin.c \
tool_easysrc.c \
tool_formparse.c \
tool_getparam.c \
tool_getpass.c \
tool_help.c \
tool_helpers.c \
tool_homedir.c \
tool_hugehelp.c \
tool_libinfo.c \
tool_main.c \
tool_metalink.c \
tool_mfiles.c \
tool_msgs.c \
tool_operate.c \
tool_operhlp.c \
tool_panykey.c \
tool_paramhlp.c \
tool_parsecfg.c \
tool_strdup.c \
tool_setopt.c \
tool_sleep.c \
tool_urlglob.c \
tool_util.c \
tool_vms.c \
tool_writeenv.c \
tool_writeout.c \
tool_xattr.c
CURL_HFILES = \
slist_wc.h \
tool_binmode.h \
tool_bname.h \
tool_cb_dbg.h \
tool_cb_hdr.h \
tool_cb_prg.h \
tool_cb_rea.h \
tool_cb_see.h \
tool_cb_wrt.h \
tool_cfgable.h \
tool_convert.h \
tool_dirhie.h \
tool_doswin.h \
tool_easysrc.h \
tool_formparse.h \
tool_getparam.h \
tool_getpass.h \
tool_help.h \
tool_helpers.h \
tool_homedir.h \
tool_hugehelp.h \
tool_libinfo.h \
tool_main.h \
tool_metalink.h \
tool_mfiles.h \
tool_msgs.h \
tool_operate.h \
tool_operhlp.h \
tool_panykey.h \
tool_paramhlp.h \
tool_parsecfg.h \
tool_sdecls.h \
tool_setopt.h \
tool_setup.h \
tool_sleep.h \
tool_strdup.h \
tool_urlglob.h \
tool_util.h \
tool_version.h \
tool_vms.h \
tool_writeenv.h \
tool_writeout.h \
tool_xattr.h
CURL_RCFILES = curl.rc
# curl_SOURCES is special and gets assigned in src/Makefile.am
CURL_FILES = $(CURL_CFILES) $(CURLX_CFILES) $(CURL_HFILES)

377
3rd-party/curl-7.52.1/src/Makefile.m32 vendored Normal file
View File

@@ -0,0 +1,377 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
###########################################################################
#
## Makefile for building curl.exe with MingW (GCC-3.2 or later)
## and optionally OpenSSL (1.0.2a), libssh2 (1.5), zlib (1.2.8), librtmp (2.4)
##
## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn
##
## Hint: you can also set environment vars to control the build, f.e.:
## set ZLIB_PATH=c:/zlib-1.2.8
## set ZLIB=1
#
###########################################################################
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.5.0
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.4
endif
# Edit the path below to point to the base of your libmetalink package.
ifndef LIBMETALINK_PATH
LIBMETALINK_PATH = ../../libmetalink-0.1.3
endif
# Edit the path below to point to the base of your libexpat package.
ifndef LIBEXPAT_PATH
LIBEXPAT_PATH = ../../expat-2.1.0
endif
# Edit the path below to point to the base of your libxml2 package.
ifndef LIBXML2_PATH
LIBXML2_PATH = ../../libxml2-2.9.2
endif
# Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.32
endif
# Edit the path below to point to the base of your MS IDN package.
# Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
# https://www.microsoft.com/en-us/download/details.aspx?id=734
ifndef WINIDN_PATH
WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
endif
# Edit the path below to point to the base of your Novell LDAP NDK.
ifndef LDAP_SDK
LDAP_SDK = c:/novell/ndk/cldapsdk/win32
endif
# Edit the path below to point to the base of your nghttp2 package.
ifndef NGHTTP2_PATH
NGHTTP2_PATH = ../../nghttp2-1.0.0
endif
PROOT = ..
# Edit the path below to point to the base of your c-ares package.
ifndef LIBCARES_PATH
LIBCARES_PATH = $(PROOT)/ares
endif
CC = $(CROSSPREFIX)gcc
CFLAGS = $(CURL_CFLAG_EXTRAS) -g -O2 -Wall
CFLAGS += -fno-strict-aliasing
# comment LDFLAGS below to keep debug info
LDFLAGS = $(CURL_LDFLAG_EXTRAS) $(CURL_LDFLAG_EXTRAS_EXE) -s
AR = $(CROSSPREFIX)ar
RC = $(CROSSPREFIX)windres
RCFLAGS = --include-dir=$(PROOT)/include -O COFF
STRIP = $(CROSSPREFIX)strip -g
# We may need these someday
# PERL = perl
# NROFF = nroff
# Set environment var ARCH to your architecture to override autodetection.
ifndef ARCH
ifeq ($(findstring x86_64,$(shell $(CC) -dumpmachine)),x86_64)
ARCH = w64
else
ARCH = w32
endif
endif
ifeq ($(ARCH),w64)
CFLAGS += -m64 -D_AMD64_
LDFLAGS += -m64
RCFLAGS += -F pe-x86-64
else
CFLAGS += -m32
LDFLAGS += -m32
RCFLAGS += -F pe-i386
endif
# Platform-dependent helper tool macros
ifeq ($(findstring /sh,$(SHELL)),/sh)
DEL = rm -f $1
RMDIR = rm -fr $1
MKDIR = mkdir -p $1
COPY = -cp -afv $1 $2
#COPYR = -cp -afr $1/* $2
COPYR = -rsync -aC $1/* $2
TOUCH = touch $1
CAT = cat
ECHONL = echo ""
DL = '
else
ifeq "$(OS)" "Windows_NT"
DEL = -del 2>NUL /q /f $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
else
DEL = -del 2>NUL $(subst /,\,$1)
RMDIR = -deltree 2>NUL /y $(subst /,\,$1)
endif
MKDIR = -md 2>NUL $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
COPYR = -xcopy 2>NUL /q /y /e $(subst /,\,$1) $(subst /,\,$2)
TOUCH = copy 2>&1>NUL /b $(subst /,\,$1) +,,
CAT = type
ECHONL = $(ComSpec) /c echo.
endif
########################################################
## Nothing more to do below this line!
ifeq ($(findstring -dyn,$(CFG)),-dyn)
DYN = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
ARES = 1
endif
ifeq ($(findstring -sync,$(CFG)),-sync)
SYNC = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
RTMP = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
SSH2 = 1
ifneq ($(findstring -winssl,$(CFG)),-winssl)
SSL = 1
endif
ZLIB = 1
endif
ifeq ($(findstring -ssl,$(CFG)),-ssl)
SSL = 1
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
IDN = 1
endif
ifeq ($(findstring -winidn,$(CFG)),-winidn)
WINIDN = 1
endif
ifeq ($(findstring -sspi,$(CFG)),-sspi)
SSPI = 1
endif
ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
LDAPS = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
IPV6 = 1
endif
ifeq ($(findstring -metalink,$(CFG)),-metalink)
METALINK = 1
endif
ifeq ($(findstring -winssl,$(CFG)),-winssl)
WINSSL = 1
SSPI = 1
endif
ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
NGHTTP2 = 1
endif
INCLUDES = -I. -I../include -I../lib
ifdef DYN
curl_DEPENDENCIES = $(PROOT)/lib/libcurldll.a $(PROOT)/lib/libcurl.dll
curl_LDADD = -L$(PROOT)/lib -lcurldll
else
curl_DEPENDENCIES = $(PROOT)/lib/libcurl.a
curl_LDADD = -L$(PROOT)/lib -lcurl
CFLAGS += -DCURL_STATICLIB
LDFLAGS += -static
endif
ifdef SYNC
CFLAGS += -DUSE_SYNC_DNS
else
ifdef ARES
ifndef DYN
curl_DEPENDENCIES += $(LIBCARES_PATH)/libcares.a
endif
CFLAGS += -DUSE_ARES -DCARES_STATICLIB
curl_LDADD += -L"$(LIBCARES_PATH)" -lcares
endif
endif
ifdef RTMP
CFLAGS += -DUSE_LIBRTMP
curl_LDADD += -L"$(LIBRTMP_PATH)/librtmp" -lrtmp -lwinmm
endif
ifdef NGHTTP2
CFLAGS += -DUSE_NGHTTP2
curl_LDADD += -L"$(NGHTTP2_PATH)/lib" -lnghttp2
endif
ifdef SSH2
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
curl_LDADD += -L"$(LIBSSH2_PATH)/win32" -lssh2
ifdef WINSSL
ifndef DYN
curl_LDADD += -lbcrypt -lcrypt32
endif
endif
endif
ifdef SSL
ifndef OPENSSL_INCLUDE
ifeq "$(wildcard $(OPENSSL_PATH)/outinc)" "$(OPENSSL_PATH)/outinc"
OPENSSL_INCLUDE = $(OPENSSL_PATH)/outinc
endif
ifeq "$(wildcard $(OPENSSL_PATH)/include)" "$(OPENSSL_PATH)/include"
OPENSSL_INCLUDE = $(OPENSSL_PATH)/include
endif
endif
ifneq "$(wildcard $(OPENSSL_INCLUDE)/openssl/opensslv.h)" "$(OPENSSL_INCLUDE)/openssl/opensslv.h"
$(error Invalid path to OpenSSL package: $(OPENSSL_PATH))
endif
ifndef OPENSSL_LIBPATH
OPENSSL_LIBS = -lssl -lcrypto
ifeq "$(wildcard $(OPENSSL_PATH)/out)" "$(OPENSSL_PATH)/out"
OPENSSL_LIBPATH = $(OPENSSL_PATH)/out
ifdef DYN
OPENSSL_LIBS = -lssl32 -leay32
endif
endif
ifeq "$(wildcard $(OPENSSL_PATH)/lib)" "$(OPENSSL_PATH)/lib"
OPENSSL_LIBPATH = $(OPENSSL_PATH)/lib
endif
endif
ifndef DYN
OPENSSL_LIBS += -lgdi32 -lcrypt32
endif
INCLUDES += -I"$(OPENSSL_INCLUDE)"
CFLAGS += -DUSE_OPENSSL
curl_LDADD += -L"$(OPENSSL_LIBPATH)" $(OPENSSL_LIBS)
else
ifdef WINSSL
curl_LDADD += -lcrypt32
endif
endif
ifdef ZLIB
INCLUDES += -I"$(ZLIB_PATH)"
CFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
curl_LDADD += -L"$(ZLIB_PATH)" -lz
endif
ifdef IDN
CFLAGS += -DUSE_LIBIDN
curl_LDADD += -L"$(LIBIDN_PATH)/lib" -lidn
else
ifdef WINIDN
CFLAGS += -DUSE_WIN32_IDN
curl_LDADD += -L"$(WINIDN_PATH)" -lnormaliz
endif
endif
ifdef METALINK
INCLUDES += -I"$(LIBMETALINK_PATH)/include"
CFLAGS += -DUSE_METALINK
curl_LDADD += -L"$(LIBMETALINK_PATH)/lib" -lmetalink
ifndef DYN
ifeq ($(findstring libexpat_metalink_parser.o,$(shell $(AR) t "$(LIBMETALINK_PATH)/lib/libmetalink.a")),libexpat_metalink_parser.o)
curl_LDADD += -L"$(LIBEXPAT_PATH)/lib" -lexpat
else
curl_LDADD += -L"$(LIBXML2_PATH)/lib" -lxml2
endif
endif
endif
ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI
ifdef WINSSL
CFLAGS += -DUSE_SCHANNEL
endif
endif
ifdef IPV6
CFLAGS += -DENABLE_IPV6 -D_WIN32_WINNT=0x0501
endif
ifdef LDAPS
CFLAGS += -DHAVE_LDAP_SSL
endif
ifdef USE_LDAP_NOVELL
CFLAGS += -DCURL_HAS_NOVELL_LDAPSDK
curl_LDADD += -L"$(LDAP_SDK)/lib/mscvc" -lldapsdk -lldapssl -lldapx
endif
ifdef USE_LDAP_OPENLDAP
CFLAGS += -DCURL_HAS_OPENLDAP_LDAPSDK
curl_LDADD += -L"$(LDAP_SDK)/lib" -lldap -llber
endif
ifndef USE_LDAP_NOVELL
ifndef USE_LDAP_OPENLDAP
curl_LDADD += -lwldap32
endif
endif
curl_LDADD += -lws2_32
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
curl_PROGRAMS = curl.exe
curl_OBJECTS := $(patsubst %.c,%.o,$(strip $(CURL_CFILES)))
curlx_OBJECTS := $(patsubst %.c,%.o,$(notdir $(strip $(CURLX_CFILES))))
ifdef DYN
curl_OBJECTS += $(curlx_OBJECTS)
vpath %.c $(PROOT)/lib
endif
RESOURCE = curl.res
all: $(curl_PROGRAMS)
curl.exe: $(RESOURCE) $(curl_OBJECTS) $(curl_DEPENDENCIES)
$(call DEL, $@)
$(CC) $(LDFLAGS) -o $@ $< $(curl_OBJECTS) $(curl_LDADD)
# We don't have nroff normally under win32
# tool_hugehelp.c: $(PROOT)/docs/MANUAL $(PROOT)/docs/curl.1 mkhelp.pl
# @$(call DEL, tool_hugehelp.c)
# $(NROFF) -man $(PROOT)/docs/curl.1 | $(PERL) mkhelp.pl $(PROOT)/docs/MANUAL > tool_hugehelp.c
tool_hugehelp.c:
@echo Creating $@
@$(call COPY, $@.cvs, $@)
%.o: %.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
%.res: %.rc
$(RC) $(RCFLAGS) -i $< -o $@
clean:
ifeq "$(wildcard tool_hugehelp.c.cvs)" "tool_hugehelp.c.cvs"
@$(call DEL, tool_hugehelp.c)
endif
@$(call DEL, $(curl_OBJECTS) $(curlx_OBJECTS) $(RESOURCE))
distclean vclean: clean
@$(call DEL, $(curl_PROGRAMS))

View File

@@ -0,0 +1,524 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2004 - 2014, Guenter Knauf, <http://www.gknw.net/phpbb>.
# Copyright (C) 2001 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
#################################################################
#
## Makefile for building curl.nlm (NetWare version - gnu make)
##
## Use: make -f Makefile.netware
#
#################################################################
# Edit the path below to point to the base of your Novell NDK.
ifndef NDKBASE
NDKBASE = c:/novell
endif
# Edit the path below to point to the base of your Zlib sources.
ifndef ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
endif
# Edit the path below to point to the base of your OpenSSL package.
ifndef OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
endif
# Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.5.0
endif
# Edit the path below to point to the base of your axTLS package.
ifndef AXTLS_PATH
AXTLS_PATH = ../../axTLS-1.2.7
endif
# Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.18
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.3
endif
# Edit the path below to point to the base of your nghttp2 package.
ifndef NGHTTP2_PATH
NGHTTP2_PATH = ../../nghttp2-0.6.7
endif
# Edit the path below to point to the base of your fbopenssl package.
ifndef FBOPENSSL_PATH
FBOPENSSL_PATH = ../../fbopenssl-0.4
endif
# Edit the path below to point to the base of your libmetalink package.
ifndef LIBMETALINK_PATH
LIBMETALINK_PATH = ../../libmetalink-0.1.2
endif
# Edit the path below to point to the base of your libexpat package.
ifndef LIBEXPAT_PATH
LIBEXPAT_PATH = ../../expat-2.1.0
endif
# Edit the path below to point to the base of your libXML2 package.
ifndef LIBXML2_PATH
LIBXML2_PATH = ../../libxml2-2.8.0
endif
# Edit the path below to point to the base of your c-ares package.
ifndef LIBCARES_PATH
LIBCARES_PATH = ../ares
endif
ifndef INSTDIR
INSTDIR = ..$(DS)curl-$(LIBCURL_VERSION_STR)-bin-nw
endif
# Edit the vars below to change NLM target settings.
TARGET = curl
VERSION = $(LIBCURL_VERSION)
COPYR = Copyright (C) $(LIBCURL_COPYRIGHT_STR)
DESCR = curl $(LIBCURL_VERSION_STR) ($(LIBARCH)) - https://curl.haxx.se
MTSAFE = YES
STACK = 64000
SCREEN = $(TARGET) commandline utility
# Comment the line below if you dont want to load protected automatically.
# LDRING = 3
# Uncomment the next line to enable linking with POSIX semantics.
# POSIXFL = 1
# Edit the var below to point to your lib architecture.
ifndef LIBARCH
LIBARCH = LIBC
endif
# must be equal to NDEBUG or DEBUG, CURLDEBUG
ifndef DB
DB = NDEBUG
endif
# Optimization: -O<n> or debugging: -g
ifeq ($(DB),NDEBUG)
OPT = -O2
OBJDIR = release
else
OPT = -g
OBJDIR = debug
endif
# The following lines defines your compiler.
ifdef CWFolder
METROWERKS = $(CWFolder)
endif
ifdef METROWERKS
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
CC = mwccnlm
else
CC = gcc
endif
PERL = perl
# Here you can find a native Win32 binary of the original awk:
# http://www.gknw.net/development/prgtools/awk-20100523.zip
AWK = awk
CP = cp -afv
MKDIR = mkdir
# RM = rm -f
# If you want to mark the target as MTSAFE you will need a tool for
# generating the xdc data for the linker; here's a minimal tool:
# http://www.gknw.net/development/prgtools/mkxdc.zip
MPKXDC = mkxdc
# LIBARCH_U = $(shell $(AWK) 'BEGIN {print toupper(ARGV[1])}' $(LIBARCH))
LIBARCH_L = $(shell $(AWK) 'BEGIN {print tolower(ARGV[1])}' $(LIBARCH))
# Include the version info retrieved from curlver.h
-include $(OBJDIR)/version.inc
# Global flags for all compilers
CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
ifeq ($(CC),mwccnlm)
LD = mwldnlm
LDFLAGS = -nostdlib $(OBJS) $(PRELUDE) $(LDLIBS) -o $@ -commandfile
LIBEXT = lib
CFLAGS += -gccinc -inline off -opt nointrinsics -proc 586
CFLAGS += -relax_pointers
#CFLAGS += -w on
ifeq ($(LIBARCH),LIBC)
ifeq ($(POSIXFL),1)
PRELUDE = $(NDK_LIBC)/imports/posixpre.o
else
PRELUDE = $(NDK_LIBC)/imports/libcpre.o
endif
CFLAGS += -align 4
else
# PRELUDE = $(NDK_CLIB)/imports/clibpre.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
CFLAGS += -align 1
endif
else
LD = nlmconv
LDFLAGS = -T
LIBEXT = a
CFLAGS += -m32
CFLAGS += -fno-builtin -fno-strict-aliasing
ifeq ($(findstring gcc,$(CC)),gcc)
CFLAGS += -fpcc-struct-return
endif
CFLAGS += -Wall # -pedantic
ifeq ($(LIBARCH),LIBC)
ifeq ($(POSIXFL),1)
PRELUDE = $(NDK_LIBC)/imports/posixpre.gcc.o
else
PRELUDE = $(NDK_LIBC)/imports/libcpre.gcc.o
endif
else
# PRELUDE = $(NDK_CLIB)/imports/clibpre.gcc.o
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
PRELUDE = $(NDK_ROOT)/pre/prelude.o
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
endif
endif
NDK_ROOT = $(NDKBASE)/ndk
ifndef NDK_CLIB
NDK_CLIB = $(NDK_ROOT)/nwsdk
endif
ifndef NDK_LIBC
NDK_LIBC = $(NDK_ROOT)/libc
endif
ifndef NDK_LDAP
NDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
endif
CURL_INC = ../include
CURL_LIB = ../lib
INCLUDES = -I$(CURL_INC) -I$(CURL_LIB)
ifeq ($(findstring -static,$(CFG)),-static)
LINK_STATIC = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
WITH_ARES = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
WITH_RTMP = 1
WITH_SSL = 1
WITH_ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
WITH_SSH2 = 1
WITH_SSL = 1
WITH_ZLIB = 1
endif
ifeq ($(findstring -axtls,$(CFG)),-axtls)
WITH_AXTLS = 1
WITH_SSL =
else
ifeq ($(findstring -ssl,$(CFG)),-ssl)
WITH_SSL = 1
endif
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
WITH_ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
WITH_IDN = 1
endif
ifeq ($(findstring -metalink,$(CFG)),-metalink)
WITH_METALINK = 1
WITH_SSL = 1
endif
ifeq ($(findstring -nghttp2,$(CFG)),-nghttp2)
WITH_NGHTTP2 = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
ENABLE_IPV6 = 1
endif
ifdef LINK_STATIC
LDLIBS = $(CURL_LIB)/libcurl.$(LIBEXT)
ifdef WITH_ARES
LDLIBS += $(LIBCARES_PATH)/libcares.$(LIBEXT)
endif
else
MODULES = libcurl.nlm
IMPORTS = @$(CURL_LIB)/libcurl.imp
endif
ifdef WITH_SSH2
# INCLUDES += -I$(LIBSSH2_PATH)/include
ifdef LINK_STATIC
LDLIBS += $(LIBSSH2_PATH)/nw/libssh2.$(LIBEXT)
else
MODULES += libssh2.nlm
IMPORTS += @$(LIBSSH2_PATH)/nw/libssh2.imp
endif
endif
ifdef WITH_RTMP
# INCLUDES += -I$(LIBRTMP_PATH)
ifdef LINK_STATIC
LDLIBS += $(LIBRTMP_PATH)/librtmp/librtmp.$(LIBEXT)
endif
endif
ifdef WITH_SSL
# INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/ssl.$(LIBEXT)
LDLIBS += $(OPENSSL_PATH)/out_nw_$(LIBARCH_L)/crypto.$(LIBEXT)
IMPORTS += GetProcessSwitchCount RunningProcess
else
ifdef WITH_AXTLS
# INCLUDES += -I$(AXTLS_PATH)/inc
ifdef LINK_STATIC
LDLIBS += $(AXTLS_PATH)/lib/libaxtls.$(LIBEXT)
else
MODULES += libaxtls.nlm
IMPORTS += $(AXTLS_PATH)/lib/libaxtls.imp
endif
endif
endif
ifdef WITH_ZLIB
INCLUDES += -I$(ZLIB_PATH)
ifdef LINK_STATIC
LDLIBS += $(ZLIB_PATH)/nw/$(LIBARCH)/libz.$(LIBEXT)
else
MODULES += libz.nlm
IMPORTS += @$(ZLIB_PATH)/nw/$(LIBARCH)/libz.imp
endif
endif
ifdef WITH_IDN
# INCLUDES += -I$(LIBIDN_PATH)/include
LDLIBS += $(LIBIDN_PATH)/lib/libidn.$(LIBEXT)
endif
ifdef WITH_NGHTTP2
INCLUDES += -I$(NGHTTP2_PATH)/include
LDLIBS += $(NGHTTP2_PATH)/lib/libnghttp2.$(LIBEXT)
endif
ifdef WITH_METALINK
CFLAGS += -DUSE_METALINK
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_$(LIBARCH_L)
INCLUDES += -I$(LIBMETALINK_PATH)/include
LDLIBS += $(LIBMETALINK_PATH)/lib/libmetalink.$(LIBEXT)
ifdef WITH_LIBEXPAT
ifeq ($(LIBARCH),LIBC)
IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlbc.imp
MODULES += expatlbc
else
IMPORTS += @$(LIBEXPAT_PATH)/imports/expatlib.imp
MODULES += expatlib
endif
else
ifdef WITH_LIBXML2
IMPORTS += @$(LIBXML2_PATH)/lib/libxml2.imp
MODULES += libxml2
endif
endif
endif
ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(NDK_LIBC)/include
# INCLUDES += -I$(NDK_LIBC)/include/nks
# INCLUDES += -I$(NDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE
else
INCLUDES += -I$(NDK_CLIB)/include/nlm
# INCLUDES += -I$(NDK_CLIB)/include
endif
ifndef DISABLE_LDAP
# INCLUDES += -I$(NDK_LDAP)/$(LIBARCH_L)/inc
endif
CFLAGS += $(INCLUDES)
ifeq ($(MTSAFE),YES)
XDCOPT = -n
endif
ifeq ($(MTSAFE),NO)
XDCOPT = -u
endif
ifdef XDCOPT
XDCDATA = $(OBJDIR)/$(TARGET).xdc
endif
ifeq ($(findstring /sh,$(SHELL)),/sh)
DL = '
DS = /
PCT = %
#-include $(NDKBASE)/nlmconv/ncpfs.inc
else
DS = \\
PCT = %%
endif
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJX := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(strip $(CURLX_CFILES))))
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CURL_CFILES)))
ifndef LINK_STATIC
OBJS += $(OBJX)
endif
vpath %.c $(CURL_LIB)
all: prebuild $(TARGET).nlm
prebuild: $(OBJDIR) $(OBJDIR)/version.inc
$(OBJDIR)/%.o: %.c
# @echo Compiling $<
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/version.inc: $(CURL_INC)/curl/curlver.h $(OBJDIR)
@echo Creating $@
@$(AWK) -f ../packages/NetWare/get_ver.awk $< > $@
install: $(INSTDIR) all
@-$(CP) ../docs/$(TARGET).pdf $(INSTDIR)
@-$(CP) ../docs/$(TARGET).html $(INSTDIR)
@$(CP) $(TARGET).nlm $(INSTDIR)
clean:
ifeq "$(wildcard tool_hugehelp.c.cvs)" "tool_hugehelp.c.cvs"
-$(RM) tool_hugehelp.c
endif
-$(RM) -r $(OBJDIR)
distclean vclean: clean
-$(RM) $(TARGET).nlm
$(OBJDIR) $(INSTDIR):
@$(MKDIR) $@
$(TARGET).nlm: $(OBJS) $(OBJDIR)/$(TARGET).def $(XDCDATA)
@echo Linking $@
@-$(RM) $@
@$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
$(OBJDIR)/%.xdc: Makefile.netware
@echo Creating $@
@$(MPKXDC) $(XDCOPT) $@
$(OBJDIR)/%.def: Makefile.netware
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
@echo $(DL)#$(DL) >> $@
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
@echo $(DL)description "$(DESCR)"$(DL) >> $@
@echo $(DL)version $(VERSION)$(DL) >> $@
ifdef NLMTYPE
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
endif
ifdef STACK
@echo $(DL)stack $(STACK)$(DL) >> $@
endif
ifdef SCREEN
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
else
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
endif
ifneq ($(DB),NDEBUG)
@echo $(DL)debug$(DL) >> $@
endif
@echo $(DL)threadname "$(TARGET)"$(DL) >> $@
ifdef XDCDATA
@echo $(DL)xdcdata $(XDCDATA)$(DL) >> $@
endif
ifeq ($(LDRING),0)
@echo $(DL)flag_on 16$(DL) >> $@
endif
ifeq ($(LDRING),3)
@echo $(DL)flag_on 512$(DL) >> $@
endif
ifeq ($(LIBARCH),CLIB)
@echo $(DL)start _Prelude$(DL) >> $@
@echo $(DL)exit _Stop$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/clib.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/threads.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
@echo $(DL)import @$(NDK_CLIB)/imports/socklib.imp$(DL) >> $@
@echo $(DL)module clib$(DL) >> $@
ifndef DISABLE_LDAP
@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapsdk.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapssl.imp$(DL) >> $@
# @echo $(DL)import @$(NDK_LDAP)/clib/imports/ldapx.imp$(DL) >> $@
@echo $(DL)module ldapsdk ldapssl$(DL) >> $@
endif
else
ifeq ($(POSIXFL),1)
@echo $(DL)flag_on 4194304$(DL) >> $@
endif
@echo $(DL)flag_on 64$(DL) >> $@
@echo $(DL)pseudopreemption$(DL) >> $@
ifeq ($(findstring posixpre,$(PRELUDE)),posixpre)
@echo $(DL)start POSIX_Start$(DL) >> $@
@echo $(DL)exit POSIX_Stop$(DL) >> $@
@echo $(DL)check POSIX_CheckUnload$(DL) >> $@
else
@echo $(DL)start _LibCPrelude$(DL) >> $@
@echo $(DL)exit _LibCPostlude$(DL) >> $@
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
endif
@echo $(DL)import @$(NDK_LIBC)/imports/libc.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LIBC)/imports/netware.imp$(DL) >> $@
@echo $(DL)module libc$(DL) >> $@
ifndef DISABLE_LDAP
@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapsdk.imp$(DL) >> $@
@echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapssl.imp$(DL) >> $@
# @echo $(DL)import @$(NDK_LDAP)/libc/imports/lldapx.imp$(DL) >> $@
@echo $(DL)module lldapsdk lldapssl$(DL) >> $@
endif
endif
ifdef MODULES
@echo $(DL)module $(MODULES)$(DL) >> $@
endif
ifdef EXPORTS
@echo $(DL)export $(EXPORTS)$(DL) >> $@
endif
ifdef IMPORTS
@echo $(DL)import $(IMPORTS)$(DL) >> $@
endif
ifeq ($(findstring nlmconv,$(LD)),nlmconv)
@echo $(DL)input $(PRELUDE)$(DL) >> $@
@echo $(DL)input $(OBJS)$(DL) >> $@
ifdef LDLIBS
@echo $(DL)input $(LDLIBS)$(DL) >> $@
endif
@echo $(DL)output $(TARGET).nlm$(DL) >> $@
endif
tool_hugehelp.c:
@echo Creating $@
@$(CP) tool_hugehelp.c.cvs $@
$(LIBCARES_PATH)/libcares.$(LIBEXT):
$(MAKE) -C $(LIBCARES_PATH) -f Makefile.netware lib

550
3rd-party/curl-7.52.1/src/Makefile.vc10 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC10
## Use: nmake -f makefile.vc10 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc10 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC10 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC10
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc11 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC11
## Use: nmake -f makefile.vc11 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc11 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC11 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC11
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc12 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC12
## Use: nmake -f makefile.vc12 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc12 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC12 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC12
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc14 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC14
## Use: nmake -f makefile.vc14 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc14 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC14 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC14
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc6 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC6
## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC6 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /GZ
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC6
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc7 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC7
## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC7 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /GZ
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /GX /DWIN32 /YX /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC7
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc8 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC8
## Use: nmake -f makefile.vc6 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc6 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC8 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib bufferoverflowu.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC8
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

550
3rd-party/curl-7.52.1/src/Makefile.vc9 vendored Normal file
View File

@@ -0,0 +1,550 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1999 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
# All files in the Makefile.vc* series are generated automatically from the
# one made for MSVC version 6. Alas, if you want to do changes to any of the
# files and send back to the project, edit the version six, make your diff and
# mail curl-users.
#############################################################
#
## Makefile for building curl.exe with MSVC9
## Use: nmake -f makefile.vc9 [release | debug] [CFG=release-ssl]
## (default is release)
## "nmake -f makefile.vc9 CFG=release-ssl" statically links OpenSSL
## into curl.exe producing a standalone SSL-enabled executable.
##
#
#############################################################
PROGRAM_NAME = curl.exe
# -------------------------------------------
# Verify that current subdir is curl's 'src'
# -------------------------------------------
!IF ! EXIST(.\tool_main.c)
! MESSAGE Can not process this makefile from outside of curl's 'src' subdirectory.
! MESSAGE Change to curl's 'src' subdirectory, and try again.
! ERROR See previous message.
!ENDIF
# ------------------------------------------------
# Makefile.msvc.names provides libcurl file names
# ------------------------------------------------
!INCLUDE ..\winbuild\Makefile.msvc.names
!IFNDEF OPENSSL_PATH
OPENSSL_PATH = ../../openssl-1.0.2a
!ENDIF
!IFNDEF ZLIB_PATH
ZLIB_PATH = ../../zlib-1.2.8
!ENDIF
!IFNDEF MACHINE
MACHINE = X86
!ENDIF
# USE_WINDOWS_SSPI uses windows libraries to allow NTLM authentication
# without an openssl installation and offers the ability to authenticate
# using the "current logged in user". Since at least with MSVC9 the sspi.h
# header is broken it is either required to install the Windows SDK,
# or to fix sspi.h with adding this define at the beginning of sspi.h:
# #define FreeCredentialHandle FreeCredentialsHandle
#
# If, for some reason the Windows SDK is installed but not installed
# in the default location, you can specify WINDOWS_SDK_PATH.
# It can be downloaded from:
# https://msdn.microsoft.com/windows/bb980924.aspx
# WINDOWS_SSPI = 1
!IFDEF WINDOWS_SSPI
!IFNDEF WINDOWS_SDK_PATH
WINDOWS_SDK_PATH = "$(PROGRAMFILES)\Microsoft SDK"
!ENDIF
!ENDIF
########################################################
## Nothing more to do below this line!
ZLIB_CFLAGS = /DHAVE_ZLIB_H /DHAVE_ZLIB /DHAVE_LIBZ /I "$(ZLIB_PATH)"
ZLIB_LFLAGS = "/LIBPATH:$(ZLIB_PATH)"
ZLIB_LIBS = zlib.lib
ZLIB_IMP_LIBS = zdll.lib
SSL_CFLAGS = /DUSE_OPENSSL
SSL_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32"
SSL_IMP_LFLAGS = /LIBPATH:"$(OPENSSL_PATH)/out32dll"
SSL_LIBS = libeay32.lib ssleay32.lib gdi32.lib user32.lib
WINLIBS = ws2_32.lib wldap32.lib advapi32.lib
WINSSL_CFLAGS = /DUSE_SCHANNEL
#WINSSL_LIBS = gdi32.lib user32.lib
!IFDEF USE_IDN
WINLIBS = $(WINLIBS) normaliz.lib
!ENDIF
# Runtime library configuration
RTLIB = /MD
RTLIBD = /MDd
!IF "$(RTLIBCFG)" == "static"
RTLIB = /MT
RTLIBD = /MTd
!ENDIF
## Release
CCR = cl.exe $(RTLIB) /O2 /DNDEBUG
LINKR = link.exe /incremental:no /libpath:"../lib"
RCR = rc.exe /dDEBUGBUILD=0
## Debug
CCD = cl.exe $(RTLIBD) /Gm /ZI /Od /D_DEBUG /RTC1
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
RCD = rc.exe /dDEBUGBUILD=1
CFLAGS = /I../lib /I../include /nologo /W3 /EHsc /DWIN32 /FD /c /D_BIND_TO_CURRENT_VCLIBS_VERSION=1
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:$(MACHINE)
RESFLAGS = /i../include
# This manifest thing is for VC8, enabled by the maketgz script that
# builds the VC8 version of this makefile. Left commented out in the VC9
# version!
#MANIFESTTOOL = mt -manifest $(PROGRAM_NAME).manifest -outputresource:$(PROGRAM_NAME);1
!IFDEF WINDOWS_SSPI
CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
nonblockr.obj \
strcaser.obj \
strtoofftr.obj \
warnless.obj \
slist_wc.obj \
tool_binmoder.obj \
tool_bnamer.obj \
tool_cb_dbgr.obj \
tool_cb_hdrr.obj \
tool_cb_prgr.obj \
tool_cb_rear.obj \
tool_cb_seer.obj \
tool_cb_wrtr.obj \
tool_cfgabler.obj \
tool_convertr.obj \
tool_dirhier.obj \
tool_doswinr.obj \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_hugehelpr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_metalinkr.obj \
tool_mfilesr.obj \
tool_msgsr.obj \
tool_operater.obj \
tool_operhlpr.obj \
tool_panykeyr.obj \
tool_paramhlpr.obj \
tool_parsecfgr.obj \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
nonblockd.obj \
strcased.obj \
strtoofftd.obj \
warnlessd.obj \
slist_wcd.obj \
tool_binmoded.obj \
tool_bnamed.obj \
tool_cb_dbgd.obj \
tool_cb_hdrd.obj \
tool_cb_prgd.obj \
tool_cb_read.obj \
tool_cb_seed.obj \
tool_cb_wrtd.obj \
tool_cfgabled.obj \
tool_convertd.obj \
tool_dirhied.obj \
tool_doswind.obj \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_hugehelpd.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_metalinkd.obj \
tool_mfilesd.obj \
tool_msgsd.obj \
tool_operated.obj \
tool_operhlpd.obj \
tool_panykeyd.obj \
tool_paramhlpd.obj \
tool_parsecfgd.obj \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
# If CFG not specified, use static libs
CFLAGS = $(CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG)
#################################################
# release dynamic library
!IF "$(CFG)" == "release-dll"
LINKLIBS = $(LIBCURL_IMP_LIB_REL)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG)
!ENDIF
#################################################
# release static library with zlib
!IF "$(CFG)" == "release-zlib"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with ssl
!IF "$(CFG)" == "release-ssl"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl
!IF "$(CFG)" == "release-dll-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with ssl and zlib
!IF "$(CFG)" == "release-ssl-zlib"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(SSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with winssl and zlib
!IF "$(CFG)" == "release-winssl-zlib"
CFLAGS = $(CFLAGS) $(WINSSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(WINSSL_LIBS) $(ZLIB_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(WINSSL_LIBS) $(ZLIB_LIBS)
LFLAGS = $(LFLAGS) $(WINSSL_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl
!IF "$(CFG)" == "release-ssl-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic zlib
!IF "$(CFG)" == "release-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic zlib
!IF "$(CFG)" == "release-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release static library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS) /DCURL_STATICLIB
LINKLIBS = $(LIBCURL_STA_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_STA_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
#################################################
# release dynamic library with dynamic ssl and dynamic zlib
!IF "$(CFG)" == "release-dll-ssl-dll-zlib-dll"
CFLAGS = $(CFLAGS) $(SSL_CFLAGS) $(ZLIB_CFLAGS)
LINKLIBS = $(LIBCURL_IMP_LIB_REL) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LINKLIBS_DEBUG = $(LIBCURL_IMP_LIB_DBG) $(SSL_LIBS) $(ZLIB_IMP_LIBS)
LFLAGS = $(LFLAGS) $(SSL_IMP_LFLAGS) $(ZLIB_LFLAGS)
!ENDIF
LINKLIBS = $(LINKLIBS) $(WINLIBS)
LINKLIBS_DEBUG = $(LINKLIBS_DEBUG) $(WINLIBS)
all : release
release: $(RELEASE_OBJS)
$(LINKR) $(LFLAGS) $(LINKLIBS) $(RELEASE_OBJS)
$(MANIFESTTOOL)
debug: $(DEBUG_OBJS)
$(LINKD) $(LFLAGS) $(LINKLIBS_DEBUG) $(DEBUG_OBJS)
$(MANIFESTTOOL)
## Release
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcaser.obj: ../lib/strcase.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftr.obj: ../lib/strtoofft.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnless.obj: ../lib/warnless.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wc.obj: slist_wc.c
$(CCR) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoder.obj: tool_binmode.c
$(CCR) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamer.obj: tool_bname.c
$(CCR) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgr.obj: tool_cb_dbg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrr.obj: tool_cb_hdr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgr.obj: tool_cb_prg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_rear.obj: tool_cb_rea.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seer.obj: tool_cb_see.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtr.obj: tool_cb_wrt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabler.obj: tool_cfgable.c
$(CCR) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertr.obj: tool_convert.c
$(CCR) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhier.obj: tool_dirhie.c
$(CCR) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswinr.obj: tool_doswin.c
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcr.obj: tool_easysrc.c
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpr.obj: tool_hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
$(CCR) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkr.obj: tool_metalink.c
$(CCR) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesr.obj: tool_mfiles.c
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsr.obj: tool_msgs.c
$(CCR) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operater.obj: tool_operate.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpr.obj: tool_operhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyr.obj: tool_panykey.c
$(CCR) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpr.obj: tool_paramhlp.c
$(CCR) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgr.obj: tool_parsecfg.c
$(CCR) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptr.obj: tool_setopt.c
$(CCR) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
strcased.obj: ../lib/strcase.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strcase.c
strtoofftd.obj: ../lib/strtoofft.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
warnlessd.obj: ../lib/warnless.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/warnless.c
slist_wcd.obj: slist_wc.c
$(CCD) $(CFLAGS) /Fo"$@" slist_wc.c
tool_binmoded.obj: tool_binmode.c
$(CCD) $(CFLAGS) /Fo"$@" tool_binmode.c
tool_bnamed.obj: tool_bname.c
$(CCD) $(CFLAGS) /Fo"$@" tool_bname.c
tool_cb_dbgd.obj: tool_cb_dbg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_dbg.c
tool_cb_hdrd.obj: tool_cb_hdr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_hdr.c
tool_cb_prgd.obj: tool_cb_prg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_prg.c
tool_cb_read.obj: tool_cb_rea.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_rea.c
tool_cb_seed.obj: tool_cb_see.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_see.c
tool_cb_wrtd.obj: tool_cb_wrt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cb_wrt.c
tool_cfgabled.obj: tool_cfgable.c
$(CCD) $(CFLAGS) /Fo"$@" tool_cfgable.c
tool_convertd.obj: tool_convert.c
$(CCD) $(CFLAGS) /Fo"$@" tool_convert.c
tool_dirhied.obj: tool_dirhie.c
$(CCD) $(CFLAGS) /Fo"$@" tool_dirhie.c
tool_doswind.obj: tool_doswin.c
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
tool_easysrcd.obj: tool_easysrc.c
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_hugehelpd.obj: tool_hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" tool_hugehelp.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
$(CCD) $(CFLAGS) /Fo"$@" tool_main.c
tool_metalinkd.obj: tool_metalink.c
$(CCD) $(CFLAGS) /Fo"$@" tool_metalink.c
tool_mfilesd.obj: tool_mfiles.c
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
tool_msgsd.obj: tool_msgs.c
$(CCD) $(CFLAGS) /Fo"$@" tool_msgs.c
tool_operated.obj: tool_operate.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operate.c
tool_operhlpd.obj: tool_operhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_operhlp.c
tool_panykeyd.obj: tool_panykey.c
$(CCD) $(CFLAGS) /Fo"$@" tool_panykey.c
tool_paramhlpd.obj: tool_paramhlp.c
$(CCD) $(CFLAGS) /Fo"$@" tool_paramhlp.c
tool_parsecfgd.obj: tool_parsecfg.c
$(CCD) $(CFLAGS) /Fo"$@" tool_parsecfg.c
tool_setoptd.obj: tool_setopt.c
$(CCD) $(CFLAGS) /Fo"$@" tool_setopt.c
tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc
clean:
@-erase $(PROGRAM_NAME) 2> NUL
@-erase $(RELEASE_OBJS) 2> NUL
@-erase $(DEBUG_OBJS) 2> NUL
@-erase *.idb 2> NUL
@-erase *.pdb 2> NUL
@-erase *.pch 2> NUL
@-erase *.ilk 2> NUL

63
3rd-party/curl-7.52.1/src/curl.rc vendored Normal file
View File

@@ -0,0 +1,63 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <winver.h>
#include "tool_version.h"
LANGUAGE 0x09,0x01
#define RC_VERSION CURL_VERSION_MAJOR, CURL_VERSION_MINOR, CURL_VERSION_PATCH, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION RC_VERSION
PRODUCTVERSION RC_VERSION
FILEFLAGSMASK 0x3fL
#if defined(DEBUGBUILD) || defined(_DEBUG)
FILEFLAGS 1
#else
FILEFLAGS 0
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "curl, https://curl.haxx.se/\0"
VALUE "FileDescription", "The curl executable\0"
VALUE "FileVersion", CURL_VERSION "\0"
VALUE "InternalName", "curl\0"
VALUE "OriginalFilename", "curl.exe\0"
VALUE "ProductName", "The curl executable\0"
VALUE "ProductVersion", CURL_VERSION "\0"
VALUE "LegalCopyright", "<22> " CURL_COPYRIGHT "\0"
VALUE "License", "https://curl.haxx.se/docs/copyright.html\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -0,0 +1 @@
MACOS (not MACOS X)

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/**************** BEGIN GUSI CONFIGURATION ****************************

View File

@@ -0,0 +1 @@
/* =========================================================================

View File

@@ -0,0 +1,30 @@
#
# $VER: curl Makefile for AmigaOS ...
#
# change the follow to where you have the AmiTCP SDK v4.3 includes:
ATCPSDKI= /GG/netinclude
CC = m68k-amigaos-gcc
CFLAGS = -I$(ATCPSDKI) -m68020-60 -O2 -msoft-float -noixemul -g -I. -I../include -W -Wall
LIBS = ../lib/libcurl.a -lssl -lcrypto -lz
MANPAGE = ../docs/curl.1
README = ../docs/MANUAL
MKHELP = ../src/mkhelp.pl
include Makefile.inc
OBJS = $(CURL_CFILES:.c=.o) $(CURLX_CFILES:.c=.o)
all: tool_hugehelp.c $(OBJS)
$(CC) $(CFLAGS) -o curl $(OBJS) $(LIBS) -Wl,-Map,curl.map,--cref
tool_hugehelp.c: $(README) $(MANPAGE) mkhelp.pl
rm -f tool_hugehelp.c
/bin/nroff -man $(MANPAGE) | /bin/perl $(MKHELP) -c $(README) > tool_hugehelp.c
install:
$(INSTALL) -c curl /c/curl

96
3rd-party/curl-7.52.1/src/makefile.dj vendored Normal file
View File

@@ -0,0 +1,96 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2003 - 2007, Gisle Vanem <gvanem@yahoo.no>.
# Copyright (C) 2003 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
#***************************************************************************
#
# Adapted for djgpp2 / Watt-32 / DOS
#
DEPEND_PREREQ = # tool_hugehelp.c
TOPDIR = ..
include ../packages/DOS/common.dj
include Makefile.inc
CSOURCES = $(CURL_CFILES)
ifeq ($(USE_SSL),1)
EX_LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a
endif
ifeq ($(USE_ARES),1)
EX_LIBS += $(ARES_ROOT)/libcares.a
endif
ifeq ($(USE_ZLIB),1)
EX_LIBS += $(ZLIB_ROOT)/libz.a
CFLAGS += -DUSE_MANUAL
endif
ifeq ($(USE_IDNA),1)
EX_LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv
endif
EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a
CFLAGS += -DUSE_ENVIRONMENT
PROGRAM = curl.exe
OBJECTS += $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o))
all: $(OBJ_DIR) $(PROGRAM)
@echo Welcome to curl
$(PROGRAM): $(OBJECTS) ../lib/libcurl.a
$(CC) -o $@ $^ $(LDFLAGS) $(EX_LIBS)
#
# groff 1.18+ requires "-P -c"
#
tool_hugehelp.c: ../docs/MANUAL ../docs/curl.1 mkhelp.pl
groff -Tascii -man ../docs/curl.1 | \
perl -w mkhelp.pl ../docs/MANUAL > $@
# clean generated files
#
genclean:
- $(DELETE) tool_hugehelp.c
# clean object files and subdir
#
objclean: genclean
- $(DELETE) $(OBJ_DIR)$(DS)*.o
- $(RMDIR) $(OBJ_DIR)
# clean without removing built program
#
clean: objclean
- $(DELETE) depend.dj
# clean everything
#
realclean vclean: clean
- $(DELETE) $(PROGRAM)
-include depend.dj

274
3rd-party/curl-7.52.1/src/mkhelp.pl vendored Normal file
View File

@@ -0,0 +1,274 @@
#!/usr/local/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
# Yeah, I know, probably 1000 other persons already wrote a script like
# this, but I'll tell ya:
# THEY DON'T FIT ME :-)
# Get readme file as parameter:
if($ARGV[0] eq "-c") {
$c=1;
shift @ARGV;
}
my $README = $ARGV[0];
if($README eq "") {
print "usage: mkreadme.pl [-c] <README> < manpage\n";
exit;
}
push @out, " _ _ ____ _\n";
push @out, " Project ___| | | | _ \\| |\n";
push @out, " / __| | | | |_) | |\n";
push @out, " | (__| |_| | _ <| |___\n";
push @out, " \\___|\\___/|_| \\_\\_____|\n";
my $olen=0;
while (<STDIN>) {
my $line = $_;
# this should be removed:
$line =~ s/(.|_)//g;
# remove trailing CR from line. msysgit checks out files as line+CRLF
$line =~ s/\r$//;
if($line =~ /^([ \t]*\n|curl)/i) {
# cut off headers and empty lines
$wline++; # count number of cut off lines
next;
}
my $text = $line;
$text =~ s/^\s+//g; # cut off preceding...
$text =~ s/\s+$//g; # and trailing whitespaces
$tlen = length($text);
if($wline && ($olen == $tlen)) {
# if the previous line with contents was exactly as long as
# this line, then we ignore the newlines!
# We do this magic because a header may abort a paragraph at
# any line, but we don't want that to be noticed in the output
# here
$wline=0;
}
$olen = $tlen;
if($wline) {
# we only make one empty line max
$wline = 0;
push @out, "\n";
}
push @out, $line;
}
push @out, "\n"; # just an extra newline
open(READ, "<$README") ||
die "couldn't read the README infile $README";
while(<READ>) {
my $line = $_;
# remove trailing CR from line. msysgit checks out files as line+CRLF
$line =~ s/\r$//;
push @out, $line;
}
close(READ);
# if compressed
if($c) {
my @test = `gzip --version 2>&1`;
if($test[0] =~ /gzip/) {
open(GZIP, ">dumpit") ||
die "can't create the dumpit file, try without -c";
binmode GZIP;
for(@out) {
print GZIP $_;
$gzip += length($_);
}
close(GZIP);
system("gzip --best --no-name dumpit");
open(GZIP, "<dumpit.gz") ||
die "can't read the dumpit.gz file, try without -c";
binmode GZIP;
while(<GZIP>) {
push @gzip, $_;
$gzipped += length($_);
}
close(GZIP);
unlink("dumpit.gz");
}
else {
# no gzip, no compression!
undef $c;
print STDERR "MEEEP: Couldn't find gzip, disable compression\n";
}
}
$now = localtime;
print <<HEAD
/*
* NEVER EVER edit this manually, fix the mkhelp.pl script instead!
* Generation time: $now
*/
#ifdef USE_MANUAL
#include "tool_hugehelp.h"
HEAD
;
if($c) {
print <<HEAD
#include <zlib.h>
#include "memdebug.h" /* keep this as LAST include */
static const unsigned char hugehelpgz[] = {
/* This mumbo-jumbo is the huge help text compressed with gzip.
Thanks to this operation, the size of this data shrunk from $gzip
to $gzipped bytes. You can disable the use of compressed help
texts by NOT passing -c to the mkhelp.pl tool. */
HEAD
;
my $c=0;
print " ";
for(@gzip) {
my @all=split(//, $_);
for(@all) {
my $num=ord($_);
printf(" 0x%02x,", 0+$num);
if(++$c>11) {
print "\n ";
$c=0;
}
}
}
print "\n};\n";
print <<EOF
#define BUF_SIZE 0x10000
static voidpf zalloc_func(voidpf opaque, unsigned int items, unsigned int size)
{
(void) opaque;
/* not a typo, keep it calloc() */
return (voidpf) calloc(items, size);
}
static void zfree_func(voidpf opaque, voidpf ptr)
{
(void) opaque;
free(ptr);
}
/* Decompress and send to stdout a gzip-compressed buffer */
void hugehelp(void)
{
unsigned char* buf;
int status,headerlen;
z_stream z;
/* Make sure no gzip options are set */
if (hugehelpgz[3] & 0xfe)
return;
headerlen = 10;
memset(&z, 0, sizeof(z_stream));
z.zalloc = (alloc_func)zalloc_func;
z.zfree = (free_func)zfree_func;
z.avail_in = (unsigned int)(sizeof(hugehelpgz) - headerlen);
z.next_in = (unsigned char *)hugehelpgz + headerlen;
if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
return;
buf = malloc(BUF_SIZE);
if (buf) {
while(1) {
z.avail_out = BUF_SIZE;
z.next_out = buf;
status = inflate(&z, Z_SYNC_FLUSH);
if (status == Z_OK || status == Z_STREAM_END) {
fwrite(buf, BUF_SIZE - z.avail_out, 1, stdout);
if (status == Z_STREAM_END)
break;
}
else
break; /* Error */
}
free(buf);
}
inflateEnd(&z);
}
EOF
;
foot();
exit;
}
else {
print <<HEAD
void hugehelp(void)
{
fputs(
HEAD
;
}
$outsize=0;
for(@out) {
chop;
$new = $_;
$outsize += length($new)+1; # one for the newline
$new =~ s/\\/\\\\/g;
$new =~ s/\"/\\\"/g;
# gcc 2.96 claims ISO C89 only is required to support 509 letter strings
if($outsize > 500) {
# terminate and make another fputs() call here
print ", stdout);\n fputs(\n";
$outsize=length($new)+1;
}
printf("\"%s\\n\"\n", $new);
}
print ", stdout) ;\n}\n";
foot();
sub foot {
print <<FOOT
#else /* !USE_MANUAL */
/* built-in manual is disabled, blank function */
#include "tool_hugehelp.h"
void hugehelp(void) {}
#endif /* USE_MANUAL */
FOOT
;
}

72
3rd-party/curl-7.52.1/src/slist_wc.c vendored Normal file
View File

@@ -0,0 +1,72 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
#include "slist_wc.h"
/* The last #include files should be: */
#include "memdebug.h"
/*
* slist_wc_append() appends a string to the linked list. This function can be
* used as an initialization function as well as an append function.
*/
struct slist_wc *slist_wc_append(struct slist_wc *list,
const char *data)
{
struct curl_slist *new_item = curl_slist_append(NULL, data);
if(!new_item)
return NULL;
if(!list) {
list = malloc(sizeof(struct slist_wc));
if(!list) {
curl_slist_free_all(new_item);
return NULL;
}
list->first = new_item;
list->last = new_item;
return list;
}
list->last->next = new_item;
list->last = list->last->next;
return list;
}
/* be nice and clean up resources */
void slist_wc_free_all(struct slist_wc *list)
{
if(!list)
return;
curl_slist_free_all(list->first);
free(list);
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */

56
3rd-party/curl-7.52.1/src/slist_wc.h vendored Normal file
View File

@@ -0,0 +1,56 @@
#ifndef HEADER_CURL_SLIST_WC_H
#define HEADER_CURL_SLIST_WC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* linked-list structure with last node cache for easysrc */
struct slist_wc {
struct curl_slist *first;
struct curl_slist *last;
};
/*
* NAME curl_slist_wc_append()
*
* DESCRIPTION
*
* Appends a string to a linked list. If no list exists, it will be created
* first. Returns the new list, after appending.
*/
struct slist_wc *slist_wc_append(struct slist_wc *, const char *);
/*
* NAME curl_slist_free_all()
*
* DESCRIPTION
*
* free a previously built curl_slist_wc.
*/
void slist_wc_free_all(struct slist_wc *);
#endif /* CURL_DISABLE_LIBCURL_OPTION */
#endif /* HEADER_CURL_SLIST_WC_H */

View File

@@ -0,0 +1,52 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef HAVE_SETMODE
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#include "tool_binmode.h"
#include "memdebug.h" /* keep this as LAST include */
void set_binmode(FILE *stream)
{
#ifdef O_BINARY
# ifdef __HIGHC__
_setmode(stream, O_BINARY);
# else
(void)setmode(fileno(stream), O_BINARY);
# endif
#else
(void)stream;
#endif
}
#endif /* HAVE_SETMODE */

View File

@@ -0,0 +1,37 @@
#ifndef HEADER_CURL_TOOL_BINMODE_H
#define HEADER_CURL_TOOL_BINMODE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef HAVE_SETMODE
void set_binmode(FILE *stream);
#else
#define set_binmode(x) Curl_nop_stmt
#endif /* HAVE_SETMODE */
#endif /* HEADER_CURL_TOOL_BINMODE_H */

50
3rd-party/curl-7.52.1/src/tool_bname.c vendored Normal file
View File

@@ -0,0 +1,50 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_bname.h"
#include "memdebug.h" /* keep this as LAST include */
#ifndef HAVE_BASENAME
char *tool_basename(char *path)
{
char *s1;
char *s2;
s1 = strrchr(path, '/');
s2 = strrchr(path, '\\');
if(s1 && s2) {
path = (s1 > s2) ? s1 + 1 : s2 + 1;
}
else if(s1)
path = s1 + 1;
else if(s2)
path = s2 + 1;
return path;
}
#endif /* HAVE_BASENAME */

35
3rd-party/curl-7.52.1/src/tool_bname.h vendored Normal file
View File

@@ -0,0 +1,35 @@
#ifndef HEADER_CURL_TOOL_BNAME_H
#define HEADER_CURL_TOOL_BNAME_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef HAVE_BASENAME
char *tool_basename(char *path);
#define basename(x) tool_basename((x))
#endif /* HAVE_BASENAME */
#endif /* HEADER_CURL_TOOL_BNAME_H */

275
3rd-party/curl-7.52.1/src/tool_cb_dbg.c vendored Normal file
View File

@@ -0,0 +1,275 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "tool_cb_dbg.h"
#include "tool_util.h"
#include "memdebug.h" /* keep this as LAST include */
static void dump(const char *timebuf, const char *text,
FILE *stream, const unsigned char *ptr, size_t size,
trace tracetype, curl_infotype infotype);
/*
** callback for CURLOPT_DEBUGFUNCTION
*/
int tool_debug_cb(CURL *handle, curl_infotype type,
unsigned char *data, size_t size,
void *userdata)
{
struct OperationConfig *operation = userdata;
struct GlobalConfig *config = operation->global;
FILE *output = config->errors;
const char *text;
struct timeval tv;
struct tm *now;
char timebuf[20];
time_t secs;
static time_t epoch_offset;
static int known_offset;
(void)handle; /* not used */
if(config->tracetime) {
tv = tvnow();
if(!known_offset) {
epoch_offset = time(NULL) - tv.tv_sec;
known_offset = 1;
}
secs = epoch_offset + tv.tv_sec;
now = localtime(&secs); /* not thread safe but we don't care */
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld ",
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);
}
else
timebuf[0] = 0;
if(!config->trace_stream) {
/* open for append */
if(!strcmp("-", config->trace_dump))
config->trace_stream = stdout;
else if(!strcmp("%", config->trace_dump))
/* Ok, this is somewhat hackish but we do it undocumented for now */
config->trace_stream = config->errors; /* aka stderr */
else {
config->trace_stream = fopen(config->trace_dump, FOPEN_WRITETEXT);
config->trace_fopened = TRUE;
}
}
if(config->trace_stream)
output = config->trace_stream;
if(!output) {
warnf(config, "Failed to create/open output");
return 0;
}
if(config->tracetype == TRACE_PLAIN) {
/*
* This is the trace look that is similar to what libcurl makes on its
* own.
*/
static const char * const s_infotype[] = {
"*", "<", ">", "{", "}", "{", "}"
};
size_t i;
size_t st = 0;
static bool newl = FALSE;
static bool traced_data = FALSE;
switch(type) {
case CURLINFO_HEADER_OUT:
if(size > 0) {
for(i = 0; i < size - 1; i++) {
if(data[i] == '\n') { /* LF */
if(!newl) {
fprintf(output, "%s%s ", timebuf, s_infotype[type]);
}
(void)fwrite(data + st, i - st + 1, 1, output);
st = i + 1;
newl = FALSE;
}
}
if(!newl)
fprintf(output, "%s%s ", timebuf, s_infotype[type]);
(void)fwrite(data + st, i - st + 1, 1, output);
}
newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE;
traced_data = FALSE;
break;
case CURLINFO_TEXT:
case CURLINFO_HEADER_IN:
if(!newl)
fprintf(output, "%s%s ", timebuf, s_infotype[type]);
(void)fwrite(data, size, 1, output);
newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE;
traced_data = FALSE;
break;
case CURLINFO_DATA_OUT:
case CURLINFO_DATA_IN:
case CURLINFO_SSL_DATA_IN:
case CURLINFO_SSL_DATA_OUT:
if(!traced_data) {
/* if the data is output to a tty and we're sending this debug trace
to stderr or stdout, we don't display the alert about the data not
being shown as the data _is_ shown then just not via this
function */
if(!config->isatty || ((output != stderr) && (output != stdout))) {
if(!newl)
fprintf(output, "%s%s ", timebuf, s_infotype[type]);
fprintf(output, "[%zd bytes data]\n", size);
newl = FALSE;
traced_data = TRUE;
}
}
break;
default: /* nada */
newl = FALSE;
traced_data = FALSE;
break;
}
return 0;
}
#ifdef CURL_DOES_CONVERSIONS
/* Special processing is needed for CURLINFO_HEADER_OUT blocks
* if they contain both headers and data (separated by CRLFCRLF).
* We dump the header text and then switch type to CURLINFO_DATA_OUT.
*/
if((type == CURLINFO_HEADER_OUT) && (size > 4)) {
size_t i;
for(i = 0; i < size - 4; i++) {
if(memcmp(&data[i], "\r\n\r\n", 4) == 0) {
/* dump everything through the CRLFCRLF as a sent header */
text = "=> Send header";
dump(timebuf, text, output, data, i + 4, config->tracetype, type);
data += i + 3;
size -= i + 4;
type = CURLINFO_DATA_OUT;
data += 1;
break;
}
}
}
#endif /* CURL_DOES_CONVERSIONS */
switch(type) {
case CURLINFO_TEXT:
fprintf(output, "%s== Info: %s", timebuf, data);
default: /* in case a new one is introduced to shock us */
return 0;
case CURLINFO_HEADER_OUT:
text = "=> Send header";
break;
case CURLINFO_DATA_OUT:
text = "=> Send data";
break;
case CURLINFO_HEADER_IN:
text = "<= Recv header";
break;
case CURLINFO_DATA_IN:
text = "<= Recv data";
break;
case CURLINFO_SSL_DATA_IN:
text = "<= Recv SSL data";
break;
case CURLINFO_SSL_DATA_OUT:
text = "=> Send SSL data";
break;
}
dump(timebuf, text, output, data, size, config->tracetype, type);
return 0;
}
static void dump(const char *timebuf, const char *text,
FILE *stream, const unsigned char *ptr, size_t size,
trace tracetype, curl_infotype infotype)
{
size_t i;
size_t c;
unsigned int width = 0x10;
if(tracetype == TRACE_ASCII)
/* without the hex output, we can fit more on screen */
width = 0x40;
fprintf(stream, "%s%s, %zd bytes (0x%zx)\n", timebuf, text, size, size);
for(i = 0; i < size; i += width) {
fprintf(stream, "%04zx: ", i);
if(tracetype == TRACE_BIN) {
/* hex not disabled, show it */
for(c = 0; c < width; c++)
if(i+c < size)
fprintf(stream, "%02x ", ptr[i+c]);
else
fputs(" ", stream);
}
for(c = 0; (c < width) && (i+c < size); c++) {
/* check for 0D0A; if found, skip past and start a new line of output */
if((tracetype == TRACE_ASCII) &&
(i+c+1 < size) && (ptr[i+c] == 0x0D) && (ptr[i+c+1] == 0x0A)) {
i += (c+2-width);
break;
}
#ifdef CURL_DOES_CONVERSIONS
/* repeat the 0D0A check above but use the host encoding for CRLF */
if((tracetype == TRACE_ASCII) &&
(i+c+1 < size) && (ptr[i+c] == '\r') && (ptr[i+c+1] == '\n')) {
i += (c+2-width);
break;
}
/* convert to host encoding and print this character */
fprintf(stream, "%c", convert_char(infotype, ptr[i+c]));
#else
(void)infotype;
fprintf(stream, "%c", ((ptr[i+c] >= 0x20) && (ptr[i+c] < 0x80)) ?
ptr[i+c] : UNPRINTABLE_CHAR);
#endif /* CURL_DOES_CONVERSIONS */
/* check again for 0D0A, to avoid an extra \n if it's at width */
if((tracetype == TRACE_ASCII) &&
(i+c+2 < size) && (ptr[i+c+1] == 0x0D) && (ptr[i+c+2] == 0x0A)) {
i += (c+3-width);
break;
}
}
fputc('\n', stream); /* newline */
}
fflush(stream);
}

35
3rd-party/curl-7.52.1/src/tool_cb_dbg.h vendored Normal file
View File

@@ -0,0 +1,35 @@
#ifndef HEADER_CURL_TOOL_CB_DBG_H
#define HEADER_CURL_TOOL_CB_DBG_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
** callback for CURLOPT_DEBUGFUNCTION
*/
int tool_debug_cb(CURL *handle, curl_infotype type,
unsigned char *data, size_t size,
void *userdata);
#endif /* HEADER_CURL_TOOL_CB_DBG_H */

240
3rd-party/curl-7.52.1/src/tool_cb_hdr.c vendored Normal file
View File

@@ -0,0 +1,240 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_doswin.h"
#include "tool_msgs.h"
#include "tool_cb_hdr.h"
#include "memdebug.h" /* keep this as LAST include */
static char *parse_filename(const char *ptr, size_t len);
/*
** callback for CURLOPT_HEADERFUNCTION
*/
size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
{
struct HdrCbData *hdrcbdata = userdata;
struct OutStruct *outs = hdrcbdata->outs;
struct OutStruct *heads = hdrcbdata->heads;
const char *str = ptr;
const size_t cb = size * nmemb;
const char *end = (char *)ptr + cb;
char *url = NULL;
/*
* Once that libcurl has called back tool_header_cb() the returned value
* is checked against the amount that was intended to be written, if
* it does not match then it fails with CURLE_WRITE_ERROR. So at this
* point returning a value different from sz*nmemb indicates failure.
*/
size_t failure = (size * nmemb) ? 0 : 1;
if(!heads->config)
return failure;
#ifdef DEBUGBUILD
if(size * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
warnf(heads->config->global, "Header data exceeds single call write "
"limit!\n");
return failure;
}
#endif
/*
* Write header data when curl option --dump-header (-D) is given.
*/
if(heads->config->headerfile && heads->stream) {
size_t rc = fwrite(ptr, size, nmemb, heads->stream);
if(rc != cb)
return rc;
/* flush the stream to send off what we got earlier */
(void)fflush(heads->stream);
}
/*
* This callback sets the filename where output shall be written when
* curl options --remote-name (-O) and --remote-header-name (-J) have
* been simultaneously given and additionally server returns an HTTP
* Content-Disposition header specifying a filename property.
*/
if(hdrcbdata->honor_cd_filename &&
(cb > 20) && checkprefix("Content-disposition:", str) &&
!curl_easy_getinfo(outs->config->easy, CURLINFO_EFFECTIVE_URL, &url) &&
url && (checkprefix("http://", url) || checkprefix("https://", url))) {
const char *p = str + 20;
/* look for the 'filename=' parameter
(encoded filenames (*=) are not supported) */
for(;;) {
char *filename;
size_t len;
while(*p && (p < end) && !ISALPHA(*p))
p++;
if(p > end - 9)
break;
if(memcmp(p, "filename=", 9)) {
/* no match, find next parameter */
while((p < end) && (*p != ';'))
p++;
continue;
}
p += 9;
/* this expression below typecasts 'cb' only to avoid
warning: signed and unsigned type in conditional expression
*/
len = (ssize_t)cb - (p - str);
filename = parse_filename(p, len);
if(filename) {
outs->filename = filename;
outs->alloc_filename = TRUE;
outs->is_cd_filename = TRUE;
outs->s_isreg = TRUE;
outs->fopened = FALSE;
outs->stream = NULL;
hdrcbdata->honor_cd_filename = FALSE;
break;
}
else
return failure;
}
}
return cb;
}
/*
* Copies a file name part and returns an ALLOCATED data buffer.
*/
static char *parse_filename(const char *ptr, size_t len)
{
char *copy;
char *p;
char *q;
char stop = '\0';
/* simple implementation of strndup() */
copy = malloc(len+1);
if(!copy)
return NULL;
memcpy(copy, ptr, len);
copy[len] = '\0';
p = copy;
if(*p == '\'' || *p == '"') {
/* store the starting quote */
stop = *p;
p++;
}
else
stop = ';';
/* if the filename contains a path, only use filename portion */
q = strrchr(copy, '/');
if(q) {
p = q + 1;
if(!*p) {
Curl_safefree(copy);
return NULL;
}
}
/* If the filename contains a backslash, only use filename portion. The idea
is that even systems that don't handle backslashes as path separators
probably want the path removed for convenience. */
q = strrchr(p, '\\');
if(q) {
p = q + 1;
if(!*p) {
Curl_safefree(copy);
return NULL;
}
}
/* scan for the end letter and stop there */
for(q = p; *q; ++q) {
if(*q == stop) {
*q = '\0';
break;
}
}
/* make sure the file name doesn't end in \r or \n */
q = strchr(p, '\r');
if(q)
*q = '\0';
q = strchr(p, '\n');
if(q)
*q = '\0';
if(copy != p)
memmove(copy, p, strlen(p) + 1);
#if defined(MSDOS) || defined(WIN32)
{
char *sanitized;
SANITIZEcode sc = sanitize_file_name(&sanitized, copy, 0);
Curl_safefree(copy);
if(sc)
return NULL;
copy = sanitized;
}
#endif /* MSDOS || WIN32 */
/* in case we built debug enabled, we allow an evironment variable
* named CURL_TESTDIR to prefix the given file name to put it into a
* specific directory
*/
#ifdef DEBUGBUILD
{
char *tdir = curlx_getenv("CURL_TESTDIR");
if(tdir) {
char buffer[512]; /* suitably large */
snprintf(buffer, sizeof(buffer), "%s/%s", tdir, copy);
Curl_safefree(copy);
copy = strdup(buffer); /* clone the buffer, we don't use the libcurl
aprintf() or similar since we want to use the
same memory code as the "real" parse_filename
function */
curl_free(tdir);
}
}
#endif
return copy;
}

54
3rd-party/curl-7.52.1/src/tool_cb_hdr.h vendored Normal file
View File

@@ -0,0 +1,54 @@
#ifndef HEADER_CURL_TOOL_CB_HDR_H
#define HEADER_CURL_TOOL_CB_HDR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
* curl operates using a single HdrCbData struct variable, a
* pointer to this is passed as userdata pointer to tool_header_cb.
*
* 'outs' member is a pointer to the OutStruct variable used to keep
* track of information relative to curl's output writing.
*
* 'heads' member is a pointer to the OutStruct variable used to keep
* track of information relative to header response writing.
*
* 'honor_cd_filename' member is TRUE when tool_header_cb is allowed
* to honor Content-Disposition filename property and accordingly
* set 'outs' filename, otherwise FALSE;
*/
struct HdrCbData {
struct OutStruct *outs;
struct OutStruct *heads;
bool honor_cd_filename;
};
/*
** callback for CURLOPT_HEADERFUNCTION
*/
size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata);
#endif /* HEADER_CURL_TOOL_CB_HDR_H */

150
3rd-party/curl-7.52.1/src/tool_cb_prg.c vendored Normal file
View File

@@ -0,0 +1,150 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_cb_prg.h"
#include "tool_util.h"
#include "memdebug.h" /* keep this as LAST include */
/*
** callback for CURLOPT_XFERINFOFUNCTION
*/
#define MAX_BARLENGTH 256
int tool_progress_cb(void *clientp,
curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ultotal, curl_off_t ulnow)
{
/* The original progress-bar source code was written for curl by Lars Aas,
and this new edition inherits some of his concepts. */
char line[MAX_BARLENGTH+1];
char format[40];
double frac;
double percent;
int barwidth;
int num;
struct timeval now = tvnow();
struct ProgressData *bar = (struct ProgressData *)clientp;
curl_off_t total;
curl_off_t point;
/* expected transfer size */
total = dltotal + ultotal + bar->initial_size;
/* we've come this far */
point = dlnow + ulnow + bar->initial_size;
if(bar->calls && (tvdiff(now, bar->prevtime) < 100L) && point < total)
/* after first call, limit progress-bar updating to 10 Hz */
/* update when we're at 100% even if last update is less than 200ms ago */
return 0;
if(point > total)
/* we have got more than the expected total! */
total = point;
/* simply count invokes */
bar->calls++;
if(total < 1) {
curl_off_t prevblock = bar->prev / 1024;
curl_off_t thisblock = point / 1024;
while(thisblock > prevblock) {
fprintf(bar->out, "#");
prevblock++;
}
}
else if(point != bar->prev) {
frac = (double)point / (double)total;
percent = frac * 100.0f;
barwidth = bar->width - 7;
num = (int) (((double)barwidth) * frac);
if(num > MAX_BARLENGTH)
num = MAX_BARLENGTH;
memset(line, '#', num);
line[num] = '\0';
snprintf(format, sizeof(format), "\r%%-%ds %%5.1f%%%%", barwidth);
fprintf(bar->out, format, line, percent);
}
fflush(bar->out);
bar->prev = point;
bar->prevtime = now;
return 0;
}
void progressbarinit(struct ProgressData *bar,
struct OperationConfig *config)
{
#ifdef __EMX__
/* 20000318 mgs */
int scr_size[2];
#endif
char *colp;
memset(bar, 0, sizeof(struct ProgressData));
/* pass this through to progress function so
* it can display progress towards total file
* not just the part that's left. (21-may-03, dbyron) */
if(config->use_resume)
bar->initial_size = config->resume_from;
/* TODO: get terminal width through ansi escapes or something similar.
try to update width when xterm is resized... - 19990617 larsa */
#ifndef __EMX__
/* 20000318 mgs
* OS/2 users most likely won't have this env var set, and besides that
* we're using our own way to determine screen width */
colp = curlx_getenv("COLUMNS");
if(colp) {
char *endptr;
long num = strtol(colp, &endptr, 10);
if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 0))
bar->width = (int)num;
else
bar->width = 79;
curl_free(colp);
}
else
bar->width = 79;
#else
/* 20000318 mgs
* We use this emx library call to get the screen width, and subtract
* one from what we got in order to avoid a problem with the cursor
* advancing to the next line if we print a string that is as long as
* the screen is wide. */
_scrsize(scr_size);
bar->width = scr_size[0] - 1;
#endif
bar->out = config->global->errors;
}

50
3rd-party/curl-7.52.1/src/tool_cb_prg.h vendored Normal file
View File

@@ -0,0 +1,50 @@
#ifndef HEADER_CURL_TOOL_CB_PRG_H
#define HEADER_CURL_TOOL_CB_PRG_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define CURL_PROGRESS_STATS 0 /* default progress display */
#define CURL_PROGRESS_BAR 1
struct ProgressData {
int calls;
curl_off_t prev;
struct timeval prevtime;
int width;
FILE *out; /* where to write everything to */
curl_off_t initial_size;
};
void progressbarinit(struct ProgressData *bar,
struct OperationConfig *config);
/*
** callback for CURLOPT_PROGRESSFUNCTION
*/
int tool_progress_cb(void *clientp,
curl_off_t dltotal, curl_off_t dlnow,
curl_off_t ultotal, curl_off_t ulnow);
#endif /* HEADER_CURL_TOOL_CB_PRG_H */

55
3rd-party/curl-7.52.1/src/tool_cb_rea.c vendored Normal file
View File

@@ -0,0 +1,55 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_cb_rea.h"
#include "memdebug.h" /* keep this as LAST include */
/*
** callback for CURLOPT_READFUNCTION
*/
size_t tool_read_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
{
ssize_t rc;
struct InStruct *in = userdata;
rc = read(in->fd, buffer, sz*nmemb);
if(rc < 0) {
if(errno == EAGAIN) {
errno = 0;
in->config->readbusy = TRUE;
return CURL_READFUNC_PAUSE;
}
/* since size_t is unsigned we can't return negative values fine */
rc = 0;
}
in->config->readbusy = FALSE;
return (size_t)rc;
}

33
3rd-party/curl-7.52.1/src/tool_cb_rea.h vendored Normal file
View File

@@ -0,0 +1,33 @@
#ifndef HEADER_CURL_TOOL_CB_REA_H
#define HEADER_CURL_TOOL_CB_REA_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
** callback for CURLOPT_READFUNCTION
*/
size_t tool_read_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);
#endif /* HEADER_CURL_TOOL_CB_REA_H */

131
3rd-party/curl-7.52.1/src/tool_cb_see.c vendored Normal file
View File

@@ -0,0 +1,131 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_cb_see.h"
#include "memdebug.h" /* keep this as LAST include */
/* OUR_MAX_SEEK_L has 'long' data type, OUR_MAX_SEEK_O has 'curl_off_t,
both represent the same value. Maximum offset used here when we lseek
using a 'long' data type offset */
#define OUR_MAX_SEEK_L 2147483647L - 1L
#define OUR_MAX_SEEK_O CURL_OFF_T_C(0x7FFFFFFF) - CURL_OFF_T_C(0x1)
/*
** callback for CURLOPT_SEEKFUNCTION
**
** Notice that this is not supposed to return the resulting offset. This
** shall only return CURL_SEEKFUNC_* return codes.
*/
int tool_seek_cb(void *userdata, curl_off_t offset, int whence)
{
struct InStruct *in = userdata;
#if(CURL_SIZEOF_CURL_OFF_T > SIZEOF_OFF_T) && !defined(USE_WIN32_LARGE_FILES)
/* The offset check following here is only interesting if curl_off_t is
larger than off_t and we are not using the WIN32 large file support
macros that provide the support to do 64bit seeks correctly */
if(offset > OUR_MAX_SEEK_O) {
/* Some precaution code to work around problems with different data sizes
to allow seeking >32bit even if off_t is 32bit. Should be very rare and
is really valid on weirdo-systems. */
curl_off_t left = offset;
if(whence != SEEK_SET)
/* this code path doesn't support other types */
return CURL_SEEKFUNC_FAIL;
if(LSEEK_ERROR == lseek(in->fd, 0, SEEK_SET))
/* couldn't rewind to beginning */
return CURL_SEEKFUNC_FAIL;
while(left) {
long step = (left > OUR_MAX_SEEK_O) ? OUR_MAX_SEEK_L : (long)left;
if(LSEEK_ERROR == lseek(in->fd, step, SEEK_CUR))
/* couldn't seek forwards the desired amount */
return CURL_SEEKFUNC_FAIL;
left -= step;
}
return CURL_SEEKFUNC_OK;
}
#endif
if(LSEEK_ERROR == lseek(in->fd, offset, whence))
/* couldn't rewind, the reason is in errno but errno is just not portable
enough and we don't actually care that much why we failed. We'll let
libcurl know that it may try other means if it wants to. */
return CURL_SEEKFUNC_CANTSEEK;
return CURL_SEEKFUNC_OK;
}
#if defined(WIN32) && !defined(__MINGW64__)
#ifdef __BORLANDC__
/* 64-bit lseek-like function unavailable */
# define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence)
#endif
#ifdef __POCC__
# if(__POCC__ < 450)
/* 64-bit lseek-like function unavailable */
# define _lseeki64(hnd,ofs,whence) _lseek(hnd,ofs,whence)
# else
# define _lseeki64(hnd,ofs,whence) _lseek64(hnd,ofs,whence)
# endif
#endif
#ifdef _WIN32_WCE
/* 64-bit lseek-like function unavailable */
# undef _lseeki64
# define _lseeki64(hnd,ofs,whence) lseek(hnd,ofs,whence)
# undef _get_osfhandle
# define _get_osfhandle(fd) (fd)
#endif
/*
* Truncate a file handle at a 64-bit position 'where'.
*/
int tool_ftruncate64(int fd, curl_off_t where)
{
if(_lseeki64(fd, where, SEEK_SET) < 0)
return -1;
if(!SetEndOfFile((HANDLE)_get_osfhandle(fd)))
return -1;
return 0;
}
#endif /* WIN32 && ! __MINGW64__ */

46
3rd-party/curl-7.52.1/src/tool_cb_see.h vendored Normal file
View File

@@ -0,0 +1,46 @@
#ifndef HEADER_CURL_TOOL_CB_SEE_H
#define HEADER_CURL_TOOL_CB_SEE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#if defined(WIN32) && !defined(__MINGW64__)
int tool_ftruncate64(int fd, curl_off_t where);
#undef ftruncate
#define ftruncate(fd,where) tool_ftruncate64(fd,where)
#ifndef HAVE_FTRUNCATE
# define HAVE_FTRUNCATE 1
#endif
#endif /* WIN32 && ! __MINGW64__ */
/*
** callback for CURLOPT_SEEKFUNCTION
*/
int tool_seek_cb(void *userdata, curl_off_t offset, int whence);
#endif /* HEADER_CURL_TOOL_CB_SEE_H */

159
3rd-party/curl-7.52.1/src/tool_cb_wrt.c vendored Normal file
View File

@@ -0,0 +1,159 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "tool_cb_wrt.h"
#include "memdebug.h" /* keep this as LAST include */
/* create a local file for writing, return TRUE on success */
bool tool_create_output_file(struct OutStruct *outs)
{
struct GlobalConfig *global = outs->config->global;
FILE *file;
if(!outs->filename || !*outs->filename) {
warnf(global, "Remote filename has no length!\n");
return FALSE;
}
if(outs->is_cd_filename) {
/* don't overwrite existing files */
file = fopen(outs->filename, "rb");
if(file) {
fclose(file);
warnf(global, "Refusing to overwrite %s: %s\n", outs->filename,
strerror(EEXIST));
return FALSE;
}
}
/* open file for writing */
file = fopen(outs->filename, "wb");
if(!file) {
warnf(global, "Failed to create the file %s: %s\n", outs->filename,
strerror(errno));
return FALSE;
}
outs->s_isreg = TRUE;
outs->fopened = TRUE;
outs->stream = file;
outs->bytes = 0;
outs->init = 0;
return TRUE;
}
/*
** callback for CURLOPT_WRITEFUNCTION
*/
size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
{
size_t rc;
struct OutStruct *outs = userdata;
struct OperationConfig *config = outs->config;
/*
* Once that libcurl has called back tool_write_cb() the returned value
* is checked against the amount that was intended to be written, if
* it does not match then it fails with CURLE_WRITE_ERROR. So at this
* point returning a value different from sz*nmemb indicates failure.
*/
const size_t failure = (sz * nmemb) ? 0 : 1;
if(!config)
return failure;
#ifdef DEBUGBUILD
if(config->include_headers) {
if(sz * nmemb > (size_t)CURL_MAX_HTTP_HEADER) {
warnf(config->global, "Header data size exceeds single call write "
"limit!\n");
return failure;
}
}
else {
if(sz * nmemb > (size_t)CURL_MAX_WRITE_SIZE) {
warnf(config->global, "Data size exceeds single call write limit!\n");
return failure;
}
}
{
/* Some internal congruency checks on received OutStruct */
bool check_fails = FALSE;
if(outs->filename) {
/* regular file */
if(!*outs->filename)
check_fails = TRUE;
if(!outs->s_isreg)
check_fails = TRUE;
if(outs->fopened && !outs->stream)
check_fails = TRUE;
if(!outs->fopened && outs->stream)
check_fails = TRUE;
if(!outs->fopened && outs->bytes)
check_fails = TRUE;
}
else {
/* standard stream */
if(!outs->stream || outs->s_isreg || outs->fopened)
check_fails = TRUE;
if(outs->alloc_filename || outs->is_cd_filename || outs->init)
check_fails = TRUE;
}
if(check_fails) {
warnf(config->global, "Invalid output struct data for write callback\n");
return failure;
}
}
#endif
if(!outs->stream && !tool_create_output_file(outs))
return failure;
rc = fwrite(buffer, sz, nmemb, outs->stream);
if((sz * nmemb) == rc)
/* we added this amount of data to the output */
outs->bytes += (sz * nmemb);
if(config->readbusy) {
config->readbusy = FALSE;
curl_easy_pause(config->easy, CURLPAUSE_CONT);
}
if(config->nobuffer) {
/* output buffering disabled */
int res = fflush(outs->stream);
if(res)
return failure;
}
return rc;
}

36
3rd-party/curl-7.52.1/src/tool_cb_wrt.h vendored Normal file
View File

@@ -0,0 +1,36 @@
#ifndef HEADER_CURL_TOOL_CB_WRT_H
#define HEADER_CURL_TOOL_CB_WRT_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
** callback for CURLOPT_WRITEFUNCTION
*/
size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata);
/* create a local file for writing, return TRUE on success */
bool tool_create_output_file(struct OutStruct *outs);
#endif /* HEADER_CURL_TOOL_CB_WRT_H */

174
3rd-party/curl-7.52.1/src/tool_cfgable.c vendored Normal file
View File

@@ -0,0 +1,174 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_cfgable.h"
#include "tool_main.h"
#include "memdebug.h" /* keep this as LAST include */
void config_init(struct OperationConfig* config)
{
memset(config, 0, sizeof(struct OperationConfig));
config->postfieldsize = -1;
config->use_httpget = FALSE;
config->create_dirs = FALSE;
config->maxredirs = DEFAULT_MAXREDIRS;
config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */
config->proto_present = FALSE;
config->proto_redir = CURLPROTO_ALL & /* All except FILE, SCP and SMB */
~(CURLPROTO_FILE | CURLPROTO_SCP | CURLPROTO_SMB |
CURLPROTO_SMBS);
config->proto_redir_present = FALSE;
config->proto_default = NULL;
config->tcp_nodelay = TRUE; /* enabled by default */
}
static void free_config_fields(struct OperationConfig *config)
{
struct getout *urlnode;
Curl_safefree(config->random_file);
Curl_safefree(config->egd_file);
Curl_safefree(config->useragent);
Curl_safefree(config->cookie);
Curl_safefree(config->cookiejar);
Curl_safefree(config->cookiefile);
Curl_safefree(config->postfields);
Curl_safefree(config->referer);
Curl_safefree(config->headerfile);
Curl_safefree(config->ftpport);
Curl_safefree(config->iface);
Curl_safefree(config->range);
Curl_safefree(config->userpwd);
Curl_safefree(config->tls_username);
Curl_safefree(config->tls_password);
Curl_safefree(config->tls_authtype);
Curl_safefree(config->proxy_tls_username);
Curl_safefree(config->proxy_tls_password);
Curl_safefree(config->proxy_tls_authtype);
Curl_safefree(config->proxyuserpwd);
Curl_safefree(config->proxy);
Curl_safefree(config->dns_ipv6_addr);
Curl_safefree(config->dns_ipv4_addr);
Curl_safefree(config->dns_interface);
Curl_safefree(config->dns_servers);
Curl_safefree(config->noproxy);
Curl_safefree(config->mail_from);
curl_slist_free_all(config->mail_rcpt);
Curl_safefree(config->mail_auth);
Curl_safefree(config->netrc_file);
urlnode = config->url_list;
while(urlnode) {
struct getout *next = urlnode->next;
Curl_safefree(urlnode->url);
Curl_safefree(urlnode->outfile);
Curl_safefree(urlnode->infile);
Curl_safefree(urlnode);
urlnode = next;
}
config->url_list = NULL;
config->url_last = NULL;
config->url_get = NULL;
config->url_out = NULL;
Curl_safefree(config->cipher_list);
Curl_safefree(config->proxy_cipher_list);
Curl_safefree(config->cert);
Curl_safefree(config->proxy_cert);
Curl_safefree(config->cert_type);
Curl_safefree(config->proxy_cert_type);
Curl_safefree(config->cacert);
Curl_safefree(config->proxy_cacert);
Curl_safefree(config->capath);
Curl_safefree(config->proxy_capath);
Curl_safefree(config->crlfile);
Curl_safefree(config->pinnedpubkey);
Curl_safefree(config->proxy_crlfile);
Curl_safefree(config->key);
Curl_safefree(config->proxy_key);
Curl_safefree(config->key_type);
Curl_safefree(config->proxy_key_type);
Curl_safefree(config->key_passwd);
Curl_safefree(config->proxy_key_passwd);
Curl_safefree(config->pubkey);
Curl_safefree(config->hostpubmd5);
Curl_safefree(config->engine);
Curl_safefree(config->customrequest);
Curl_safefree(config->krblevel);
Curl_safefree(config->oauth_bearer);
Curl_safefree(config->unix_socket_path);
Curl_safefree(config->writeout);
Curl_safefree(config->proto_default);
curl_slist_free_all(config->quote);
curl_slist_free_all(config->postquote);
curl_slist_free_all(config->prequote);
curl_slist_free_all(config->headers);
curl_slist_free_all(config->proxyheaders);
if(config->httppost) {
curl_formfree(config->httppost);
config->httppost = NULL;
}
config->last_post = NULL;
curl_slist_free_all(config->telnet_options);
curl_slist_free_all(config->resolve);
curl_slist_free_all(config->connect_to);
Curl_safefree(config->preproxy);
Curl_safefree(config->proxy_service_name);
Curl_safefree(config->service_name);
Curl_safefree(config->ftp_account);
Curl_safefree(config->ftp_alternative_to_user);
}
void config_free(struct OperationConfig *config)
{
struct OperationConfig *last = config;
/* Free each of the structures in reverse order */
while(last) {
struct OperationConfig *prev = last->prev;
free_config_fields(last);
free(last);
last = prev;
}
}

267
3rd-party/curl-7.52.1/src/tool_cfgable.h vendored Normal file
View File

@@ -0,0 +1,267 @@
#ifndef HEADER_CURL_TOOL_CFGABLE_H
#define HEADER_CURL_TOOL_CFGABLE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_sdecls.h"
#include "tool_metalink.h"
struct GlobalConfig;
struct OperationConfig {
CURL *easy; /* A copy of the handle from GlobalConfig */
bool remote_time;
char *random_file;
char *egd_file;
char *useragent;
char *cookie; /* single line with specified cookies */
char *cookiejar; /* write to this file */
char *cookiefile; /* read from this file */
bool cookiesession; /* new session? */
bool encoding; /* Accept-Encoding please */
bool tr_encoding; /* Transfer-Encoding please */
unsigned long authtype; /* auth bitmask */
bool use_resume;
bool resume_from_current;
bool disable_epsv;
bool disable_eprt;
bool ftp_pret;
long proto;
bool proto_present;
long proto_redir;
bool proto_redir_present;
char *proto_default;
curl_off_t resume_from;
char *postfields;
curl_off_t postfieldsize;
char *referer;
double timeout;
double connecttimeout;
long maxredirs;
curl_off_t max_filesize;
char *headerfile;
char *ftpport;
char *iface;
int localport;
int localportrange;
unsigned short porttouse;
char *range;
long low_speed_limit;
long low_speed_time;
char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */
char *dns_interface; /* interface name */
char *dns_ipv4_addr; /* dot notation */
char *dns_ipv6_addr; /* dot notation */
char *userpwd;
char *login_options;
char *tls_username;
char *tls_password;
char *tls_authtype;
char *proxy_tls_username;
char *proxy_tls_password;
char *proxy_tls_authtype;
char *proxyuserpwd;
char *proxy;
int proxyver; /* set to CURLPROXY_HTTP* define */
char *noproxy;
char *mail_from;
struct curl_slist *mail_rcpt;
char *mail_auth;
bool sasl_ir; /* Enable/disable SASL initial response */
bool proxytunnel;
bool ftp_append; /* APPE on ftp */
bool use_ascii; /* select ascii or text transfer */
bool autoreferer; /* automatically set referer */
bool failonerror; /* fail on (HTTP) errors */
bool include_headers; /* send headers to data output */
bool no_body; /* don't get the body */
bool dirlistonly; /* only get the FTP dir list */
bool followlocation; /* follow http redirects */
bool unrestricted_auth; /* Continue to send authentication (user+password)
when following ocations, even when hostname
changed */
bool netrc_opt;
bool netrc;
char *netrc_file;
struct getout *url_list; /* point to the first node */
struct getout *url_last; /* point to the last/current node */
struct getout *url_get; /* point to the node to fill in URL */
struct getout *url_out; /* point to the node to fill in outfile */
char *cipher_list;
char *proxy_cipher_list;
char *cert;
char *proxy_cert;
char *cert_type;
char *proxy_cert_type;
char *cacert;
char *proxy_cacert;
char *capath;
char *proxy_capath;
char *crlfile;
char *proxy_crlfile;
char *pinnedpubkey;
char *key;
char *proxy_key;
char *key_type;
char *proxy_key_type;
char *key_passwd;
char *proxy_key_passwd;
char *pubkey;
char *hostpubmd5;
char *engine;
bool crlf;
char *customrequest;
char *krblevel;
long httpversion;
bool nobuffer;
bool readbusy; /* set when reading input returns EAGAIN */
bool globoff;
bool use_httpget;
bool insecure_ok; /* set TRUE to allow insecure SSL connects */
bool proxy_insecure_ok; /* set TRUE to allow insecure SSL connects
for proxy */
bool verifystatus;
bool create_dirs;
bool ftp_create_dirs;
bool ftp_skip_ip;
bool proxynegotiate;
bool proxyntlm;
bool proxydigest;
bool proxybasic;
bool proxyanyauth;
char *writeout; /* %-styled format string to output */
bool writeenv; /* write results to environment, if available */
struct curl_slist *quote;
struct curl_slist *postquote;
struct curl_slist *prequote;
long ssl_version;
long proxy_ssl_version;
long ip_version;
curl_TimeCond timecond;
time_t condtime;
struct curl_slist *headers;
struct curl_slist *proxyheaders;
struct curl_httppost *httppost;
struct curl_httppost *last_post;
struct curl_slist *telnet_options;
struct curl_slist *resolve;
struct curl_slist *connect_to;
HttpReq httpreq;
/* for bandwidth limiting features: */
curl_off_t sendpersecond; /* send to peer */
curl_off_t recvpersecond; /* receive from peer */
bool ftp_ssl;
bool ftp_ssl_reqd;
bool ftp_ssl_control;
bool ftp_ssl_ccc;
int ftp_ssl_ccc_mode;
char *preproxy;
int socks5_gssapi_nec; /* The NEC reference server does not protect the
encryption type exchange */
char *proxy_service_name; /* set authentication service name for HTTP and
SOCKS5 proxies */
char *service_name; /* set authentication service name for DIGEST-MD5,
Kerberos 5 and SPNEGO */
bool tcp_nodelay;
bool tcp_fastopen;
long req_retry; /* number of retries */
bool retry_connrefused; /* set connection refused as a transient error */
long retry_delay; /* delay between retries (in seconds) */
long retry_maxtime; /* maximum time to keep retrying */
char *ftp_account; /* for ACCT */
char *ftp_alternative_to_user; /* send command if USER/PASS fails */
int ftp_filemethod;
long tftp_blksize; /* TFTP BLKSIZE option */
bool tftp_no_options; /* do not send TFTP options requests */
bool ignorecl; /* --ignore-content-length */
bool disable_sessionid;
bool raw;
bool post301;
bool post302;
bool post303;
bool nokeepalive; /* for keepalive needs */
long alivetime;
bool content_disposition; /* use Content-disposition filename */
int default_node_flags; /* default flags to search for each 'node', which
is basically each given URL to transfer */
bool xattr; /* store metadata in extended attributes */
long gssapi_delegation;
bool ssl_allow_beast; /* allow this SSL vulnerability */
bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy*/
bool ssl_no_revoke; /* disable SSL certificate revocation checks */
/*bool proxy_ssl_no_revoke; */
bool use_metalink; /* process given URLs as metalink XML file */
metalinkfile *metalinkfile_list; /* point to the first node */
metalinkfile *metalinkfile_last; /* point to the last/current node */
#ifdef CURLDEBUG
bool test_event_based;
#endif
char *oauth_bearer; /* OAuth 2.0 bearer token */
bool nonpn; /* enable/disable TLS NPN extension */
bool noalpn; /* enable/disable TLS ALPN extension */
char *unix_socket_path; /* path to Unix domain socket */
bool falsestart;
bool path_as_is;
double expect100timeout;
struct GlobalConfig *global;
struct OperationConfig *prev;
struct OperationConfig *next; /* Always last in the struct */
};
struct GlobalConfig {
CURL *easy; /* Once we have one, we keep it here */
int showerror; /* -1 == unset, default => show errors
0 => -s is used to NOT show errors
1 => -S has been used to show errors */
bool mute; /* don't show messages, --silent given */
bool noprogress; /* don't show progress bar --silent given */
bool isatty; /* Updated internally if output is a tty */
FILE *errors; /* Error stream, defaults to stderr */
bool errors_fopened; /* Whether error stream isn't stderr */
char *trace_dump; /* file to dump the network trace to */
FILE *trace_stream;
bool trace_fopened;
trace tracetype;
bool tracetime; /* include timestamp? */
int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
char *libcurl; /* Output libcurl code to this file name */
bool fail_early; /* exit on first transfer error */
struct OperationConfig *first;
struct OperationConfig *current;
struct OperationConfig *last; /* Always last in the struct */
};
void config_init(struct OperationConfig *config);
void config_free(struct OperationConfig *config);
#endif /* HEADER_CURL_TOOL_CFGABLE_H */

150
3rd-party/curl-7.52.1/src/tool_convert.c vendored Normal file
View File

@@ -0,0 +1,150 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef CURL_DOES_CONVERSIONS
#ifdef HAVE_ICONV
# include <iconv.h>
#endif
#include "tool_convert.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef HAVE_ICONV
/* curl tool iconv conversion descriptors */
static iconv_t inbound_cd = (iconv_t)-1;
static iconv_t outbound_cd = (iconv_t)-1;
/* set default codesets for iconv */
#ifndef CURL_ICONV_CODESET_OF_NETWORK
# define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
#endif
/*
* convert_to_network() is a curl tool function to convert
* from the host encoding to ASCII on non-ASCII platforms.
*/
CURLcode convert_to_network(char *buffer, size_t length)
{
/* translate from the host encoding to the network encoding */
char *input_ptr, *output_ptr;
size_t res, in_bytes, out_bytes;
/* open an iconv conversion descriptor if necessary */
if(outbound_cd == (iconv_t)-1) {
outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST);
if(outbound_cd == (iconv_t)-1) {
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
res = iconv(outbound_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((res == (size_t)-1) || (in_bytes != 0)) {
return CURLE_CONV_FAILED;
}
return CURLE_OK;
}
/*
* convert_from_network() is a curl tool function
* for performing ASCII conversions on non-ASCII platforms.
*/
CURLcode convert_from_network(char *buffer, size_t length)
{
/* translate from the network encoding to the host encoding */
char *input_ptr, *output_ptr;
size_t res, in_bytes, out_bytes;
/* open an iconv conversion descriptor if necessary */
if(inbound_cd == (iconv_t)-1) {
inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK);
if(inbound_cd == (iconv_t)-1) {
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
res = iconv(inbound_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((res == (size_t)-1) || (in_bytes != 0)) {
return CURLE_CONV_FAILED;
}
return CURLE_OK;
}
void convert_cleanup(void)
{
/* close iconv conversion descriptors */
if(inbound_cd != (iconv_t)-1)
(void)iconv_close(inbound_cd);
if(outbound_cd != (iconv_t)-1)
(void)iconv_close(outbound_cd);
}
#endif /* HAVE_ICONV */
char convert_char(curl_infotype infotype, char this_char)
{
/* determine how this specific character should be displayed */
switch(infotype) {
case CURLINFO_DATA_IN:
case CURLINFO_DATA_OUT:
case CURLINFO_SSL_DATA_IN:
case CURLINFO_SSL_DATA_OUT:
/* data, treat as ASCII */
if((this_char >= 0x20) && (this_char < 0x7f)) {
/* printable ASCII hex value: convert to host encoding */
(void)convert_from_network(&this_char, 1);
}
else {
/* non-printable ASCII, use a replacement character */
return UNPRINTABLE_CHAR;
}
/* fall through to default */
default:
/* treat as host encoding */
if(ISPRINT(this_char)
&& (this_char != '\t')
&& (this_char != '\r')
&& (this_char != '\n')) {
/* printable characters excluding tabs and line end characters */
return this_char;
}
break;
}
/* non-printable, use a replacement character */
return UNPRINTABLE_CHAR;
}
#endif /* CURL_DOES_CONVERSIONS */

View File

@@ -0,0 +1,45 @@
#ifndef HEADER_CURL_TOOL_CONVERT_H
#define HEADER_CURL_TOOL_CONVERT_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef CURL_DOES_CONVERSIONS
#ifdef HAVE_ICONV
CURLcode convert_to_network(char *buffer, size_t length);
CURLcode convert_from_network(char *buffer, size_t length);
void convert_cleanup(void);
#endif /* HAVE_ICONV */
char convert_char(curl_infotype infotype, char this_char);
#endif /* CURL_DOES_CONVERSIONS */
#if !defined(CURL_DOES_CONVERSIONS) || !defined(HAVE_ICONV)
#define convert_cleanup() Curl_nop_stmt
#endif
#endif /* HEADER_CURL_TOOL_CONVERT_H */

158
3rd-party/curl-7.52.1/src/tool_dirhie.c vendored Normal file
View File

@@ -0,0 +1,158 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include <sys/stat.h>
#ifdef WIN32
# include <direct.h>
#endif
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_dirhie.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef NETWARE
# ifndef __NOVELL_LIBC__
# define mkdir mkdir_510
# endif
#endif
#ifdef WIN32
# define mkdir(x,y) (mkdir)((x))
# ifndef __POCC__
# define F_OK 0
# endif
#endif
static void show_dir_errno(FILE *errors, const char *name)
{
switch(ERRNO) {
#ifdef EACCES
case EACCES:
fprintf(errors, "You don't have permission to create %s.\n", name);
break;
#endif
#ifdef ENAMETOOLONG
case ENAMETOOLONG:
fprintf(errors, "The directory name %s is too long.\n", name);
break;
#endif
#ifdef EROFS
case EROFS:
fprintf(errors, "%s resides on a read-only file system.\n", name);
break;
#endif
#ifdef ENOSPC
case ENOSPC:
fprintf(errors, "No space left on the file system that will "
"contain the directory %s.\n", name);
break;
#endif
#ifdef EDQUOT
case EDQUOT:
fprintf(errors, "Cannot create directory %s because you "
"exceeded your quota.\n", name);
break;
#endif
default :
fprintf(errors, "Error creating directory %s.\n", name);
break;
}
}
/*
* Create the needed directory hierarchy recursively in order to save
* multi-GETs in file output, ie:
* curl "http://my.site/dir[1-5]/file[1-5].txt" -o "dir#1/file#2.txt"
* should create all the dir* automagically
*/
#ifdef WIN32
/* systems that may use either or when specifying a path */
#define PATH_DELIMITERS "\\/"
#else
#define PATH_DELIMITERS DIR_CHAR
#endif
CURLcode create_dir_hierarchy(const char *outfile, FILE *errors)
{
char *tempdir;
char *tempdir2;
char *outdup;
char *dirbuildup;
CURLcode result = CURLE_OK;
size_t outlen;
outlen = strlen(outfile);
outdup = strdup(outfile);
if(!outdup)
return CURLE_OUT_OF_MEMORY;
dirbuildup = malloc(outlen + 1);
if(!dirbuildup) {
Curl_safefree(outdup);
return CURLE_OUT_OF_MEMORY;
}
dirbuildup[0] = '\0';
/* Allow strtok() here since this isn't used threaded */
/* !checksrc! disable BANNEDFUNC 2 */
tempdir = strtok(outdup, PATH_DELIMITERS);
while(tempdir != NULL) {
tempdir2 = strtok(NULL, PATH_DELIMITERS);
/* since strtok returns a token for the last word even
if not ending with DIR_CHAR, we need to prune it */
if(tempdir2 != NULL) {
size_t dlen = strlen(dirbuildup);
if(dlen)
snprintf(&dirbuildup[dlen], outlen - dlen, "%s%s", DIR_CHAR, tempdir);
else {
if(outdup == tempdir)
/* the output string doesn't start with a separator */
strcpy(dirbuildup, tempdir);
else
snprintf(dirbuildup, outlen, "%s%s", DIR_CHAR, tempdir);
}
if(access(dirbuildup, F_OK) == -1) {
if(-1 == mkdir(dirbuildup, (mode_t)0000750)) {
show_dir_errno(errors, dirbuildup);
result = CURLE_WRITE_ERROR;
break; /* get out of loop */
}
}
}
tempdir = tempdir2;
}
Curl_safefree(dirbuildup);
Curl_safefree(outdup);
return result;
}

29
3rd-party/curl-7.52.1/src/tool_dirhie.h vendored Normal file
View File

@@ -0,0 +1,29 @@
#ifndef HEADER_CURL_TOOL_DIRHIE_H
#define HEADER_CURL_TOOL_DIRHIE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
CURLcode create_dir_hierarchy(const char *outfile, FILE *errors);
#endif /* HEADER_CURL_TOOL_DIRHIE_H */

674
3rd-party/curl-7.52.1/src/tool_doswin.c vendored Normal file
View File

@@ -0,0 +1,674 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#if defined(MSDOS) || defined(WIN32)
#if defined(HAVE_LIBGEN_H) && defined(HAVE_BASENAME)
# include <libgen.h>
#endif
#ifdef WIN32
# include "tool_cfgable.h"
# include "tool_libinfo.h"
#endif
#include "tool_bname.h"
#include "tool_doswin.h"
#include "memdebug.h" /* keep this as LAST include */
/*
* Macros ALWAYS_TRUE and ALWAYS_FALSE are used to avoid compiler warnings.
*/
#define ALWAYS_TRUE (1)
#define ALWAYS_FALSE (0)
#if defined(_MSC_VER) && !defined(__POCC__)
# undef ALWAYS_TRUE
# undef ALWAYS_FALSE
# if (_MSC_VER < 1500)
# define ALWAYS_TRUE (0, 1)
# define ALWAYS_FALSE (1, 0)
# else
# define ALWAYS_TRUE \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
(1) \
__pragma(warning(pop))
# define ALWAYS_FALSE \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
(0) \
__pragma(warning(pop))
# endif
#endif
#ifdef WIN32
# undef PATH_MAX
# define PATH_MAX MAX_PATH
#endif
#ifndef S_ISCHR
# ifdef S_IFCHR
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(m) (0) /* cannot tell if file is a device */
# endif
#endif
#ifdef WIN32
# define _use_lfn(f) ALWAYS_TRUE /* long file names always available */
#elif !defined(__DJGPP__) || (__DJGPP__ < 2) /* DJGPP 2.0 has _use_lfn() */
# define _use_lfn(f) ALWAYS_FALSE /* long file names never available */
#elif defined(__DJGPP__)
# include <fcntl.h> /* _use_lfn(f) prototype */
#endif
#ifndef UNITTESTS
static SANITIZEcode truncate_dryrun(const char *path,
const size_t truncate_pos);
#ifdef MSDOS
static SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags);
#endif
static SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized,
const char *file_name,
int flags);
#endif /* !UNITTESTS (static declarations used if no unit tests) */
/*
Sanitize a file or path name.
All banned characters are replaced by underscores, for example:
f?*foo => f__foo
f:foo::$DATA => f_foo__$DATA
f:\foo:bar => f__foo_bar
f:\foo:bar => f:\foo:bar (flag SANITIZE_ALLOW_PATH)
This function was implemented according to the guidelines in 'Naming Files,
Paths, and Namespaces' section 'Naming Conventions'.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx
Flags
-----
SANITIZE_ALLOW_COLONS: Allow colons.
Without this flag colons are sanitized.
SANITIZE_ALLOW_PATH: Allow path separators and colons.
Without this flag path separators and colons are sanitized.
SANITIZE_ALLOW_RESERVED: Allow reserved device names.
Without this flag a reserved device name is renamed (COM1 => _COM1) unless it's
in a UNC prefixed path.
SANITIZE_ALLOW_TRUNCATE: Allow truncating a long filename.
Without this flag if the sanitized filename or path will be too long an error
occurs. With this flag the filename --and not any other parts of the path-- may
be truncated to at least a single character. A filename followed by an
alternate data stream (ADS) cannot be truncated in any case.
Success: (SANITIZE_ERR_OK) *sanitized points to a sanitized copy of file_name.
Failure: (!= SANITIZE_ERR_OK) *sanitized is NULL.
*/
SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name,
int flags)
{
char *p, *target;
size_t len;
SANITIZEcode sc;
size_t max_sanitized_len;
if(!sanitized)
return SANITIZE_ERR_BAD_ARGUMENT;
*sanitized = NULL;
if(!file_name)
return SANITIZE_ERR_BAD_ARGUMENT;
if((flags & SANITIZE_ALLOW_PATH)) {
#ifndef MSDOS
if(file_name[0] == '\\' && file_name[1] == '\\')
/* UNC prefixed path \\ (eg \\?\C:\foo) */
max_sanitized_len = 32767-1;
else
#endif
max_sanitized_len = PATH_MAX-1;
}
else
/* The maximum length of a filename.
FILENAME_MAX is often the same as PATH_MAX, in other words it is 260 and
does not discount the path information therefore we shouldn't use it. */
max_sanitized_len = (PATH_MAX-1 > 255) ? 255 : PATH_MAX-1;
len = strlen(file_name);
if(len > max_sanitized_len) {
if(!(flags & SANITIZE_ALLOW_TRUNCATE) ||
truncate_dryrun(file_name, max_sanitized_len))
return SANITIZE_ERR_INVALID_PATH;
len = max_sanitized_len;
}
target = malloc(len + 1);
if(!target)
return SANITIZE_ERR_OUT_OF_MEMORY;
strncpy(target, file_name, len);
target[len] = '\0';
#ifndef MSDOS
if((flags & SANITIZE_ALLOW_PATH) && !strncmp(target, "\\\\?\\", 4))
/* Skip the literal path prefix \\?\ */
p = target + 4;
else
#endif
p = target;
/* replace control characters and other banned characters */
for(; *p; ++p) {
const char *banned;
if((1 <= *p && *p <= 31) ||
(!(flags & (SANITIZE_ALLOW_COLONS|SANITIZE_ALLOW_PATH)) && *p == ':') ||
(!(flags & SANITIZE_ALLOW_PATH) && (*p == '/' || *p == '\\'))) {
*p = '_';
continue;
}
for(banned = "|<>\"?*"; *banned; ++banned) {
if(*p == *banned) {
*p = '_';
break;
}
}
}
/* remove trailing spaces and periods if not allowing paths */
if(!(flags & SANITIZE_ALLOW_PATH) && len) {
char *clip = NULL;
p = &target[len];
do {
--p;
if(*p != ' ' && *p != '.')
break;
clip = p;
} while(p != target);
if(clip) {
*clip = '\0';
len = clip - target;
}
}
#ifdef MSDOS
sc = msdosify(&p, target, flags);
free(target);
if(sc)
return sc;
target = p;
len = strlen(target);
if(len > max_sanitized_len) {
free(target);
return SANITIZE_ERR_INVALID_PATH;
}
#endif
if(!(flags & SANITIZE_ALLOW_RESERVED)) {
sc = rename_if_reserved_dos_device_name(&p, target, flags);
free(target);
if(sc)
return sc;
target = p;
len = strlen(target);
if(len > max_sanitized_len) {
free(target);
return SANITIZE_ERR_INVALID_PATH;
}
}
*sanitized = target;
return SANITIZE_ERR_OK;
}
/*
Test if truncating a path to a file will leave at least a single character in
the filename. Filenames suffixed by an alternate data stream can't be
truncated. This performs a dry run, nothing is modified.
Good truncate_pos 9: C:\foo\bar => C:\foo\ba
Good truncate_pos 6: C:\foo => C:\foo
Good truncate_pos 5: C:\foo => C:\fo
Bad* truncate_pos 5: C:foo => C:foo
Bad truncate_pos 5: C:\foo:ads => C:\fo
Bad truncate_pos 9: C:\foo:ads => C:\foo:ad
Bad truncate_pos 5: C:\foo\bar => C:\fo
Bad truncate_pos 5: C:\foo\ => C:\fo
Bad truncate_pos 7: C:\foo\ => C:\foo\
Error truncate_pos 7: C:\foo => (pos out of range)
Bad truncate_pos 1: C:\foo\ => C
* C:foo is ambiguous, C could end up being a drive or file therefore something
like C:superlongfilename can't be truncated.
Returns
SANITIZE_ERR_OK: Good -- 'path' can be truncated
SANITIZE_ERR_INVALID_PATH: Bad -- 'path' cannot be truncated
!= SANITIZE_ERR_OK && != SANITIZE_ERR_INVALID_PATH: Error
*/
SANITIZEcode truncate_dryrun(const char *path, const size_t truncate_pos)
{
size_t len;
if(!path)
return SANITIZE_ERR_BAD_ARGUMENT;
len = strlen(path);
if(truncate_pos > len)
return SANITIZE_ERR_BAD_ARGUMENT;
if(!len || !truncate_pos)
return SANITIZE_ERR_INVALID_PATH;
if(strpbrk(&path[truncate_pos - 1], "\\/:"))
return SANITIZE_ERR_INVALID_PATH;
/* C:\foo can be truncated but C:\foo:ads can't */
if(truncate_pos > 1) {
const char *p = &path[truncate_pos - 1];
do {
--p;
if(*p == ':')
return SANITIZE_ERR_INVALID_PATH;
} while(p != path && *p != '\\' && *p != '/');
}
return SANITIZE_ERR_OK;
}
/* The functions msdosify, rename_if_dos_device_name and __crt0_glob_function
* were taken with modification from the DJGPP port of tar 1.12. They use
* algorithms originally from DJTAR.
*/
/*
Extra sanitization MSDOS for file_name.
This is a supporting function for sanitize_file_name.
Warning: This is an MSDOS legacy function and was purposely written in a way
that some path information may pass through. For example drive letter names
(C:, D:, etc) are allowed to pass through. For sanitizing a filename use
sanitize_file_name.
Success: (SANITIZE_ERR_OK) *sanitized points to a sanitized copy of file_name.
Failure: (!= SANITIZE_ERR_OK) *sanitized is NULL.
*/
#if defined(MSDOS) || defined(UNITTESTS)
SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags)
{
char dos_name[PATH_MAX];
static const char illegal_chars_dos[] = ".+, ;=[]" /* illegal in DOS */
"|<>/\\\":?*"; /* illegal in DOS & W95 */
static const char *illegal_chars_w95 = &illegal_chars_dos[8];
int idx, dot_idx;
const char *s = file_name;
char *d = dos_name;
const char *const dlimit = dos_name + sizeof(dos_name) - 1;
const char *illegal_aliens = illegal_chars_dos;
size_t len = sizeof(illegal_chars_dos) - 1;
if(!sanitized)
return SANITIZE_ERR_BAD_ARGUMENT;
*sanitized = NULL;
if(!file_name)
return SANITIZE_ERR_BAD_ARGUMENT;
if(strlen(file_name) > PATH_MAX-1 &&
(!(flags & SANITIZE_ALLOW_TRUNCATE) ||
truncate_dryrun(file_name, PATH_MAX-1)))
return SANITIZE_ERR_INVALID_PATH;
/* Support for Windows 9X VFAT systems, when available. */
if(_use_lfn(file_name)) {
illegal_aliens = illegal_chars_w95;
len -= (illegal_chars_w95 - illegal_chars_dos);
}
/* Get past the drive letter, if any. */
if(s[0] >= 'A' && s[0] <= 'z' && s[1] == ':') {
*d++ = *s++;
*d = ((flags & (SANITIZE_ALLOW_COLONS|SANITIZE_ALLOW_PATH))) ? ':' : '_';
++d, ++s;
}
for(idx = 0, dot_idx = -1; *s && d < dlimit; s++, d++) {
if(memchr(illegal_aliens, *s, len)) {
if((flags & (SANITIZE_ALLOW_COLONS|SANITIZE_ALLOW_PATH)) && *s == ':')
*d = ':';
else if((flags & SANITIZE_ALLOW_PATH) && (*s == '/' || *s == '\\'))
*d = *s;
/* Dots are special: DOS doesn't allow them as the leading character,
and a file name cannot have more than a single dot. We leave the
first non-leading dot alone, unless it comes too close to the
beginning of the name: we want sh.lex.c to become sh_lex.c, not
sh.lex-c. */
else if(*s == '.') {
if((flags & SANITIZE_ALLOW_PATH) && idx == 0 &&
(s[1] == '/' || s[1] == '\\' ||
(s[1] == '.' && (s[2] == '/' || s[2] == '\\')))) {
/* Copy "./" and "../" verbatim. */
*d++ = *s++;
if(d == dlimit)
break;
if(*s == '.') {
*d++ = *s++;
if(d == dlimit)
break;
}
*d = *s;
}
else if(idx == 0)
*d = '_';
else if(dot_idx >= 0) {
if(dot_idx < 5) { /* 5 is a heuristic ad-hoc'ery */
d[dot_idx - idx] = '_'; /* replace previous dot */
*d = '.';
}
else
*d = '-';
}
else
*d = '.';
if(*s == '.')
dot_idx = idx;
}
else if(*s == '+' && s[1] == '+') {
if(idx - 2 == dot_idx) { /* .c++, .h++ etc. */
*d++ = 'x';
if(d == dlimit)
break;
*d = 'x';
}
else {
/* libg++ etc. */
if(dlimit - d < 4) {
*d++ = 'x';
if(d == dlimit)
break;
*d = 'x';
}
else {
memcpy(d, "plus", 4);
d += 3;
}
}
s++;
idx++;
}
else
*d = '_';
}
else
*d = *s;
if(*s == '/' || *s == '\\') {
idx = 0;
dot_idx = -1;
}
else
idx++;
}
*d = '\0';
if(*s) {
/* dos_name is truncated, check that truncation requirements are met,
specifically truncating a filename suffixed by an alternate data stream
or truncating the entire filename is not allowed. */
if(!(flags & SANITIZE_ALLOW_TRUNCATE) || strpbrk(s, "\\/:") ||
truncate_dryrun(dos_name, d - dos_name))
return SANITIZE_ERR_INVALID_PATH;
}
*sanitized = strdup(dos_name);
return (*sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY);
}
#endif /* MSDOS || UNITTESTS */
/*
Rename file_name if it's a reserved dos device name.
This is a supporting function for sanitize_file_name.
Warning: This is an MSDOS legacy function and was purposely written in a way
that some path information may pass through. For example drive letter names
(C:, D:, etc) are allowed to pass through. For sanitizing a filename use
sanitize_file_name.
Success: (SANITIZE_ERR_OK) *sanitized points to a sanitized copy of file_name.
Failure: (!= SANITIZE_ERR_OK) *sanitized is NULL.
*/
SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized,
const char *file_name,
int flags)
{
/* We could have a file whose name is a device on MS-DOS. Trying to
* retrieve such a file would fail at best and wedge us at worst. We need
* to rename such files. */
char *p, *base;
char fname[PATH_MAX];
#ifdef MSDOS
struct_stat st_buf;
#endif
if(!sanitized)
return SANITIZE_ERR_BAD_ARGUMENT;
*sanitized = NULL;
if(!file_name)
return SANITIZE_ERR_BAD_ARGUMENT;
/* Ignore UNC prefixed paths, they are allowed to contain a reserved name. */
#ifndef MSDOS
if((flags & SANITIZE_ALLOW_PATH) &&
file_name[0] == '\\' && file_name[1] == '\\') {
size_t len = strlen(file_name);
*sanitized = malloc(len + 1);
if(!*sanitized)
return SANITIZE_ERR_OUT_OF_MEMORY;
strncpy(*sanitized, file_name, len + 1);
return SANITIZE_ERR_OK;
}
#endif
if(strlen(file_name) > PATH_MAX-1 &&
(!(flags & SANITIZE_ALLOW_TRUNCATE) ||
truncate_dryrun(file_name, PATH_MAX-1)))
return SANITIZE_ERR_INVALID_PATH;
strncpy(fname, file_name, PATH_MAX-1);
fname[PATH_MAX-1] = '\0';
base = basename(fname);
/* Rename reserved device names that are known to be accessible without \\.\
Examples: CON => _CON, CON.EXT => CON_EXT, CON:ADS => CON_ADS
https://support.microsoft.com/en-us/kb/74496
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247.aspx
*/
for(p = fname; p; p = (p == fname && fname != base ? base : NULL)) {
size_t p_len;
int x = (curl_strnequal(p, "CON", 3) ||
curl_strnequal(p, "PRN", 3) ||
curl_strnequal(p, "AUX", 3) ||
curl_strnequal(p, "NUL", 3)) ? 3 :
(curl_strnequal(p, "CLOCK$", 6)) ? 6 :
(curl_strnequal(p, "COM", 3) || curl_strnequal(p, "LPT", 3)) ?
(('1' <= p[3] && p[3] <= '9') ? 4 : 3) : 0;
if(!x)
continue;
/* the devices may be accessible with an extension or ADS, for
example CON.AIR and 'CON . AIR' and CON:AIR access console */
for(; p[x] == ' '; ++x)
;
if(p[x] == '.') {
p[x] = '_';
continue;
}
else if(p[x] == ':') {
if(!(flags & (SANITIZE_ALLOW_COLONS|SANITIZE_ALLOW_PATH))) {
p[x] = '_';
continue;
}
++x;
}
else if(p[x]) /* no match */
continue;
/* p points to 'CON' or 'CON ' or 'CON:', etc */
p_len = strlen(p);
/* Prepend a '_' */
if(strlen(fname) == PATH_MAX-1) {
--p_len;
if(!(flags & SANITIZE_ALLOW_TRUNCATE) || truncate_dryrun(p, p_len))
return SANITIZE_ERR_INVALID_PATH;
p[p_len] = '\0';
}
memmove(p + 1, p, p_len + 1);
p[0] = '_';
++p_len;
/* if fname was just modified then the basename pointer must be updated */
if(p == fname)
base = basename(fname);
}
/* This is the legacy portion from rename_if_dos_device_name that checks for
reserved device names. It only works on MSDOS. On Windows XP the stat
check errors with EINVAL if the device name is reserved. On Windows
Vista/7/8 it sets mode S_IFREG (regular file or device). According to MSDN
stat doc the latter behavior is correct, but that doesn't help us identify
whether it's a reserved device name and not a regular file name. */
#ifdef MSDOS
if(base && ((stat(base, &st_buf)) == 0) && (S_ISCHR(st_buf.st_mode))) {
/* Prepend a '_' */
size_t blen = strlen(base);
if(blen) {
if(strlen(fname) == PATH_MAX-1) {
--blen;
if(!(flags & SANITIZE_ALLOW_TRUNCATE) || truncate_dryrun(base, blen))
return SANITIZE_ERR_INVALID_PATH;
base[blen] = '\0';
}
memmove(base + 1, base, blen + 1);
base[0] = '_';
++blen;
}
}
#endif
*sanitized = strdup(fname);
return (*sanitized ? SANITIZE_ERR_OK : SANITIZE_ERR_OUT_OF_MEMORY);
}
#if defined(MSDOS) && (defined(__DJGPP__) || defined(__GO32__))
/*
* Disable program default argument globbing. We do it on our own.
*/
char **__crt0_glob_function(char *arg)
{
(void)arg;
return (char **)0;
}
#endif /* MSDOS && (__DJGPP__ || __GO32__) */
#ifdef WIN32
/*
* Function to find CACert bundle on a Win32 platform using SearchPath.
* (SearchPath is already declared via inclusions done in setup header file)
* (Use the ASCII version instead of the unicode one!)
* The order of the directories it searches is:
* 1. application's directory
* 2. current working directory
* 3. Windows System directory (e.g. C:\windows\system32)
* 4. Windows Directory (e.g. C:\windows)
* 5. all directories along %PATH%
*
* For WinXP and later search order actually depends on registry value:
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/
CURLcode FindWin32CACert(struct OperationConfig *config,
const char *bundle_file)
{
CURLcode result = CURLE_OK;
/* search and set cert file only if libcurl supports SSL */
if(curlinfo->features & CURL_VERSION_SSL) {
DWORD res_len;
DWORD buf_tchar_size = PATH_MAX + 1;
DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size;
char *ptr = NULL;
char *buf = malloc(buf_bytes_size);
if(!buf)
return CURLE_OUT_OF_MEMORY;
buf[0] = '\0';
res_len = SearchPathA(NULL, bundle_file, NULL, buf_tchar_size, buf, &ptr);
if(res_len > 0) {
Curl_safefree(config->cacert);
config->cacert = strdup(buf);
if(!config->cacert)
result = CURLE_OUT_OF_MEMORY;
}
Curl_safefree(buf);
}
return result;
}
#endif /* WIN32 */
#endif /* MSDOS || WIN32 */

68
3rd-party/curl-7.52.1/src/tool_doswin.h vendored Normal file
View File

@@ -0,0 +1,68 @@
#ifndef HEADER_CURL_TOOL_DOSWIN_H
#define HEADER_CURL_TOOL_DOSWIN_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#if defined(MSDOS) || defined(WIN32)
#define SANITIZE_ALLOW_COLONS (1<<0) /* Allow colons */
#define SANITIZE_ALLOW_PATH (1<<1) /* Allow path separators and colons */
#define SANITIZE_ALLOW_RESERVED (1<<2) /* Allow reserved device names */
#define SANITIZE_ALLOW_TRUNCATE (1<<3) /* Allow truncating a long filename */
typedef enum {
SANITIZE_ERR_OK = 0, /* 0 - OK */
SANITIZE_ERR_INVALID_PATH, /* 1 - the path is invalid */
SANITIZE_ERR_BAD_ARGUMENT, /* 2 - bad function parameter */
SANITIZE_ERR_OUT_OF_MEMORY, /* 3 - out of memory */
SANITIZE_ERR_LAST /* never use! */
} SANITIZEcode;
SANITIZEcode sanitize_file_name(char **const sanitized, const char *file_name,
int flags);
#ifdef UNITTESTS
SANITIZEcode truncate_dryrun(const char *path, const size_t truncate_pos);
SANITIZEcode msdosify(char **const sanitized, const char *file_name,
int flags);
SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized,
const char *file_name,
int flags);
#endif /* UNITTESTS */
#if defined(MSDOS) && (defined(__DJGPP__) || defined(__GO32__))
char **__crt0_glob_function(char *arg);
#endif /* MSDOS && (__DJGPP__ || __GO32__) */
#ifdef WIN32
CURLcode FindWin32CACert(struct OperationConfig *config,
const char *bundle_file);
#endif /* WIN32 */
#endif /* MSDOS || WIN32 */
#endif /* HEADER_CURL_TOOL_DOSWIN_H */

236
3rd-party/curl-7.52.1/src/tool_easysrc.c vendored Normal file
View File

@@ -0,0 +1,236 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "slist_wc.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_easysrc.h"
#include "tool_msgs.h"
#include "memdebug.h" /* keep this as LAST include */
/* global variable definitions, for easy-interface source code generation */
struct slist_wc *easysrc_decl = NULL; /* Variable declarations */
struct slist_wc *easysrc_data = NULL; /* Build slists, forms etc. */
struct slist_wc *easysrc_code = NULL; /* Setopt calls */
struct slist_wc *easysrc_toohard = NULL; /* Unconvertible setopt */
struct slist_wc *easysrc_clean = NULL; /* Clean up allocated data */
int easysrc_form_count = 0;
int easysrc_slist_count = 0;
static const char *const srchead[]={
"/********* Sample code generated by the curl command line tool **********",
" * All curl_easy_setopt() options are documented at:",
" * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html",
" ************************************************************************/",
"#include <curl/curl.h>",
"",
"int main(int argc, char *argv[])",
"{",
" CURLcode ret;",
" CURL *hnd;",
NULL
};
/* easysrc_decl declarations come here */
/* easysrc_data initialisations come here */
/* easysrc_code statements come here */
static const char *const srchard[]={
"/* Here is a list of options the curl code used that cannot get generated",
" as source easily. You may select to either not use them or implement",
" them yourself.",
"",
NULL
};
static const char *const srcend[]={
"",
" return (int)ret;",
"}",
"/**** End of sample code ****/",
NULL
};
/* Clean up all source code if we run out of memory */
static void easysrc_free(void)
{
slist_wc_free_all(easysrc_decl);
easysrc_decl = NULL;
slist_wc_free_all(easysrc_data);
easysrc_data = NULL;
slist_wc_free_all(easysrc_code);
easysrc_code = NULL;
slist_wc_free_all(easysrc_toohard);
easysrc_toohard = NULL;
slist_wc_free_all(easysrc_clean);
easysrc_clean = NULL;
}
/* Add a source line to the main code or remarks */
CURLcode easysrc_add(struct slist_wc **plist, const char *line)
{
CURLcode ret = CURLE_OK;
struct slist_wc *list = slist_wc_append(*plist, line);
if(!list) {
easysrc_free();
ret = CURLE_OUT_OF_MEMORY;
}
else
*plist = list;
return ret;
}
CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
{
CURLcode ret;
char *bufp;
va_list ap;
va_start(ap, fmt);
bufp = curlx_mvaprintf(fmt, ap);
va_end(ap);
if(! bufp) {
ret = CURLE_OUT_OF_MEMORY;
}
else {
ret = easysrc_add(plist, bufp);
curl_free(bufp);
}
return ret;
}
#define CHKRET(v) do {CURLcode ret = (v); if(ret) return ret;} WHILE_FALSE
CURLcode easysrc_init(void)
{
CHKRET(easysrc_add(&easysrc_code,
"hnd = curl_easy_init();"));
return CURLE_OK;
}
CURLcode easysrc_perform(void)
{
/* Note any setopt calls which we could not convert */
if(easysrc_toohard) {
int i;
struct curl_slist *ptr;
const char *c;
CHKRET(easysrc_add(&easysrc_code, ""));
/* Preamble comment */
for(i=0; ((c = srchard[i]) != NULL); i++)
CHKRET(easysrc_add(&easysrc_code, c));
/* Each unconverted option */
if(easysrc_toohard) {
for(ptr=easysrc_toohard->first; ptr; ptr = ptr->next)
CHKRET(easysrc_add(&easysrc_code, ptr->data));
}
CHKRET(easysrc_add(&easysrc_code, ""));
CHKRET(easysrc_add(&easysrc_code, "*/"));
slist_wc_free_all(easysrc_toohard);
easysrc_toohard = NULL;
}
CHKRET(easysrc_add(&easysrc_code, ""));
CHKRET(easysrc_add(&easysrc_code, "ret = curl_easy_perform(hnd);"));
CHKRET(easysrc_add(&easysrc_code, ""));
return CURLE_OK;
}
CURLcode easysrc_cleanup(void)
{
CHKRET(easysrc_add(&easysrc_code, "curl_easy_cleanup(hnd);"));
CHKRET(easysrc_add(&easysrc_code, "hnd = NULL;"));
return CURLE_OK;
}
void dumpeasysrc(struct GlobalConfig *config)
{
struct curl_slist *ptr;
char *o = config->libcurl;
FILE *out;
bool fopened = FALSE;
if(strcmp(o, "-")) {
out = fopen(o, FOPEN_WRITETEXT);
fopened = TRUE;
}
else
out = stdout;
if(!out)
warnf(config, "Failed to open %s to write libcurl code!\n", o);
else {
int i;
const char *c;
for(i=0; ((c = srchead[i]) != NULL); i++)
fprintf(out, "%s\n", c);
/* Declare variables used for complex setopt values */
if(easysrc_decl) {
for(ptr=easysrc_decl->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
/* Set up complex values for setopt calls */
if(easysrc_data) {
fprintf(out, "\n");
for(ptr=easysrc_data->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
fprintf(out, "\n");
if(easysrc_code) {
for(ptr=easysrc_code->first; ptr; ptr = ptr->next) {
if(ptr->data[0]) {
fprintf(out, " %s\n", ptr->data);
}
else {
fprintf(out, "\n");
}
}
}
if(easysrc_clean) {
for(ptr=easysrc_clean->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
for(i=0; ((c = srcend[i]) != NULL); i++)
fprintf(out, "%s\n", c);
if(fopened)
fclose(out);
}
easysrc_free();
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */

View File

@@ -0,0 +1,49 @@
#ifndef HEADER_CURL_TOOL_EASYSRC_H
#define HEADER_CURL_TOOL_EASYSRC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* global variable declarations, for easy-interface source code generation */
extern struct slist_wc *easysrc_decl; /* Variable declarations */
extern struct slist_wc *easysrc_data; /* Build slists, forms etc. */
extern struct slist_wc *easysrc_code; /* Setopt calls etc. */
extern struct slist_wc *easysrc_toohard; /* Unconvertible setopt */
extern struct slist_wc *easysrc_clean; /* Clean up (reverse order) */
extern int easysrc_form_count; /* Number of curl_httppost variables */
extern int easysrc_slist_count; /* Number of curl_slist variables */
extern CURLcode easysrc_init(void);
extern CURLcode easysrc_add(struct slist_wc **plist, const char *bupf);
extern CURLcode easysrc_addf(struct slist_wc **plist,
const char *fmt, ...);
extern CURLcode easysrc_perform(void);
extern CURLcode easysrc_cleanup(void);
void dumpeasysrc(struct GlobalConfig *config);
#endif /* CURL_DISABLE_LIBCURL_OPTION */
#endif /* HEADER_CURL_TOOL_EASYSRC_H */

View File

@@ -0,0 +1,361 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_mfiles.h"
#include "tool_msgs.h"
#include "tool_formparse.h"
#include "memdebug.h" /* keep this as LAST include */
/*
* helper function to get a word from form param
* after call get_parm_word, str either point to string end
* or point to any of end chars.
*/
static char *get_param_word(char **str, char **end_pos)
{
char *ptr = *str;
char *word_begin = NULL;
char *ptr2;
char *escape = NULL;
const char *end_chars = ";,";
/* the first non-space char is here */
word_begin = ptr;
if(*ptr == '"') {
++ptr;
while(*ptr) {
if(*ptr == '\\') {
if(ptr[1] == '\\' || ptr[1] == '"') {
/* remember the first escape position */
if(!escape)
escape = ptr;
/* skip escape of back-slash or double-quote */
ptr += 2;
continue;
}
}
if(*ptr == '"') {
*end_pos = ptr;
if(escape) {
/* has escape, we restore the unescaped string here */
ptr = ptr2 = escape;
do {
if(*ptr == '\\' && (ptr[1] == '\\' || ptr[1] == '"'))
++ptr;
*ptr2++ = *ptr++;
}
while(ptr < *end_pos);
*end_pos = ptr2;
}
while(*ptr && NULL==strchr(end_chars, *ptr))
++ptr;
*str = ptr;
return word_begin+1;
}
++ptr;
}
/* end quote is missing, treat it as non-quoted. */
ptr = word_begin;
}
while(*ptr && NULL==strchr(end_chars, *ptr))
++ptr;
*str = *end_pos = ptr;
return word_begin;
}
/***************************************************************************
*
* formparse()
*
* Reads a 'name=value' parameter and builds the appropriate linked list.
*
* Specify files to upload with 'name=@filename', or 'name=@"filename"'
* in case the filename contain ',' or ';'. Supports specified
* given Content-Type of the files. Such as ';type=<content-type>'.
*
* If literal_value is set, any initial '@' or '<' in the value string
* loses its special meaning, as does any embedded ';type='.
*
* You may specify more than one file for a single name (field). Specify
* multiple files by writing it like:
*
* 'name=@filename,filename2,filename3'
*
* or use double-quotes quote the filename:
*
* 'name=@"filename","filename2","filename3"'
*
* If you want content-types specified for each too, write them like:
*
* 'name=@filename;type=image/gif,filename2,filename3'
*
* If you want custom headers added for a single part, write them in a separate
* file and do like this:
*
* 'name=foo;headers=@headerfile' or why not
* 'name=@filemame;headers=@headerfile'
*
* To upload a file, but to fake the file name that will be included in the
* formpost, do like this:
*
* 'name=@filename;filename=/dev/null' or quote the faked filename like:
* 'name=@filename;filename="play, play, and play.txt"'
*
* If filename/path contains ',' or ';', it must be quoted by double-quotes,
* else curl will fail to figure out the correct filename. if the filename
* tobe quoted contains '"' or '\', '"' and '\' must be escaped by backslash.
*
* This function uses curl_formadd to fulfill it's job. Is heavily based on
* the old curl_formparse code.
*
***************************************************************************/
int formparse(struct OperationConfig *config,
const char *input,
struct curl_httppost **httppost,
struct curl_httppost **last_post,
bool literal_value)
{
/* 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 = NULL;
char type_major[128] = "";
char type_minor[128] = "";
char *contp;
const char *type = NULL;
char *sep;
if((1 == sscanf(input, "%255[^=]=", name)) &&
((contp = strchr(input, '=')) != NULL)) {
/* the input was using the correct format */
/* Allocate the contents */
contents = strdup(contp+1);
if(!contents) {
fprintf(config->global->errors, "out of memory\n");
return 1;
}
contp = contents;
if('@' == contp[0] && !literal_value) {
/* we use the @-letter to indicate file name(s) */
struct multi_files *multi_start = NULL;
struct multi_files *multi_current = NULL;
char *ptr = contp;
char *end = ptr + strlen(ptr);
do {
/* since this was a file, it may have a content-type specifier
at the end too, or a filename. Or both. */
char *filename = NULL;
char *word_end;
bool semicolon;
type = NULL;
++ptr;
contp = get_param_word(&ptr, &word_end);
semicolon = (';' == *ptr) ? TRUE : FALSE;
*word_end = '\0'; /* terminate the contp */
/* have other content, continue parse */
while(semicolon) {
/* have type or filename field */
++ptr;
while(*ptr && (ISSPACE(*ptr)))
++ptr;
if(checkprefix("type=", ptr)) {
/* set type pointer */
type = &ptr[5];
/* verify that this is a fine type specifier */
if(2 != sscanf(type, "%127[^/]/%127[^;,\n]",
type_major, type_minor)) {
warnf(config->global,
"Illegally formatted content-type field!\n");
Curl_safefree(contents);
FreeMultiInfo(&multi_start, &multi_current);
return 2; /* illegal content-type syntax! */
}
/* now point beyond the content-type specifier */
sep = (char *)type + strlen(type_major)+strlen(type_minor)+1;
/* there's a semicolon following - we check if it is a filename
specified and if not we simply assume that it is text that
the user wants included in the type and include that too up
to the next sep. */
ptr = sep;
if(*sep==';') {
if(!checkprefix(";filename=", sep)) {
ptr = sep + 1;
(void)get_param_word(&ptr, &sep);
semicolon = (';' == *ptr) ? TRUE : FALSE;
}
}
else
semicolon = FALSE;
if(*sep)
*sep = '\0'; /* zero terminate type string */
}
else if(checkprefix("filename=", ptr)) {
ptr += 9;
filename = get_param_word(&ptr, &word_end);
semicolon = (';' == *ptr) ? TRUE : FALSE;
*word_end = '\0';
}
else {
/* unknown prefix, skip to next block */
char *unknown = NULL;
unknown = get_param_word(&ptr, &word_end);
semicolon = (';' == *ptr) ? TRUE : FALSE;
if(*unknown) {
*word_end = '\0';
warnf(config->global, "skip unknown form field: %s\n", unknown);
}
}
}
/* now ptr point to comma or string end */
/* if type == NULL curl_formadd takes care of the problem */
if(*contp && !AddMultiFiles(contp, type, filename, &multi_start,
&multi_current)) {
warnf(config->global, "Error building form post!\n");
Curl_safefree(contents);
FreeMultiInfo(&multi_start, &multi_current);
return 3;
}
/* *ptr could be '\0', so we just check with the string end */
} while(ptr < end); /* loop if there's another file name */
/* now we add the multiple files section */
if(multi_start) {
struct curl_forms *forms = NULL;
struct multi_files *start = multi_start;
unsigned int i, count = 0;
while(start) {
start = start->next;
++count;
}
forms = malloc((count+1)*sizeof(struct curl_forms));
if(!forms) {
fprintf(config->global->errors, "Error building form post!\n");
Curl_safefree(contents);
FreeMultiInfo(&multi_start, &multi_current);
return 4;
}
for(i = 0, start = multi_start; i < count; ++i, start = start->next) {
forms[i].option = start->form.option;
forms[i].value = start->form.value;
}
forms[count].option = CURLFORM_END;
FreeMultiInfo(&multi_start, &multi_current);
if(curl_formadd(httppost, last_post,
CURLFORM_COPYNAME, name,
CURLFORM_ARRAY, forms, CURLFORM_END) != 0) {
warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(forms);
Curl_safefree(contents);
return 5;
}
Curl_safefree(forms);
}
}
else {
struct curl_forms info[4];
int i = 0;
char *ct = literal_value ? NULL : strstr(contp, ";type=");
info[i].option = CURLFORM_COPYNAME;
info[i].value = name;
i++;
if(ct) {
info[i].option = CURLFORM_CONTENTTYPE;
info[i].value = &ct[6];
i++;
ct[0] = '\0'; /* zero terminate here */
}
if(contp[0]=='<' && !literal_value) {
info[i].option = CURLFORM_FILECONTENT;
info[i].value = contp+1;
i++;
info[i].option = CURLFORM_END;
if(curl_formadd(httppost, last_post,
CURLFORM_ARRAY, info, CURLFORM_END) != 0) {
warnf(config->global, "curl_formadd failed, possibly the file %s is "
"bad!\n", contp + 1);
Curl_safefree(contents);
return 6;
}
}
else {
#ifdef CURL_DOES_CONVERSIONS
if(convert_to_network(contp, strlen(contp))) {
warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(contents);
return 7;
}
#endif
info[i].option = CURLFORM_COPYCONTENTS;
info[i].value = contp;
i++;
info[i].option = CURLFORM_END;
if(curl_formadd(httppost, last_post,
CURLFORM_ARRAY, info, CURLFORM_END) != 0) {
warnf(config->global, "curl_formadd failed!\n");
Curl_safefree(contents);
return 8;
}
}
}
}
else {
warnf(config->global, "Illegally formatted input field!\n");
return 1;
}
Curl_safefree(contents);
return 0;
}

View File

@@ -0,0 +1,33 @@
#ifndef HEADER_CURL_TOOL_FORMPARSE_H
#define HEADER_CURL_TOOL_FORMPARSE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
int formparse(struct OperationConfig *config,
const char *input,
struct curl_httppost **httppost,
struct curl_httppost **last_post,
bool literal_value);
#endif /* HEADER_CURL_TOOL_FORMPARSE_H */

2084
3rd-party/curl-7.52.1/src/tool_getparam.c vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,63 @@
#ifndef HEADER_CURL_TOOL_GETPARAM_H
#define HEADER_CURL_TOOL_GETPARAM_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
typedef enum {
PARAM_OK = 0,
PARAM_OPTION_AMBIGUOUS,
PARAM_OPTION_UNKNOWN,
PARAM_REQUIRES_PARAMETER,
PARAM_BAD_USE,
PARAM_HELP_REQUESTED,
PARAM_MANUAL_REQUESTED,
PARAM_VERSION_INFO_REQUESTED,
PARAM_ENGINES_REQUESTED,
PARAM_GOT_EXTRA_PARAMETER,
PARAM_BAD_NUMERIC,
PARAM_NEGATIVE_NUMERIC,
PARAM_LIBCURL_DOESNT_SUPPORT,
PARAM_LIBCURL_UNSUPPORTED_PROTOCOL,
PARAM_NO_MEM,
PARAM_NEXT_OPERATION,
PARAM_LAST
} ParameterError;
struct GlobalConfig;
struct OperationConfig;
ParameterError getparameter(char *flag, char *nextarg, bool *usedarg,
struct GlobalConfig *global,
struct OperationConfig *operation);
#ifdef UNITTESTS
void parse_cert_parameter(const char *cert_parameter,
char **certname,
char **passphrase);
#endif
ParameterError parse_args(struct GlobalConfig *config, int argc,
argv_item_t argv[]);
#endif /* HEADER_CURL_TOOL_GETPARAM_H */

256
3rd-party/curl-7.52.1/src/tool_getpass.c vendored Normal file
View File

@@ -0,0 +1,256 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef HAVE_GETPASS_R
/* this file is only for systems without getpass_r() */
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#elif defined(HAVE_TERMIO_H)
# include <termio.h>
#endif
#ifdef __VMS
# include descrip
# include starlet
# include iodef
#endif
#ifdef WIN32
# include <conio.h>
#endif
#ifdef NETWARE
# ifdef __NOVELL_LIBC__
# include <screen.h>
# else
# include <nwconio.h>
# endif
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "tool_getpass.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef __VMS
/* VMS implementation */
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
long sts;
short chan;
/* MSK, 23-JAN-2004, iosbdef.h wasn't in VAX V7.2 or CC 6.4 */
/* distribution so I created this. May revert back later to */
/* struct _iosb iosb; */
struct _iosb
{
short int iosb$w_status; /* status */
short int iosb$w_bcnt; /* byte count */
int unused; /* unused */
} iosb;
$DESCRIPTOR(ttdesc, "TT");
buffer[0] = '\0';
sts = sys$assign(&ttdesc, &chan, 0, 0);
if(sts & 1) {
sts = sys$qiow(0, chan,
IO$_READPROMPT | IO$M_NOECHO,
&iosb, 0, 0, buffer, buflen, 0, 0,
prompt, strlen(prompt));
if((sts & 1) && (iosb.iosb$w_status & 1))
buffer[iosb.iosb$w_bcnt] = '\0';
sts = sys$dassgn(chan);
}
return buffer; /* we always return success */
}
#define DONE
#endif /* __VMS */
#ifdef __SYMBIAN32__
# define getch() getchar()
#endif
#if defined(WIN32) || defined(__SYMBIAN32__)
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i;
fputs(prompt, stderr);
for(i = 0; i < buflen; i++) {
buffer[i] = (char)getch();
if(buffer[i] == '\r' || buffer[i] == '\n') {
buffer[i] = '\0';
break;
}
else
if(buffer[i] == '\b')
/* remove this letter and if this is not the first key, remove the
previous one as well */
i = i - (i >= 1 ? 2 : 1);
}
#ifndef __SYMBIAN32__
/* since echo is disabled, print a newline */
fputs("\n", stderr);
#endif
/* if user didn't hit ENTER, terminate buffer */
if(i == buflen)
buffer[buflen-1] = '\0';
return buffer; /* we always return success */
}
#define DONE
#endif /* WIN32 || __SYMBIAN32__ */
#ifdef NETWARE
/* NetWare implementation */
#ifdef __NOVELL_LIBC__
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
return getpassword(prompt, buffer, buflen);
}
#else
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{
size_t i = 0;
printf("%s", prompt);
do {
buffer[i++] = getch();
if(buffer[i-1] == '\b') {
/* remove this letter and if this is not the first key,
remove the previous one as well */
if(i > 1) {
printf("\b \b");
i = i - 2;
}
else {
RingTheBell();
i = i - 1;
}
}
else if(buffer[i-1] != 13)
putchar('*');
} while((buffer[i-1] != 13) && (i < buflen));
buffer[i-1] = '\0';
printf("\r\n");
return buffer;
}
#endif /* __NOVELL_LIBC__ */
#define DONE
#endif /* NETWARE */
#ifndef DONE /* not previously provided */
#ifdef HAVE_TERMIOS_H
# define struct_term struct termios
#elif defined(HAVE_TERMIO_H)
# define struct_term struct termio
#else
# undef struct_term
#endif
static bool ttyecho(bool enable, int fd)
{
#ifdef struct_term
static struct_term withecho;
static struct_term noecho;
#endif
if(!enable) {
/* disable echo by extracting the current 'withecho' mode and remove the
ECHO bit and set back the struct */
#ifdef HAVE_TERMIOS_H
tcgetattr(fd, &withecho);
noecho = withecho;
noecho.c_lflag &= ~ECHO;
tcsetattr(fd, TCSANOW, &noecho);
#elif defined(HAVE_TERMIO_H)
ioctl(fd, TCGETA, &withecho);
noecho = withecho;
noecho.c_lflag &= ~ECHO;
ioctl(fd, TCSETA, &noecho);
#else
/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */
(void)fd;
return FALSE; /* not disabled */
#endif
return TRUE; /* disabled */
}
else {
/* re-enable echo, assumes we disabled it before (and set the structs we
now use to reset the terminal status) */
#ifdef HAVE_TERMIOS_H
tcsetattr(fd, TCSAFLUSH, &withecho);
#elif defined(HAVE_TERMIO_H)
ioctl(fd, TCSETA, &withecho);
#else
return FALSE; /* not enabled */
#endif
return TRUE; /* enabled */
}
}
char *getpass_r(const char *prompt, /* prompt to display */
char *password, /* buffer to store password in */
size_t buflen) /* size of buffer to store password in */
{
ssize_t nread;
bool disabled;
int fd = open("/dev/tty", O_RDONLY);
if(-1 == fd)
fd = STDIN_FILENO; /* use stdin if the tty couldn't be used */
disabled = ttyecho(FALSE, fd); /* disable terminal echo */
fputs(prompt, stderr);
nread = read(fd, password, buflen);
if(nread > 0)
password[--nread] = '\0'; /* zero terminate where enter is stored */
else
password[0] = '\0'; /* got nothing */
if(disabled) {
/* if echo actually was disabled, add a newline */
fputs("\n", stderr);
(void)ttyecho(TRUE, fd); /* enable echo */
}
if(STDIN_FILENO != fd)
close(fd);
return password; /* return pointer to buffer */
}
#endif /* DONE */
#endif /* HAVE_GETPASS_R */

View File

@@ -0,0 +1,36 @@
#ifndef HEADER_CURL_TOOL_GETPASS_H
#define HEADER_CURL_TOOL_GETPASS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef HAVE_GETPASS_R
/* If there's a system-provided function named like this, we trust it is
also found in one of the standard headers. */
/*
* Returning NULL will abort the continued operation!
*/
char *getpass_r(const char *prompt, char *buffer, size_t buflen);
#endif
#endif /* HEADER_CURL_TOOL_GETPASS_H */

381
3rd-party/curl-7.52.1/src/tool_help.c vendored Normal file
View File

@@ -0,0 +1,381 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_panykey.h"
#include "tool_help.h"
#include "tool_libinfo.h"
#include "tool_version.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef MSDOS
# define USE_WATT32
#endif
/*
* A few of these source lines are >80 columns wide, but that's only because
* breaking the strings narrower makes this chunk look even worse!
*
* Starting with 7.18.0, this list of command line options is sorted based
* on the long option name. It is not done automatically, although a command
* line like the following can help out:
*
* curl --help | cut -c5- | grep "^-" | sort
*/
static const char *const helptext[] = {
"Usage: curl [options...] <url>",
"Options: (H) means HTTP/HTTPS only, (F) means FTP only",
" --anyauth Pick \"any\" authentication method (H)",
" -a, --append Append to target file when uploading (F/SFTP)",
" --basic Use HTTP Basic Authentication (H)",
" --cacert FILE CA certificate to verify peer against (SSL)",
" --capath DIR CA directory to verify peer against (SSL)",
" -E, --cert CERT[:PASSWD] Client certificate file and password (SSL)",
" --cert-status Verify the status of the server certificate (SSL)",
" --cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL)",
" --ciphers LIST SSL ciphers to use (SSL)",
" --compressed Request compressed response (using deflate or gzip)",
" -K, --config FILE Read config from FILE",
" --connect-timeout SECONDS Maximum time allowed for connection",
" --connect-to HOST1:PORT1:HOST2:PORT2 Connect to host (network level)",
" -C, --continue-at OFFSET Resumed transfer OFFSET",
" -b, --cookie STRING/FILE Read cookies from STRING/FILE (H)",
" -c, --cookie-jar FILE Write cookies to FILE after operation (H)",
" --create-dirs Create necessary local directory hierarchy",
" --crlf Convert LF to CRLF in upload",
" --crlfile FILE Get a CRL list in PEM format from the given file",
" -d, --data DATA HTTP POST data (H)",
" --data-raw DATA HTTP POST data, '@' allowed (H)",
" --data-ascii DATA HTTP POST ASCII data (H)",
" --data-binary DATA HTTP POST binary data (H)",
" --data-urlencode DATA HTTP POST data url encoded (H)",
" --delegation STRING GSS-API delegation permission",
" --digest Use HTTP Digest Authentication (H)",
" --disable-eprt Inhibit using EPRT or LPRT (F)",
" --disable-epsv Inhibit using EPSV (F)",
" --dns-servers DNS server addrs to use: 1.1.1.1;2.2.2.2",
" --dns-interface Interface to use for DNS requests",
" --dns-ipv4-addr IPv4 address to use for DNS requests, dot notation",
" --dns-ipv6-addr IPv6 address to use for DNS requests, dot notation",
" -D, --dump-header FILE Write the received headers to FILE",
" --egd-file FILE EGD socket path for random data (SSL)",
" --engine ENGINE Crypto engine (use \"--engine list\" for list) (SSL)",
#ifdef USE_ENVIRONMENT
" --environment Write results to environment variables (RISC OS)",
#endif
" --expect100-timeout SECONDS How long to wait for 100-continue (H)",
" -f, --fail Fail silently (no output at all) on HTTP errors (H)",
" --fail-early Fail on first transfer error, do not continue",
" --false-start Enable TLS False Start.",
" -F, --form CONTENT Specify HTTP multipart POST data (H)",
" --form-string STRING Specify HTTP multipart POST data (H)",
" --ftp-account DATA Account data string (F)",
" --ftp-alternative-to-user COMMAND "
"String to replace \"USER [name]\" (F)",
" --ftp-create-dirs Create the remote dirs if not present (F)",
" --ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)",
" --ftp-pasv Use PASV/EPSV instead of PORT (F)",
" -P, --ftp-port ADR Use PORT with given address instead of PASV (F)",
" --ftp-skip-pasv-ip Skip the IP address for PASV (F)\n"
" --ftp-pret Send PRET before PASV (for drftpd) (F)",
" --ftp-ssl-ccc Send CCC after authenticating (F)",
" --ftp-ssl-ccc-mode ACTIVE/PASSIVE Set CCC mode (F)",
" --ftp-ssl-control Require SSL/TLS for FTP login, "
"clear for transfer (F)",
" -G, --get Send the -d data with a HTTP GET (H)",
" -g, --globoff Disable URL sequences and ranges using {} and []",
" -H, --header LINE Pass custom header LINE to server (H)",
" -I, --head Show document info only",
" -h, --help This help text",
" --hostpubmd5 MD5 "
"Hex-encoded MD5 string of the host public key. (SSH)",
" -0, --http1.0 Use HTTP 1.0 (H)",
" --http1.1 Use HTTP 1.1 (H)",
" --http2 Use HTTP 2 (H)",
" --http2-prior-knowledge Use HTTP 2 without HTTP/1.1 Upgrade (H)",
" --ignore-content-length Ignore the HTTP Content-Length header",
" -i, --include Include protocol headers in the output (H/F)",
" -k, --insecure Allow connections to SSL sites without certs (H)",
" --interface INTERFACE Use network INTERFACE (or address)",
" -4, --ipv4 Resolve name to IPv4 address",
" -6, --ipv6 Resolve name to IPv6 address",
" -j, --junk-session-cookies Ignore session cookies read from file (H)",
" --keepalive-time SECONDS Wait SECONDS between keepalive probes",
" --key KEY Private key file name (SSL/SSH)",
" --key-type TYPE Private key file type (DER/PEM/ENG) (SSL)",
" --krb LEVEL Enable Kerberos with security LEVEL (F)",
#ifndef CURL_DISABLE_LIBCURL_OPTION
" --libcurl FILE Dump libcurl equivalent code of this command line",
#endif
" --limit-rate RATE Limit transfer speed to RATE",
" -l, --list-only List only mode (F/POP3)",
" --local-port RANGE Force use of RANGE for local port numbers",
" -L, --location Follow redirects (H)",
" --location-trusted "
"Like '--location', and send auth to other hosts (H)",
" --login-options OPTIONS Server login options (IMAP, POP3, SMTP)",
" -M, --manual Display the full manual",
" --mail-from FROM Mail from this address (SMTP)",
" --mail-rcpt TO Mail to this/these addresses (SMTP)",
" --mail-auth AUTH Originator address of the original email (SMTP)",
" --max-filesize BYTES Maximum file size to download (H/F)",
" --max-redirs NUM Maximum number of redirects allowed (H)",
" -m, --max-time SECONDS Maximum time allowed for the transfer",
" --metalink Process given URLs as metalink XML file",
" --negotiate Use HTTP Negotiate (SPNEGO) authentication (H)",
" -n, --netrc Must read .netrc for user name and password",
" --netrc-optional Use either .netrc or URL; overrides -n",
" --netrc-file FILE Specify FILE for netrc",
" -:, --next "
"Allows the following URL to use a separate set of options",
" --no-alpn Disable the ALPN TLS extension (H)",
" -N, --no-buffer Disable buffering of the output stream",
" --no-keepalive Disable keepalive use on the connection",
" --no-npn Disable the NPN TLS extension (H)",
" --no-sessionid Disable SSL session-ID reusing (SSL)",
" --noproxy List of hosts which do not use proxy",
" --ntlm Use HTTP NTLM authentication (H)",
" --ntlm-wb Use HTTP NTLM authentication with winbind (H)",
" --oauth2-bearer TOKEN OAuth 2 Bearer Token (IMAP, POP3, SMTP)",
" -o, --output FILE Write to FILE instead of stdout",
" --pass PASS Pass phrase for the private key (SSL/SSH)",
" --path-as-is Do not squash .. sequences in URL path",
" --pinnedpubkey FILE/HASHES Public key to verify peer against (SSL)",
" --post301 "
"Do not switch to GET after following a 301 redirect (H)",
" --post302 "
"Do not switch to GET after following a 302 redirect (H)",
" --post303 "
"Do not switch to GET after following a 303 redirect (H)",
" --preproxy [PROTOCOL://]HOST[:PORT] Proxy before HTTP(S) proxy",
" -#, --progress-bar Display transfer progress as a progress bar",
" --proto PROTOCOLS Enable/disable PROTOCOLS",
" --proto-default PROTOCOL Use PROTOCOL for any URL missing a scheme",
" --proto-redir PROTOCOLS Enable/disable PROTOCOLS on redirect",
" -x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port",
" --proxy-anyauth Pick \"any\" proxy authentication method (H)",
" --proxy-basic Use Basic authentication on the proxy (H)",
" --proxy-digest Use Digest authentication on the proxy (H)",
" --proxy-cacert FILE "
"CA certificate to verify peer against for proxy (SSL)",
" --proxy-capath DIR "
"CA directory to verify peer against for proxy (SSL)",
" --proxy-cert CERT[:PASSWD] "
"Client certificate file and password for proxy (SSL)",
" --proxy-cert-type TYPE "
"Certificate file type (DER/PEM/ENG) for proxy (SSL)",
" --proxy-ciphers LIST SSL ciphers to use for proxy (SSL)",
" --proxy-crlfile FILE "
"Get a CRL list in PEM format from the given file for proxy",
" --proxy-insecure "
"Allow connections to SSL sites without certs for proxy (H)",
" --proxy-key KEY Private key file name for proxy (SSL)",
" --proxy-key-type TYPE "
"Private key file type for proxy (DER/PEM/ENG) (SSL)",
" --proxy-negotiate "
"Use HTTP Negotiate (SPNEGO) authentication on the proxy (H)",
" --proxy-ntlm Use NTLM authentication on the proxy (H)",
" --proxy-header LINE Pass custom header LINE to proxy (H)",
" --proxy-pass PASS Pass phrase for the private key for proxy (SSL)",
" --proxy-ssl-allow-beast "
"Allow security flaw to improve interop for proxy (SSL)",
" --proxy-tlsv1 Use TLSv1 for proxy (SSL)",
" --proxy-tlsuser USER TLS username for proxy",
" --proxy-tlspassword STRING TLS password for proxy",
" --proxy-tlsauthtype STRING "
"TLS authentication type for proxy (default SRP)",
" --proxy-service-name NAME SPNEGO proxy service name",
" --service-name NAME SPNEGO service name",
" -U, --proxy-user USER[:PASSWORD] Proxy user and password",
" --proxy1.0 HOST[:PORT] Use HTTP/1.0 proxy on given port",
" -p, --proxytunnel Operate through a HTTP proxy tunnel (using CONNECT)",
" --pubkey KEY Public key file name (SSH)",
" -Q, --quote CMD Send command(s) to server before transfer (F/SFTP)",
" --random-file FILE File for reading random data from (SSL)",
" -r, --range RANGE Retrieve only the bytes within RANGE",
" --raw Do HTTP \"raw\"; no transfer decoding (H)",
" -e, --referer Referer URL (H)",
" -J, --remote-header-name Use the header-provided filename (H)",
" -O, --remote-name Write output to a file named as the remote file",
" --remote-name-all Use the remote file name for all URLs",
" -R, --remote-time Set the remote file's time on the local output",
" -X, --request COMMAND Specify request command to use",
" --resolve HOST:PORT:ADDRESS Force resolve of HOST:PORT to ADDRESS",
" --retry NUM "
"Retry request NUM times if transient problems occur",
" --retry-connrefused Retry on connection refused (use with --retry)",
" --retry-delay SECONDS Wait SECONDS between retries",
" --retry-max-time SECONDS Retry only within this period",
" --sasl-ir Enable initial response in SASL authentication",
" -S, --show-error "
"Show error. With -s, make curl show errors when they occur",
" -s, --silent Silent mode (don't output anything)",
" --socks4 HOST[:PORT] SOCKS4 proxy on given host + port",
" --socks4a HOST[:PORT] SOCKS4a proxy on given host + port",
" --socks5 HOST[:PORT] SOCKS5 proxy on given host + port",
" --socks5-hostname HOST[:PORT] "
"SOCKS5 proxy, pass host name to proxy",
" --socks5-gssapi-service NAME SOCKS5 proxy service name for GSS-API",
" --socks5-gssapi-nec Compatibility with NEC SOCKS5 server",
" -Y, --speed-limit RATE "
"Stop transfers below RATE for 'speed-time' secs",
" -y, --speed-time SECONDS "
"Trigger 'speed-limit' abort after SECONDS (default: 30)",
" --ssl Try SSL/TLS (FTP, IMAP, POP3, SMTP)",
" --ssl-reqd Require SSL/TLS (FTP, IMAP, POP3, SMTP)",
" -2, --sslv2 Use SSLv2 (SSL)",
" -3, --sslv3 Use SSLv3 (SSL)",
" --ssl-allow-beast Allow security flaw to improve interop (SSL)",
" --ssl-no-revoke Disable cert revocation checks (WinSSL)",
" --stderr FILE Where to redirect stderr (use \"-\" for stdout)",
" --tcp-nodelay Use the TCP_NODELAY option",
" --tcp-fastopen Use TCP Fast Open",
" -t, --telnet-option OPT=VAL Set telnet option",
" --tftp-blksize VALUE Set TFTP BLKSIZE option (must be >512)",
" --tftp-no-options Do not send TFTP options requests",
" -z, --time-cond TIME Transfer based on a time condition",
" -1, --tlsv1 Use >= TLSv1 (SSL)",
" --tlsv1.0 Use TLSv1.0 (SSL)",
" --tlsv1.1 Use TLSv1.1 (SSL)",
" --tlsv1.2 Use TLSv1.2 (SSL)",
" --tlsv1.3 Use TLSv1.3 (SSL)",
" --trace FILE Write a debug trace to FILE",
" --trace-ascii FILE Like --trace, but without hex output",
" --trace-time Add time stamps to trace/verbose output",
" --tr-encoding Request compressed transfer encoding (H)",
" -T, --upload-file FILE Transfer FILE to destination",
" --url URL URL to work with",
" -B, --use-ascii Use ASCII/text transfer",
" -u, --user USER[:PASSWORD] Server user and password",
" --tlsuser USER TLS username",
" --tlspassword STRING TLS password",
" --tlsauthtype STRING TLS authentication type (default: SRP)",
" --unix-socket FILE Connect through this Unix domain socket",
" -A, --user-agent STRING Send User-Agent STRING to server (H)",
" -v, --verbose Make the operation more talkative",
" -V, --version Show version number and quit",
#ifdef USE_WATT32
" --wdebug Turn on Watt-32 debugging",
#endif
" -w, --write-out FORMAT Use output FORMAT after completion",
" --xattr Store metadata in extended file attributes",
" -q, --disable Disable .curlrc (must be first parameter)",
NULL
};
#ifdef NETWARE
# define PRINT_LINES_PAUSE 23
#endif
#ifdef __SYMBIAN32__
# define PRINT_LINES_PAUSE 16
#endif
struct feat {
const char *name;
int bitmask;
};
static const struct feat feats[] = {
{"AsynchDNS", CURL_VERSION_ASYNCHDNS},
{"Debug", CURL_VERSION_DEBUG},
{"TrackMemory", CURL_VERSION_CURLDEBUG},
{"IDN", CURL_VERSION_IDN},
{"IPv6", CURL_VERSION_IPV6},
{"Largefile", CURL_VERSION_LARGEFILE},
{"SSPI", CURL_VERSION_SSPI},
{"GSS-API", CURL_VERSION_GSSAPI},
{"Kerberos", CURL_VERSION_KERBEROS5},
{"SPNEGO", CURL_VERSION_SPNEGO},
{"NTLM", CURL_VERSION_NTLM},
{"NTLM_WB", CURL_VERSION_NTLM_WB},
{"SSL", CURL_VERSION_SSL},
{"libz", CURL_VERSION_LIBZ},
{"CharConv", CURL_VERSION_CONV},
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
{"HTTP2", CURL_VERSION_HTTP2},
{"UnixSockets", CURL_VERSION_UNIX_SOCKETS},
{"HTTPS-proxy", CURL_VERSION_HTTPS_PROXY}
};
void tool_help(void)
{
int i;
for(i = 0; helptext[i]; i++) {
puts(helptext[i]);
#ifdef PRINT_LINES_PAUSE
if(i && ((i % PRINT_LINES_PAUSE) == 0))
tool_pressanykey();
#endif
}
}
void tool_version_info(void)
{
const char *const *proto;
printf(CURL_ID "%s\n", curl_version());
if(curlinfo->protocols) {
printf("Protocols: ");
for(proto = curlinfo->protocols; *proto; ++proto) {
printf("%s ", *proto);
}
puts(""); /* newline */
}
if(curlinfo->features) {
unsigned int i;
printf("Features: ");
for(i = 0; i < sizeof(feats)/sizeof(feats[0]); i++) {
if(curlinfo->features & feats[i].bitmask)
printf("%s ", feats[i].name);
}
#ifdef USE_METALINK
printf("Metalink ");
#endif
#ifdef USE_LIBPSL
printf("PSL ");
#endif
puts(""); /* newline */
}
}
void tool_list_engines(CURL *curl)
{
struct curl_slist *engines = NULL;
/* Get the list of engines */
curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);
puts("Build-time engines:");
if(engines) {
for(; engines; engines = engines->next)
printf(" %s\n", engines->data);
}
else {
puts(" <none>");
}
/* Cleanup the list of engines */
curl_slist_free_all(engines);
}

31
3rd-party/curl-7.52.1/src/tool_help.h vendored Normal file
View File

@@ -0,0 +1,31 @@
#ifndef HEADER_CURL_TOOL_HELP_H
#define HEADER_CURL_TOOL_HELP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
void tool_help(void);
void tool_list_engines(CURL *curl);
void tool_version_info(void);
#endif /* HEADER_CURL_TOOL_HELP_H */

116
3rd-party/curl-7.52.1/src/tool_helpers.c vendored Normal file
View File

@@ -0,0 +1,116 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "tool_getparam.h"
#include "tool_helpers.h"
#include "memdebug.h" /* keep this as LAST include */
/*
** Helper functions that are used from more than one source file.
*/
const char *param2text(int res)
{
ParameterError error = (ParameterError)res;
switch(error) {
case PARAM_GOT_EXTRA_PARAMETER:
return "had unsupported trailing garbage";
case PARAM_OPTION_UNKNOWN:
return "is unknown";
case PARAM_OPTION_AMBIGUOUS:
return "is ambiguous";
case PARAM_REQUIRES_PARAMETER:
return "requires parameter";
case PARAM_BAD_USE:
return "is badly used here";
case PARAM_BAD_NUMERIC:
return "expected a proper numerical parameter";
case PARAM_NEGATIVE_NUMERIC:
return "expected a positive numerical parameter";
case PARAM_LIBCURL_DOESNT_SUPPORT:
return "the installed libcurl version doesn't support this";
case PARAM_LIBCURL_UNSUPPORTED_PROTOCOL:
return "a specified protocol is unsupported by libcurl";
case PARAM_NO_MEM:
return "out of memory";
default:
return "unknown error";
}
}
int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store)
{
/* this mirrors the HttpReq enum in tool_sdecls.h */
const char *reqname[]= {
"", /* unspec */
"GET (-G, --get)",
"HEAD (-I, --head)",
"multipart formpost (-F, --form)",
"POST (-d, --data)"
};
if((*store == HTTPREQ_UNSPEC) ||
(*store == req)) {
*store = req;
return 0;
}
warnf(config->global, "You can only select one HTTP request method! "
"You asked for both %s and %s.\n",
reqname[req], reqname[*store]);
return 1;
}
void customrequest_helper(struct OperationConfig *config, HttpReq req,
char *method)
{
/* this mirrors the HttpReq enum in tool_sdecls.h */
const char *dflt[]= {
"GET",
"GET",
"HEAD",
"POST",
"POST"
};
if(!method)
;
else if(curl_strequal(method, dflt[req])) {
notef(config->global, "Unnecessary use of -X or --request, %s is already "
"inferred.\n", dflt[req]);
}
else if(curl_strequal(method, "head")) {
warnf(config->global,
"Setting custom HTTP method to HEAD with -X/--request may not work "
"the way you want. Consider using -I/--head instead.\n");
}
}

View File

@@ -0,0 +1,35 @@
#ifndef HEADER_CURL_TOOL_HELPERS_H
#define HEADER_CURL_TOOL_HELPERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
const char *param2text(int res);
int SetHTTPrequest(struct OperationConfig *config, HttpReq req,
HttpReq *store);
void customrequest_helper(struct OperationConfig *config, HttpReq req,
char *method);
#endif /* HEADER_CURL_TOOL_HELPERS_H */

View File

@@ -0,0 +1,95 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#include "tool_homedir.h"
#include "memdebug.h" /* keep this as LAST include */
static char *GetEnv(const char *variable, char do_expand)
{
char *env = NULL;
#ifdef WIN32
char buf1[1024], buf2[1024];
DWORD rc;
/* Don't use getenv(); it doesn't find variable added after program was
* started. Don't accept truncated results (i.e. rc >= sizeof(buf1)). */
rc = GetEnvironmentVariable(variable, buf1, sizeof(buf1));
if(rc > 0 && rc < sizeof(buf1)) {
env = buf1;
variable = buf1;
}
if(do_expand && strchr(variable, '%')) {
/* buf2 == variable if not expanded */
rc = ExpandEnvironmentStrings(variable, buf2, sizeof(buf2));
if(rc > 0 && rc < sizeof(buf2) &&
!strchr(buf2, '%')) /* no vars still unexpanded */
env = buf2;
}
#else
(void)do_expand;
/* no length control */
env = getenv(variable);
#endif
return (env && env[0]) ? strdup(env) : NULL;
}
/* return the home directory of the current user as an allocated string */
char *homedir(void)
{
char *home;
home = GetEnv("CURL_HOME", FALSE);
if(home)
return home;
home = GetEnv("HOME", FALSE);
if(home)
return home;
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
{
struct passwd *pw = getpwuid(geteuid());
if(pw) {
home = pw->pw_dir;
if(home && home[0])
home = strdup(home);
else
home = NULL;
}
}
#endif /* PWD-stuff */
#ifdef WIN32
home = GetEnv("APPDATA", TRUE);
if(!home)
home = GetEnv("%USERPROFILE%\\Application Data", TRUE); /* Normally only
on Win-2K/XP */
#endif /* WIN32 */
return home;
}

View File

@@ -0,0 +1,28 @@
#ifndef HEADER_CURL_TOOL_HOMEDIR_H
#define HEADER_CURL_TOOL_HOMEDIR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
char *homedir(void);
#endif /* HEADER_CURL_TOOL_HOMEDIR_H */

9549
3rd-party/curl-7.52.1/src/tool_hugehelp.c vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
#ifndef HEADER_CURL_TOOL_HUGEHELP_H
#define HEADER_CURL_TOOL_HUGEHELP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
void hugehelp(void);
#endif /* HEADER_CURL_TOOL_HUGEHELP_H */

102
3rd-party/curl-7.52.1/src/tool_libinfo.c vendored Normal file
View File

@@ -0,0 +1,102 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_libinfo.h"
#include "memdebug.h" /* keep this as LAST include */
/* global variable definitions, for libcurl run-time info */
curl_version_info_data *curlinfo = NULL;
long built_in_protos = 0;
/*
* libcurl_info_init: retrieves run-time information about libcurl,
* setting a global pointer 'curlinfo' to libcurl's run-time info
* struct, and a global bit pattern 'built_in_protos' composed of
* CURLPROTO_* bits indicating which protocols are actually built
* into library being used.
*/
CURLcode get_libcurl_info(void)
{
static struct proto_name_pattern {
const char *proto_name;
long proto_pattern;
} const possibly_built_in[] = {
{ "dict", CURLPROTO_DICT },
{ "file", CURLPROTO_FILE },
{ "ftp", CURLPROTO_FTP },
{ "ftps", CURLPROTO_FTPS },
{ "gopher", CURLPROTO_GOPHER },
{ "http", CURLPROTO_HTTP },
{ "https", CURLPROTO_HTTPS },
{ "imap", CURLPROTO_IMAP },
{ "imaps", CURLPROTO_IMAPS },
{ "ldap", CURLPROTO_LDAP },
{ "ldaps", CURLPROTO_LDAPS },
{ "pop3", CURLPROTO_POP3 },
{ "pop3s", CURLPROTO_POP3S },
{ "rtmp", CURLPROTO_RTMP },
{ "rtsp", CURLPROTO_RTSP },
{ "scp", CURLPROTO_SCP },
{ "sftp", CURLPROTO_SFTP },
{ "smb", CURLPROTO_SMB },
{ "smbs", CURLPROTO_SMBS },
{ "smtp", CURLPROTO_SMTP },
{ "smtps", CURLPROTO_SMTPS },
{ "telnet", CURLPROTO_TELNET },
{ "tftp", CURLPROTO_TFTP },
{ NULL, 0 }
};
struct proto_name_pattern const *p;
const char *const *proto;
/* Pointer to libcurl's run-time version information */
curlinfo = curl_version_info(CURLVERSION_NOW);
if(!curlinfo)
return CURLE_FAILED_INIT;
/* Build CURLPROTO_* bit pattern with libcurl's built-in protocols */
built_in_protos = 0;
if(curlinfo->protocols) {
for(proto = curlinfo->protocols; *proto; proto++) {
for(p = possibly_built_in; p->proto_name; p++) {
if(curl_strequal(*proto, p->proto_name)) {
built_in_protos |= p->proto_pattern;
break;
}
}
}
}
return CURLE_OK;
}

View File

@@ -0,0 +1,34 @@
#ifndef HEADER_CURL_TOOL_LIBINFO_H
#define HEADER_CURL_TOOL_LIBINFO_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/* global variable declarations, for libcurl run-time info */
extern curl_version_info_data *curlinfo;
extern long built_in_protos;
CURLcode get_libcurl_info(void);
#endif /* HEADER_CURL_TOOL_LIBINFO_H */

275
3rd-party/curl-7.52.1/src/tool_main.c vendored Normal file
View File

@@ -0,0 +1,275 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include <sys/stat.h>
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#ifdef USE_NSS
#include <nspr.h>
#include <plarenas.h>
#endif
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_convert.h"
#include "tool_msgs.h"
#include "tool_operate.h"
#include "tool_panykey.h"
#include "tool_vms.h"
#include "tool_main.h"
#include "tool_libinfo.h"
/*
* This is low-level hard-hacking memory leak tracking and similar. Using
* the library level code from this client-side is ugly, but we do this
* anyway for convenience.
*/
#include "memdebug.h" /* keep this as LAST include */
#ifdef __VMS
/*
* vms_show is a global variable, used in main() as parameter for
* function vms_special_exit() to allow proper curl tool exiting.
* Its value may be set in other tool_*.c source files thanks to
* forward declaration present in tool_vms.h
*/
int vms_show = 0;
#endif
/* if we build a static library for unit tests, there is no main() function */
#ifndef UNITTESTS
/*
* Ensure that file descriptors 0, 1 and 2 (stdin, stdout, stderr) are
* open before starting to run. Otherwise, the first three network
* sockets opened by curl could be used for input sources, downloaded data
* or error logs as they will effectively be stdin, stdout and/or stderr.
*/
static void main_checkfds(void)
{
#ifdef HAVE_PIPE
int fd[2] = { STDIN_FILENO, STDIN_FILENO };
while(fd[0] == STDIN_FILENO ||
fd[0] == STDOUT_FILENO ||
fd[0] == STDERR_FILENO ||
fd[1] == STDIN_FILENO ||
fd[1] == STDOUT_FILENO ||
fd[1] == STDERR_FILENO)
if(pipe(fd) < 0)
return; /* Out of handles. This isn't really a big problem now, but
will be when we try to create a socket later. */
close(fd[0]);
close(fd[1]);
#endif
}
#ifdef CURLDEBUG
static void memory_tracking_init(void)
{
char *env;
/* if CURL_MEMDEBUG is set, this starts memory tracking message logging */
env = curlx_getenv("CURL_MEMDEBUG");
if(env) {
/* use the value as file name */
char fname[CURL_MT_LOGFNAME_BUFSIZE];
if(strlen(env) >= CURL_MT_LOGFNAME_BUFSIZE)
env[CURL_MT_LOGFNAME_BUFSIZE-1] = '\0';
strcpy(fname, env);
curl_free(env);
curl_memdebug(fname);
/* this weird stuff here is to make curl_free() get called
before curl_memdebug() as otherwise memory tracking will
log a free() without an alloc! */
}
/* if CURL_MEMLIMIT is set, this enables fail-on-alloc-number-N feature */
env = curlx_getenv("CURL_MEMLIMIT");
if(env) {
char *endptr;
long num = strtol(env, &endptr, 10);
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
curl_memlimit(num);
curl_free(env);
}
}
#else
# define memory_tracking_init() Curl_nop_stmt
#endif
/*
* This is the main global constructor for the app. Call this before
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result.
*/
static CURLcode main_init(struct GlobalConfig *config)
{
CURLcode result = CURLE_OK;
#if defined(__DJGPP__) || defined(__GO32__)
/* stop stat() wasting time */
_djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
#endif
/* Initialise the global config */
config->showerror = -1; /* Will show errors */
config->errors = stderr; /* Default errors to stderr */
/* Allocate the initial operate config */
config->first = config->last = malloc(sizeof(struct OperationConfig));
if(config->first) {
/* Perform the libcurl initialization */
result = curl_global_init(CURL_GLOBAL_DEFAULT);
if(!result) {
/* Get information about libcurl */
result = get_libcurl_info();
if(!result) {
/* Get a curl handle to use for all forthcoming curl transfers */
config->easy = curl_easy_init();
if(config->easy) {
/* Initialise the config */
config_init(config->first);
config->first->easy = config->easy;
config->first->global = config;
}
else {
helpf(stderr, "error initializing curl easy handle\n");
result = CURLE_FAILED_INIT;
free(config->first);
}
}
else {
helpf(stderr, "error retrieving curl library information\n");
free(config->first);
}
}
else {
helpf(stderr, "error initializing curl library\n");
free(config->first);
}
}
else {
helpf(stderr, "error initializing curl\n");
result = CURLE_FAILED_INIT;
}
return result;
}
static void free_config_fields(struct GlobalConfig *config)
{
Curl_safefree(config->trace_dump);
if(config->errors_fopened && config->errors)
fclose(config->errors);
config->errors = NULL;
if(config->trace_fopened && config->trace_stream)
fclose(config->trace_stream);
config->trace_stream = NULL;
Curl_safefree(config->libcurl);
}
/*
* This is the main global destructor for the app. Call this after
* _all_ libcurl usage is done.
*/
static void main_free(struct GlobalConfig *config)
{
/* Cleanup the easy handle */
curl_easy_cleanup(config->easy);
config->easy = NULL;
/* Main cleanup */
curl_global_cleanup();
convert_cleanup();
metalink_cleanup();
#ifdef USE_NSS
if(PR_Initialized()) {
/* prevent valgrind from reporting still reachable mem from NSRP arenas */
PL_ArenaFinish();
/* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
PR_Cleanup();
}
#endif
free_config_fields(config);
/* Free the config structures */
config_free(config->last);
config->first = NULL;
config->last = NULL;
}
/*
** curl tool main function.
*/
int main(int argc, char *argv[])
{
CURLcode result = CURLE_OK;
struct GlobalConfig global;
memset(&global, 0, sizeof(global));
main_checkfds();
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
(void)signal(SIGPIPE, SIG_IGN);
#endif
/* Initialize memory tracking */
memory_tracking_init();
/* Initialize the curl library - do not call any libcurl functions before
this point */
result = main_init(&global);
if(!result) {
/* Start our curl operation */
result = operate(&global, argc, argv);
#ifdef __SYMBIAN32__
if(global.showerror)
tool_pressanykey();
#endif
/* Perform the main cleanup */
main_free(&global);
}
#ifdef __NOVELL_LIBC__
if(getenv("_IN_NETWARE_BASH_") == NULL)
tool_pressanykey();
#endif
#ifdef __VMS
vms_special_exit(result, vms_show);
#else
return (int)result;
#endif
}
#endif /* ndef UNITTESTS */

44
3rd-party/curl-7.52.1/src/tool_main.h vendored Normal file
View File

@@ -0,0 +1,44 @@
#ifndef HEADER_CURL_TOOL_MAIN_H
#define HEADER_CURL_TOOL_MAIN_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define DEFAULT_MAXREDIRS 50L
#define RETRY_SLEEP_DEFAULT 1000L /* ms */
#define RETRY_SLEEP_MAX 600000L /* ms == 10 minutes */
#ifndef STDIN_FILENO
# define STDIN_FILENO fileno(stdin)
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO fileno(stdout)
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO fileno(stderr)
#endif
#endif /* HEADER_CURL_TOOL_MAIN_H */

View File

@@ -0,0 +1,976 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef USE_METALINK
#include <sys/stat.h>
#include <stdlib.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef USE_OPENSSL
# include <openssl/md5.h>
# include <openssl/sha.h>
#elif defined(USE_GNUTLS_NETTLE)
# include <nettle/md5.h>
# include <nettle/sha.h>
# define MD5_CTX struct md5_ctx
# define SHA_CTX struct sha1_ctx
# define SHA256_CTX struct sha256_ctx
#elif defined(USE_GNUTLS)
# include <gcrypt.h>
# define MD5_CTX gcry_md_hd_t
# define SHA_CTX gcry_md_hd_t
# define SHA256_CTX gcry_md_hd_t
#elif defined(USE_NSS)
# include <nss.h>
# include <pk11pub.h>
# define MD5_CTX void *
# define SHA_CTX void *
# define SHA256_CTX void *
static NSSInitContext *nss_context;
#elif defined(USE_POLARSSL)
# include <polarssl/md5.h>
# include <polarssl/sha1.h>
# include <polarssl/sha256.h>
# define MD5_CTX md5_context
# define SHA_CTX sha1_context
# define SHA256_CTX sha256_context
#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
(__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
(defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
(__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
/* For Apple operating systems: CommonCrypto has the functions we need.
The library's headers are even backward-compatible with OpenSSL's
headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.
These functions are available on Tiger and later, as well as iOS 2.0
and later. If you're building for an older cat, well, sorry. */
# define COMMON_DIGEST_FOR_OPENSSL
# include <CommonCrypto/CommonDigest.h>
#elif defined(_WIN32)
/* For Windows: If no other crypto library is provided, we fallback
to the hash functions provided within the Microsoft Windows CryptoAPI */
# include <wincrypt.h>
/* Custom structure in order to store the required provider and hash handle */
struct win32_crypto_hash {
HCRYPTPROV hCryptProv;
HCRYPTHASH hHash;
};
/* Custom Microsoft AES Cryptographic Provider defines required for MinGW */
# ifndef ALG_SID_SHA_256
# define ALG_SID_SHA_256 12
# endif
# ifndef CALG_SHA_256
# define CALG_SHA_256 (ALG_CLASS_HASH | ALG_TYPE_ANY | ALG_SID_SHA_256)
# endif
# define MD5_CTX struct win32_crypto_hash
# define SHA_CTX struct win32_crypto_hash
# define SHA256_CTX struct win32_crypto_hash
#else
# error "Can't compile METALINK support without a crypto library."
#endif
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_getparam.h"
#include "tool_paramhlp.h"
#include "tool_cfgable.h"
#include "tool_metalink.h"
#include "tool_msgs.h"
#include "memdebug.h" /* keep this as LAST include */
/* Copied from tool_getparam.c */
#define GetStr(str,val) do { \
if(*(str)) { \
free(*(str)); \
*(str) = NULL; \
} \
if((val)) \
*(str) = strdup((val)); \
if(!(val)) \
return PARAM_NO_MEM; \
} WHILE_FALSE
#ifdef USE_GNUTLS_NETTLE
static int MD5_Init(MD5_CTX *ctx)
{
md5_init(ctx);
return 1;
}
static void MD5_Update(MD5_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
md5_update(ctx, inputLen, input);
}
static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
{
md5_digest(ctx, 16, digest);
}
static int SHA1_Init(SHA_CTX *ctx)
{
sha1_init(ctx);
return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
sha1_update(ctx, inputLen, input);
}
static void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)
{
sha1_digest(ctx, 20, digest);
}
static int SHA256_Init(SHA256_CTX *ctx)
{
sha256_init(ctx);
return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
sha256_update(ctx, inputLen, input);
}
static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
{
sha256_digest(ctx, 32, digest);
}
#elif defined(USE_GNUTLS)
static int MD5_Init(MD5_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_MD5, 0);
return 1;
}
static void MD5_Update(MD5_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
gcry_md_write(*ctx, input, inputLen);
}
static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
{
memcpy(digest, gcry_md_read(*ctx, 0), 16);
gcry_md_close(*ctx);
}
static int SHA1_Init(SHA_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_SHA1, 0);
return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
gcry_md_write(*ctx, input, inputLen);
}
static void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)
{
memcpy(digest, gcry_md_read(*ctx, 0), 20);
gcry_md_close(*ctx);
}
static int SHA256_Init(SHA256_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_SHA256, 0);
return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
gcry_md_write(*ctx, input, inputLen);
}
static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
{
memcpy(digest, gcry_md_read(*ctx, 0), 32);
gcry_md_close(*ctx);
}
#elif defined(USE_NSS)
static int nss_hash_init(void **pctx, SECOidTag hash_alg)
{
PK11Context *ctx;
/* we have to initialize NSS if not initialized alraedy */
if(!NSS_IsInitialized() && !nss_context) {
static NSSInitParameters params;
params.length = sizeof params;
nss_context = NSS_InitContext("", "", "", "", &params, NSS_INIT_READONLY
| NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN
| NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE | NSS_INIT_PK11RELOAD);
}
ctx = PK11_CreateDigestContext(hash_alg);
if(!ctx)
return /* failure */ 0;
if(PK11_DigestBegin(ctx) != SECSuccess) {
PK11_DestroyContext(ctx, PR_TRUE);
return /* failure */ 0;
}
*pctx = ctx;
return /* success */ 1;
}
static void nss_hash_final(void **pctx, unsigned char *out, unsigned int len)
{
PK11Context *ctx = *pctx;
unsigned int outlen;
PK11_DigestFinal(ctx, out, &outlen, len);
PK11_DestroyContext(ctx, PR_TRUE);
}
static int MD5_Init(MD5_CTX *pctx)
{
return nss_hash_init(pctx, SEC_OID_MD5);
}
static void MD5_Update(MD5_CTX *pctx,
const unsigned char *input,
unsigned int input_len)
{
PK11_DigestOp(*pctx, input, input_len);
}
static void MD5_Final(unsigned char digest[16], MD5_CTX *pctx)
{
nss_hash_final(pctx, digest, 16);
}
static int SHA1_Init(SHA_CTX *pctx)
{
return nss_hash_init(pctx, SEC_OID_SHA1);
}
static void SHA1_Update(SHA_CTX *pctx,
const unsigned char *input,
unsigned int input_len)
{
PK11_DigestOp(*pctx, input, input_len);
}
static void SHA1_Final(unsigned char digest[20], SHA_CTX *pctx)
{
nss_hash_final(pctx, digest, 20);
}
static int SHA256_Init(SHA256_CTX *pctx)
{
return nss_hash_init(pctx, SEC_OID_SHA256);
}
static void SHA256_Update(SHA256_CTX *pctx,
const unsigned char *input,
unsigned int input_len)
{
PK11_DigestOp(*pctx, input, input_len);
}
static void SHA256_Final(unsigned char digest[32], SHA256_CTX *pctx)
{
nss_hash_final(pctx, digest, 32);
}
#elif defined(USE_POLARSSL)
static int MD5_Init(MD5_CTX *ctx)
{
md5_starts(ctx);
return 1;
}
static void MD5_Update(MD5_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
md5_update(ctx, input, inputLen);
}
static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
{
md5_finish(ctx, digest);
}
static int SHA1_Init(SHA_CTX *ctx)
{
sha1_starts(ctx);
return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
sha1_update(ctx, input, inputLen);
}
static void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)
{
sha1_finish(ctx, digest);
}
static int SHA256_Init(SHA256_CTX *ctx)
{
sha256_starts(ctx, 0); /* 0 = sha256 */
return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
sha256_update(ctx, input, inputLen);
}
static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
{
sha256_finish(ctx, digest);
}
#elif defined(_WIN32) && !defined(USE_OPENSSL)
static void win32_crypto_final(struct win32_crypto_hash *ctx,
unsigned char *digest,
unsigned int digestLen)
{
unsigned long length;
CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0);
if(length == digestLen)
CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0);
if(ctx->hHash)
CryptDestroyHash(ctx->hHash);
if(ctx->hCryptProv)
CryptReleaseContext(ctx->hCryptProv, 0);
}
static int MD5_Init(MD5_CTX *ctx)
{
if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_MD5, 0, 0, &ctx->hHash);
}
return 1;
}
static void MD5_Update(MD5_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);
}
static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx)
{
win32_crypto_final(ctx, digest, 16);
}
static int SHA1_Init(SHA_CTX *ctx)
{
if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_SHA1, 0, 0, &ctx->hHash);
}
return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);
}
static void SHA1_Final(unsigned char digest[20], SHA_CTX *ctx)
{
win32_crypto_final(ctx, digest, 20);
}
static int SHA256_Init(SHA256_CTX *ctx)
{
if(CryptAcquireContext(&ctx->hCryptProv, NULL, NULL,
PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash);
}
return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
const unsigned char *input,
unsigned int inputLen)
{
CryptHashData(ctx->hHash, (unsigned char *)input, inputLen, 0);
}
static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
{
win32_crypto_final(ctx, digest, 32);
}
#endif /* CRYPTO LIBS */
const digest_params MD5_DIGEST_PARAMS[] = {
{
(Curl_digest_init_func) MD5_Init,
(Curl_digest_update_func) MD5_Update,
(Curl_digest_final_func) MD5_Final,
sizeof(MD5_CTX),
16
}
};
const digest_params SHA1_DIGEST_PARAMS[] = {
{
(Curl_digest_init_func) SHA1_Init,
(Curl_digest_update_func) SHA1_Update,
(Curl_digest_final_func) SHA1_Final,
sizeof(SHA_CTX),
20
}
};
const digest_params SHA256_DIGEST_PARAMS[] = {
{
(Curl_digest_init_func) SHA256_Init,
(Curl_digest_update_func) SHA256_Update,
(Curl_digest_final_func) SHA256_Final,
sizeof(SHA256_CTX),
32
}
};
static const metalink_digest_def SHA256_DIGEST_DEF[] = {
{"sha-256", SHA256_DIGEST_PARAMS}
};
static const metalink_digest_def SHA1_DIGEST_DEF[] = {
{"sha-1", SHA1_DIGEST_PARAMS}
};
static const metalink_digest_def MD5_DIGEST_DEF[] = {
{"md5", MD5_DIGEST_PARAMS}
};
/*
* The alias of supported hash functions in the order by preference
* (basically stronger hash comes first). We included "sha-256" and
* "sha256". The former is the name defined in the IANA registry named
* "Hash Function Textual Names". The latter is widely (and
* historically) used in Metalink version 3.
*/
static const metalink_digest_alias digest_aliases[] = {
{"sha-256", SHA256_DIGEST_DEF},
{"sha256", SHA256_DIGEST_DEF},
{"sha-1", SHA1_DIGEST_DEF},
{"sha1", SHA1_DIGEST_DEF},
{"md5", MD5_DIGEST_DEF},
{NULL, NULL}
};
digest_context *Curl_digest_init(const digest_params *dparams)
{
digest_context *ctxt;
/* Create digest context */
ctxt = malloc(sizeof *ctxt);
if(!ctxt)
return ctxt;
ctxt->digest_hashctx = malloc(dparams->digest_ctxtsize);
if(!ctxt->digest_hashctx) {
free(ctxt);
return NULL;
}
ctxt->digest_hash = dparams;
if(dparams->digest_init(ctxt->digest_hashctx) != 1) {
free(ctxt);
return NULL;
}
return ctxt;
}
int Curl_digest_update(digest_context *context,
const unsigned char *data,
unsigned int len)
{
(*context->digest_hash->digest_update)(context->digest_hashctx, data, len);
return 0;
}
int Curl_digest_final(digest_context *context, unsigned char *result)
{
(*context->digest_hash->digest_final)(result, context->digest_hashctx);
free(context->digest_hashctx);
free(context);
return 0;
}
static unsigned char hex_to_uint(const char *s)
{
char buf[3];
unsigned long val;
buf[0] = s[0];
buf[1] = s[1];
buf[2] = 0;
val = strtoul(buf, NULL, 16);
return (unsigned char)(val&0xff);
}
/*
* Check checksum of file denoted by filename. The expected hash value
* is given in hex_hash which is hex-encoded string.
*
* This function returns 1 if it succeeds or one of the following
* integers:
*
* 0:
* Checksum didn't match.
* -1:
* Could not open file; or could not read data from file.
* -2:
* Hash algorithm not available.
*/
static int check_hash(const char *filename,
const metalink_digest_def *digest_def,
const unsigned char *digest, FILE *error)
{
unsigned char *result;
digest_context *dctx;
int check_ok, flags, fd;
flags = O_RDONLY;
#ifdef O_BINARY
/* O_BINARY is required in order to avoid binary EOF in text mode */
flags |= O_BINARY;
#endif
fd = open(filename, flags);
if(fd == -1) {
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
digest_def->hash_name, strerror(errno));
return -1;
}
dctx = Curl_digest_init(digest_def->dparams);
if(!dctx) {
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
digest_def->hash_name, "failed to initialize hash algorithm");
close(fd);
return -2;
}
result = malloc(digest_def->dparams->digest_resultlen);
if(!result) {
close(fd);
return -1;
}
while(1) {
unsigned char buf[4096];
ssize_t len = read(fd, buf, sizeof(buf));
if(len == 0) {
break;
}
else if(len == -1) {
fprintf(error, "Metalink: validating (%s) [%s] FAILED (%s)\n", filename,
digest_def->hash_name, strerror(errno));
Curl_digest_final(dctx, result);
close(fd);
return -1;
}
Curl_digest_update(dctx, buf, (unsigned int)len);
}
Curl_digest_final(dctx, result);
check_ok = memcmp(result, digest,
digest_def->dparams->digest_resultlen) == 0;
/* sha*sum style verdict output */
if(check_ok)
fprintf(error, "Metalink: validating (%s) [%s] OK\n", filename,
digest_def->hash_name);
else
fprintf(error, "Metalink: validating (%s) [%s] FAILED (digest mismatch)\n",
filename, digest_def->hash_name);
free(result);
close(fd);
return check_ok;
}
int metalink_check_hash(struct GlobalConfig *config,
metalinkfile *mlfile,
const char *filename)
{
int rv;
fprintf(config->errors, "Metalink: validating (%s)...\n", filename);
if(mlfile->checksum == NULL) {
fprintf(config->errors,
"Metalink: validating (%s) FAILED (digest missing)\n", filename);
return -2;
}
rv = check_hash(filename, mlfile->checksum->digest_def,
mlfile->checksum->digest, config->errors);
return rv;
}
static metalink_checksum *new_metalink_checksum_from_hex_digest
(const metalink_digest_def *digest_def, const char *hex_digest)
{
metalink_checksum *chksum;
unsigned char *digest;
size_t i;
size_t len = strlen(hex_digest);
digest = malloc(len/2);
if(!digest)
return 0;
for(i = 0; i < len; i += 2) {
digest[i/2] = hex_to_uint(hex_digest+i);
}
chksum = malloc(sizeof(metalink_checksum));
if(chksum) {
chksum->digest_def = digest_def;
chksum->digest = digest;
}
return chksum;
}
static metalink_resource *new_metalink_resource(const char *url)
{
metalink_resource *res;
res = malloc(sizeof(metalink_resource));
if(res) {
res->next = NULL;
res->url = strdup(url);
if(!res->url) {
free(res);
return NULL;
}
}
return res;
}
/* Returns nonzero if hex_digest is properly formatted; that is each
letter is in [0-9A-Za-z] and the length of the string equals to the
result length of digest * 2. */
static int check_hex_digest(const char *hex_digest,
const metalink_digest_def *digest_def)
{
size_t i;
for(i = 0; hex_digest[i]; ++i) {
char c = hex_digest[i];
if(!(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') ||
('A' <= c && c <= 'Z'))) {
return 0;
}
}
return digest_def->dparams->digest_resultlen * 2 == i;
}
static metalinkfile *new_metalinkfile(metalink_file_t *fileinfo)
{
metalinkfile *f;
f = (metalinkfile*)malloc(sizeof(metalinkfile));
if(!f)
return NULL;
f->next = NULL;
f->filename = strdup(fileinfo->name);
if(!f->filename) {
free(f);
return NULL;
}
f->checksum = NULL;
f->resource = NULL;
if(fileinfo->checksums) {
const metalink_digest_alias *digest_alias;
for(digest_alias = digest_aliases; digest_alias->alias_name;
++digest_alias) {
metalink_checksum_t **p;
for(p = fileinfo->checksums; *p; ++p) {
if(curl_strequal(digest_alias->alias_name, (*p)->type) &&
check_hex_digest((*p)->hash, digest_alias->digest_def)) {
f->checksum =
new_metalink_checksum_from_hex_digest(digest_alias->digest_def,
(*p)->hash);
break;
}
}
if(f->checksum) {
break;
}
}
}
if(fileinfo->resources) {
metalink_resource_t **p;
metalink_resource root, *tail;
root.next = NULL;
tail = &root;
for(p = fileinfo->resources; *p; ++p) {
metalink_resource *res;
/* Filter by type if it is non-NULL. In Metalink v3, type
includes the type of the resource. In curl, we are only
interested in HTTP, HTTPS and FTP. In addition to them,
Metalink v3 file may contain bittorrent type URL, which
points to the BitTorrent metainfo file. We ignore it here.
In Metalink v4, type was deprecated and all
fileinfo->resources point to the target file. BitTorrent
metainfo file URL may be appeared in fileinfo->metaurls.
*/
if((*p)->type == NULL ||
curl_strequal((*p)->type, "http") ||
curl_strequal((*p)->type, "https") ||
curl_strequal((*p)->type, "ftp") ||
curl_strequal((*p)->type, "ftps")) {
res = new_metalink_resource((*p)->url);
tail->next = res;
tail = res;
}
}
f->resource = root.next;
}
return f;
}
int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
const char *metalink_url)
{
metalink_error_t r;
metalink_t* metalink;
metalink_file_t **files;
bool warnings = FALSE;
/* metlaink_parse_final deletes outs->metalink_parser */
r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink);
outs->metalink_parser = NULL;
if(r != 0) {
return -1;
}
if(metalink->files == NULL) {
fprintf(config->global->errors, "Metalink: parsing (%s) WARNING "
"(missing or invalid file name)\n",
metalink_url);
metalink_delete(metalink);
return -1;
}
for(files = metalink->files; *files; ++files) {
struct getout *url;
/* Skip an entry which has no resource. */
if(!(*files)->resources) {
fprintf(config->global->errors, "Metalink: parsing (%s) WARNING "
"(missing or invalid resource)\n",
metalink_url, (*files)->name);
continue;
}
if(config->url_get ||
((config->url_get = config->url_list) != NULL)) {
/* there's a node here, if it already is filled-in continue to
find an "empty" node */
while(config->url_get && (config->url_get->flags & GETOUT_URL))
config->url_get = config->url_get->next;
}
/* now there might or might not be an available node to fill in! */
if(config->url_get)
/* existing node */
url = config->url_get;
else
/* there was no free node, create one! */
url = new_getout(config);
if(url) {
metalinkfile *mlfile = new_metalinkfile(*files);
if(!mlfile)
break;
if(!mlfile->checksum) {
warnings = TRUE;
fprintf(config->global->errors,
"Metalink: parsing (%s) WARNING (digest missing)\n",
metalink_url);
}
/* Set name as url */
GetStr(&url->url, mlfile->filename);
/* set flag metalink here */
url->flags |= GETOUT_URL | GETOUT_METALINK;
if(config->metalinkfile_list) {
config->metalinkfile_last->next = mlfile;
config->metalinkfile_last = mlfile;
}
else {
config->metalinkfile_list = config->metalinkfile_last = mlfile;
}
}
}
metalink_delete(metalink);
return (warnings) ? -2 : 0;
}
size_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,
void *userdata)
{
struct OutStruct *outs = userdata;
struct OperationConfig *config = outs->config;
int rv;
/*
* Once that libcurl has called back tool_write_cb() the returned value
* is checked against the amount that was intended to be written, if
* it does not match then it fails with CURLE_WRITE_ERROR. So at this
* point returning a value different from sz*nmemb indicates failure.
*/
const size_t failure = (sz * nmemb) ? 0 : 1;
if(!config)
return failure;
rv = metalink_parse_update(outs->metalink_parser, buffer, sz *nmemb);
if(rv == 0)
return sz * nmemb;
else {
fprintf(config->global->errors, "Metalink: parsing FAILED\n");
return failure;
}
}
/*
* Returns nonzero if content_type includes mediatype.
*/
static int check_content_type(const char *content_type, const char *media_type)
{
const char *ptr = content_type;
size_t media_type_len = strlen(media_type);
for(; *ptr && (*ptr == ' ' || *ptr == '\t'); ++ptr);
if(!*ptr) {
return 0;
}
return curl_strnequal(ptr, media_type, media_type_len) &&
(*(ptr+media_type_len) == '\0' || *(ptr+media_type_len) == ' ' ||
*(ptr+media_type_len) == '\t' || *(ptr+media_type_len) == ';');
}
int check_metalink_content_type(const char *content_type)
{
return check_content_type(content_type, "application/metalink+xml");
}
int count_next_metalink_resource(metalinkfile *mlfile)
{
int count = 0;
metalink_resource *res;
for(res = mlfile->resource; res; res = res->next, ++count);
return count;
}
static void delete_metalink_checksum(metalink_checksum *chksum)
{
if(chksum == NULL) {
return;
}
Curl_safefree(chksum->digest);
Curl_safefree(chksum);
}
static void delete_metalink_resource(metalink_resource *res)
{
if(res == NULL) {
return;
}
Curl_safefree(res->url);
Curl_safefree(res);
}
static void delete_metalinkfile(metalinkfile *mlfile)
{
metalink_resource *res;
if(mlfile == NULL) {
return;
}
Curl_safefree(mlfile->filename);
delete_metalink_checksum(mlfile->checksum);
for(res = mlfile->resource; res;) {
metalink_resource *next;
next = res->next;
delete_metalink_resource(res);
res = next;
}
Curl_safefree(mlfile);
}
void clean_metalink(struct OperationConfig *config)
{
while(config->metalinkfile_list) {
metalinkfile *mlfile = config->metalinkfile_list;
config->metalinkfile_list = config->metalinkfile_list->next;
delete_metalinkfile(mlfile);
}
config->metalinkfile_last = 0;
}
void metalink_cleanup(void)
{
#ifdef USE_NSS
if(nss_context) {
NSS_ShutdownContext(nss_context);
nss_context = NULL;
}
#endif
}
#endif /* USE_METALINK */

View File

@@ -0,0 +1,167 @@
#ifndef HEADER_CURL_TOOL_METALINK_H
#define HEADER_CURL_TOOL_METALINK_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
struct GlobalConfig;
struct OperationConfig;
/* returns 1 for success, 0 otherwise (we use OpenSSL *_Init fncs directly) */
typedef int (* Curl_digest_init_func)(void *context);
typedef void (* Curl_digest_update_func)(void *context,
const unsigned char *data,
unsigned int len);
typedef void (* Curl_digest_final_func)(unsigned char *result, void *context);
typedef struct {
Curl_digest_init_func digest_init; /* Initialize context procedure */
Curl_digest_update_func digest_update; /* Update context with data */
Curl_digest_final_func digest_final; /* Get final result procedure */
unsigned int digest_ctxtsize; /* Context structure size */
unsigned int digest_resultlen; /* Result length (bytes) */
} digest_params;
typedef struct {
const digest_params *digest_hash; /* Hash function definition */
void *digest_hashctx; /* Hash function context */
} digest_context;
digest_context * Curl_digest_init(const digest_params *dparams);
int Curl_digest_update(digest_context *context,
const unsigned char *data,
unsigned int len);
int Curl_digest_final(digest_context *context, unsigned char *result);
typedef struct {
const char *hash_name;
const digest_params *dparams;
} metalink_digest_def;
typedef struct {
const char *alias_name;
const metalink_digest_def *digest_def;
} metalink_digest_alias;
typedef struct metalink_checksum {
const metalink_digest_def *digest_def;
/* raw digest value, not ascii hex digest */
unsigned char *digest;
} metalink_checksum;
typedef struct metalink_resource {
struct metalink_resource *next;
char *url;
} metalink_resource;
typedef struct metalinkfile {
struct metalinkfile *next;
char *filename;
metalink_checksum *checksum;
metalink_resource *resource;
} metalinkfile;
#ifdef USE_METALINK
/*
* curl requires libmetalink 0.1.0 or newer
*/
#define CURL_REQ_LIBMETALINK_MAJOR 0
#define CURL_REQ_LIBMETALINK_MINOR 1
#define CURL_REQ_LIBMETALINK_PATCH 0
#define CURL_REQ_LIBMETALINK_VERS ((CURL_REQ_LIBMETALINK_MAJOR * 10000) + \
(CURL_REQ_LIBMETALINK_MINOR * 100) + \
CURL_REQ_LIBMETALINK_PATCH)
extern const digest_params MD5_DIGEST_PARAMS[1];
extern const digest_params SHA1_DIGEST_PARAMS[1];
extern const digest_params SHA256_DIGEST_PARAMS[1];
#include <metalink/metalink.h>
/*
* Counts the resource in the metalinkfile.
*/
int count_next_metalink_resource(metalinkfile *mlfile);
void clean_metalink(struct OperationConfig *config);
/*
* Performs final parse operation and extracts information from
* Metalink and creates metalinkfile structs.
*
* This function returns 0 if it succeeds without warnings, or one of
* the following negative error codes:
*
* -1: Parsing failed; or no file is found
* -2: Parsing succeeded with some warnings.
*/
int parse_metalink(struct OperationConfig *config, struct OutStruct *outs,
const char *metalink_url);
/*
* Callback function for CURLOPT_WRITEFUNCTION
*/
size_t metalink_write_cb(void *buffer, size_t sz, size_t nmemb,
void *userdata);
/*
* Returns nonzero if content_type includes "application/metalink+xml"
* media-type. The check is done in case-insensitive manner.
*/
int check_metalink_content_type(const char *content_type);
/*
* Check checksum of file denoted by filename.
*
* This function returns 1 if the checksum matches or one of the
* following integers:
*
* 0:
* Checksum didn't match.
* -1:
* Could not open file; or could not read data from file.
* -2:
* No checksum in Metalink supported, hash algorithm not available, or
* Metalink does not contain checksum.
*/
int metalink_check_hash(struct GlobalConfig *config,
metalinkfile *mlfile,
const char *filename);
/*
* Release resources allocated at global scope.
*/
void metalink_cleanup(void);
#else /* USE_METALINK */
#define count_next_metalink_resource(x) 0
#define clean_metalink(x) (void)x
/* metalink_cleanup() takes no arguments */
#define metalink_cleanup() Curl_nop_stmt
#endif /* USE_METALINK */
#endif /* HEADER_CURL_TOOL_METALINK_H */

127
3rd-party/curl-7.52.1/src/tool_mfiles.c vendored Normal file
View File

@@ -0,0 +1,127 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_mfiles.h"
#include "memdebug.h" /* keep this as LAST include */
static void AppendNode(struct multi_files **first,
struct multi_files **last,
struct multi_files *new)
{
DEBUGASSERT(((*first) && (*last)) || ((!*first) && (!*last)));
if(*last)
(*last)->next = new;
else
*first = new;
*last = new;
}
/*
* AddMultiFiles: Add a new list node possibly followed with a type_name.
*
* multi_first argument is the address of a pointer to the first element
* of the multi_files linked list. A NULL pointer indicates empty list.
*
* multi_last argument is the address of a pointer to the last element
* of the multi_files linked list. A NULL pointer indicates empty list.
*
* Pointers stored in multi_first and multi_last are modified while
* function is executed. An out of memory condition free's the whole
* list and returns with pointers stored in multi_first and multi_last
* set to NULL and a NULL function result.
*
* Function returns same pointer as stored at multi_last.
*/
struct multi_files *AddMultiFiles(const char *file_name,
const char *type_name,
const char *show_filename,
struct multi_files **multi_first,
struct multi_files **multi_last)
{
struct multi_files *multi;
struct multi_files *multi_type;
struct multi_files *multi_name;
multi = calloc(1, sizeof(struct multi_files));
if(multi) {
multi->form.option = CURLFORM_FILE;
multi->form.value = file_name;
AppendNode(multi_first, multi_last, multi);
}
else {
FreeMultiInfo(multi_first, multi_last);
return NULL;
}
if(type_name) {
multi_type = calloc(1, sizeof(struct multi_files));
if(multi_type) {
multi_type->form.option = CURLFORM_CONTENTTYPE;
multi_type->form.value = type_name;
AppendNode(multi_first, multi_last, multi_type);
}
else {
FreeMultiInfo(multi_first, multi_last);
return NULL;
}
}
if(show_filename) {
multi_name = calloc(1, sizeof(struct multi_files));
if(multi_name) {
multi_name->form.option = CURLFORM_FILENAME;
multi_name->form.value = show_filename;
AppendNode(multi_first, multi_last, multi_name);
}
else {
FreeMultiInfo(multi_first, multi_last);
return NULL;
}
}
return *multi_last;
}
/*
* FreeMultiInfo: Free the items of the list.
*/
void FreeMultiInfo(struct multi_files **multi_first,
struct multi_files **multi_last)
{
struct multi_files *next;
struct multi_files *item = *multi_first;
while(item) {
next = item->next;
Curl_safefree(item);
item = next;
}
*multi_first = NULL;
if(multi_last)
*multi_last = NULL;
}

46
3rd-party/curl-7.52.1/src/tool_mfiles.h vendored Normal file
View File

@@ -0,0 +1,46 @@
#ifndef HEADER_CURL_TOOL_MFILES_H
#define HEADER_CURL_TOOL_MFILES_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
* Structure for storing the information needed to build
* a multiple files section.
*/
struct multi_files {
struct curl_forms form;
struct multi_files *next;
};
struct multi_files *AddMultiFiles(const char *file_name,
const char *type_name,
const char *show_filename,
struct multi_files **multi_first,
struct multi_files **multi_last);
void FreeMultiInfo(struct multi_files **multi_first,
struct multi_files **multi_last);
#endif /* HEADER_CURL_TOOL_MFILES_H */

121
3rd-party/curl-7.52.1/src/tool_msgs.c vendored Normal file
View File

@@ -0,0 +1,121 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "memdebug.h" /* keep this as LAST include */
#define WARN_PREFIX "Warning: "
#define NOTE_PREFIX "Note: "
static void voutf(struct GlobalConfig *config,
const char *prefix,
const char *fmt,
va_list ap)
{
size_t width = (79 - (int)strlen(prefix));
if(!config->mute) {
size_t len;
char *ptr;
char print_buffer[256];
len = vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap);
ptr = print_buffer;
while(len > 0) {
fputs(prefix, config->errors);
if(len > width) {
size_t cut = width-1;
while(!ISSPACE(ptr[cut]) && cut) {
cut--;
}
if(0 == cut)
/* not a single cutting position was found, just cut it at the
max text width then! */
cut = width-1;
(void)fwrite(ptr, cut + 1, 1, config->errors);
fputs("\n", config->errors);
ptr += cut+1; /* skip the space too */
len -= cut;
}
else {
fputs(ptr, config->errors);
len = 0;
}
}
}
}
/*
* Emit 'note' formatted message on configured 'errors' stream, if verbose was
* selected.
*/
void notef(struct GlobalConfig *config, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if(config->tracetype)
voutf(config, NOTE_PREFIX, fmt, ap);
va_end(ap);
}
/*
* Emit warning formatted message on configured 'errors' stream unless
* mute (--silent) was selected.
*/
void warnf(struct GlobalConfig *config, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
voutf(config, WARN_PREFIX, fmt, ap);
va_end(ap);
}
/*
* Emit help formatted message on given stream.
*/
void helpf(FILE *errors, const char *fmt, ...)
{
va_list ap;
if(fmt) {
va_start(ap, fmt);
fputs("curl: ", errors); /* prefix it */
vfprintf(errors, fmt, ap);
va_end(ap);
}
fprintf(errors, "curl: try 'curl --help' "
#ifdef USE_MANUAL
"or 'curl --manual' "
#endif
"for more information\n");
}

32
3rd-party/curl-7.52.1/src/tool_msgs.h vendored Normal file
View File

@@ -0,0 +1,32 @@
#ifndef HEADER_CURL_TOOL_MSGS_H
#define HEADER_CURL_TOOL_MSGS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
void warnf(struct GlobalConfig *config, const char *fmt, ...);
void notef(struct GlobalConfig *config, const char *fmt, ...);
void helpf(FILE *errors, const char *fmt, ...);
#endif /* HEADER_CURL_TOOL_MSGS_H */

1979
3rd-party/curl-7.52.1/src/tool_operate.c vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
#ifndef HEADER_CURL_TOOL_OPERATE_H
#define HEADER_CURL_TOOL_OPERATE_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[]);
#endif /* HEADER_CURL_TOOL_OPERATE_H */

190
3rd-party/curl-7.52.1/src/tool_operhlp.c vendored Normal file
View File

@@ -0,0 +1,190 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_convert.h"
#include "tool_doswin.h"
#include "tool_operhlp.h"
#include "tool_metalink.h"
#include "memdebug.h" /* keep this as LAST include */
void clean_getout(struct OperationConfig *config)
{
struct getout *next;
struct getout *node = config->url_list;
while(node) {
next = node->next;
Curl_safefree(node->url);
Curl_safefree(node->outfile);
Curl_safefree(node->infile);
Curl_safefree(node);
node = next;
}
config->url_list = NULL;
}
bool output_expected(const char *url, const char *uploadfile)
{
if(!uploadfile)
return TRUE; /* download */
if(checkprefix("http://", url) || checkprefix("https://", url))
return TRUE; /* HTTP(S) upload */
return FALSE; /* non-HTTP upload, probably no output should be expected */
}
bool stdin_upload(const char *uploadfile)
{
return (!strcmp(uploadfile, "-") ||
!strcmp(uploadfile, ".")) ? TRUE : FALSE;
}
/*
* Adds the file name to the URL if it doesn't already have one.
* url will be freed before return if the returned pointer is different
*/
char *add_file_name_to_url(CURL *curl, char *url, const char *filename)
{
/* If no file name part is given in the URL, we add this file name */
char *ptr = strstr(url, "://");
if(ptr)
ptr += 3;
else
ptr = url;
ptr = strrchr(ptr, '/');
if(!ptr || !strlen(++ptr)) {
/* The URL has no file name part, add the local file name. In order
to be able to do so, we have to create a new URL in another
buffer.*/
/* We only want the part of the local path that is on the right
side of the rightmost slash and backslash. */
const char *filep = strrchr(filename, '/');
char *file2 = strrchr(filep?filep:filename, '\\');
char *encfile;
if(file2)
filep = file2 + 1;
else if(filep)
filep++;
else
filep = filename;
/* URL encode the file name */
encfile = curl_easy_escape(curl, filep, 0 /* use strlen */);
if(encfile) {
char *urlbuffer;
if(ptr)
/* there is a trailing slash on the URL */
urlbuffer = aprintf("%s%s", url, encfile);
else
/* there is no trailing slash on the URL */
urlbuffer = aprintf("%s/%s", url, encfile);
curl_free(encfile);
Curl_safefree(url);
if(!urlbuffer)
return NULL;
url = urlbuffer; /* use our new URL instead! */
}
else
Curl_safefree(url);
}
return url;
}
/* Extracts the name portion of the URL.
* Returns a pointer to a heap-allocated string or NULL if
* no name part, at location indicated by first argument.
*/
CURLcode get_url_file_name(char **filename, const char *url)
{
const char *pc, *pc2;
*filename = NULL;
/* Find and get the remote file name */
pc = strstr(url, "://");
if(pc)
pc += 3;
else
pc = url;
pc2 = strrchr(pc, '\\');
pc = strrchr(pc, '/');
if(pc2 && (!pc || pc < pc2))
pc = pc2;
if(pc)
/* duplicate the string beyond the slash */
pc++;
else
/* no slash => empty string */
pc = "";
*filename = strdup(pc);
if(!*filename)
return CURLE_OUT_OF_MEMORY;
#if defined(MSDOS) || defined(WIN32)
{
char *sanitized;
SANITIZEcode sc = sanitize_file_name(&sanitized, *filename, 0);
Curl_safefree(*filename);
if(sc)
return CURLE_URL_MALFORMAT;
*filename = sanitized;
}
#endif /* MSDOS || WIN32 */
/* in case we built debug enabled, we allow an environment variable
* named CURL_TESTDIR to prefix the given file name to put it into a
* specific directory
*/
#ifdef DEBUGBUILD
{
char *tdir = curlx_getenv("CURL_TESTDIR");
if(tdir) {
char buffer[512]; /* suitably large */
snprintf(buffer, sizeof(buffer), "%s/%s", tdir, *filename);
Curl_safefree(*filename);
*filename = strdup(buffer); /* clone the buffer */
curl_free(tdir);
if(!*filename)
return CURLE_OUT_OF_MEMORY;
}
}
#endif
return CURLE_OK;
}

View File

@@ -0,0 +1,39 @@
#ifndef HEADER_CURL_TOOL_OPERHLP_H
#define HEADER_CURL_TOOL_OPERHLP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
struct OperationConfig;
void clean_getout(struct OperationConfig *config);
bool output_expected(const char *url, const char *uploadfile);
bool stdin_upload(const char *uploadfile);
char *add_file_name_to_url(CURL *curl, char *url, const char *filename);
CURLcode get_url_file_name(char **filename, const char *url);
#endif /* HEADER_CURL_TOOL_OPERHLP_H */

View File

@@ -0,0 +1,48 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#if defined(__SYMBIAN32__) || defined(NETWARE)
#ifdef NETWARE
# ifdef __NOVELL_LIBC__
# include <screen.h>
# else
# include <nwconio.h>
# endif
#endif
#include "tool_panykey.h"
#include "memdebug.h" /* keep this as LAST include */
void tool_pressanykey(void)
{
#if defined(__SYMBIAN32__)
getchar();
#elif defined(NETWARE)
pressanykey();
#endif
}
#endif /* __SYMBIAN32__ || NETWARE */

View File

@@ -0,0 +1,37 @@
#ifndef HEADER_CURL_TOOL_PANYKEY_H
#define HEADER_CURL_TOOL_PANYKEY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#if defined(__SYMBIAN32__) || defined(NETWARE)
void tool_pressanykey(void);
#else
#define tool_pressanykey() Curl_nop_stmt
#endif
#endif /* HEADER_CURL_TOOL_PANYKEY_H */

View File

@@ -0,0 +1,552 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_getparam.h"
#include "tool_getpass.h"
#include "tool_homedir.h"
#include "tool_msgs.h"
#include "tool_paramhlp.h"
#include "tool_version.h"
#include "memdebug.h" /* keep this as LAST include */
struct getout *new_getout(struct OperationConfig *config)
{
struct getout *node = calloc(1, sizeof(struct getout));
struct getout *last = config->url_last;
if(node) {
/* append this new node last in the list */
if(last)
last->next = node;
else
config->url_list = node; /* first node */
/* move the last pointer */
config->url_last = node;
node->flags = config->default_node_flags;
}
return node;
}
ParameterError file2string(char **bufp, FILE *file)
{
char buffer[256];
char *ptr;
char *string = NULL;
size_t stringlen = 0;
size_t buflen;
if(file) {
while(fgets(buffer, sizeof(buffer), file)) {
ptr = strchr(buffer, '\r');
if(ptr)
*ptr = '\0';
ptr = strchr(buffer, '\n');
if(ptr)
*ptr = '\0';
buflen = strlen(buffer);
ptr = realloc(string, stringlen+buflen+1);
if(!ptr) {
Curl_safefree(string);
return PARAM_NO_MEM;
}
string = ptr;
strcpy(string+stringlen, buffer);
stringlen += buflen;
}
}
*bufp = string;
return PARAM_OK;
}
ParameterError file2memory(char **bufp, size_t *size, FILE *file)
{
char *newbuf;
char *buffer = NULL;
size_t alloc = 512;
size_t nused = 0;
size_t nread;
if(file) {
do {
if(!buffer || (alloc == nused)) {
/* size_t overflow detection for huge files */
if(alloc+1 > ((size_t)-1)/2) {
Curl_safefree(buffer);
return PARAM_NO_MEM;
}
alloc *= 2;
/* allocate an extra char, reserved space, for null termination */
newbuf = realloc(buffer, alloc+1);
if(!newbuf) {
Curl_safefree(buffer);
return PARAM_NO_MEM;
}
buffer = newbuf;
}
nread = fread(buffer+nused, 1, alloc-nused, file);
nused += nread;
} while(nread);
/* null terminate the buffer in case it's used as a string later */
buffer[nused] = '\0';
/* free trailing slack space, if possible */
if(alloc != nused) {
newbuf = realloc(buffer, nused+1);
if(!newbuf) {
Curl_safefree(buffer);
return PARAM_NO_MEM;
}
buffer = newbuf;
}
/* discard buffer if nothing was read */
if(!nused) {
Curl_safefree(buffer); /* no string */
}
}
*size = nused;
*bufp = buffer;
return PARAM_OK;
}
void cleanarg(char *str)
{
#ifdef HAVE_WRITABLE_ARGV
/* now that GetStr has copied the contents of nextarg, wipe the next
* argument out so that the username:password isn't displayed in the
* system process list */
if(str) {
size_t len = strlen(str);
memset(str, ' ', len);
}
#else
(void)str;
#endif
}
/*
* Parse the string and write the long in the given address. Return PARAM_OK
* on success, otherwise a parameter specific error enum.
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
ParameterError str2num(long *val, const char *str)
{
if(str) {
char *endptr;
long num = strtol(str, &endptr, 10);
if((endptr != str) && (endptr == str + strlen(str))) {
*val = num;
return PARAM_OK; /* Ok */
}
}
return PARAM_BAD_NUMERIC; /* badness */
}
/*
* Parse the string and write the long in the given address. Return PARAM_OK
* on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
ParameterError str2unum(long *val, const char *str)
{
ParameterError result = str2num(val, str);
if(result != PARAM_OK)
return result;
if(*val < 0)
return PARAM_NEGATIVE_NUMERIC;
return PARAM_OK;
}
/*
* Parse the string and write the double in the given address. Return PARAM_OK
* on success, otherwise a parameter specific error enum.
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
ParameterError str2double(double *val, const char *str)
{
if(str) {
char *endptr;
double num = strtod(str, &endptr);
if((endptr != str) && (endptr == str + strlen(str))) {
*val = num;
return PARAM_OK; /* Ok */
}
}
return PARAM_BAD_NUMERIC; /* badness */
}
/*
* Parse the string and write the double in the given address. Return PARAM_OK
* on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS!
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
ParameterError str2udouble(double *val, const char *str)
{
ParameterError result = str2double(val, str);
if(result != PARAM_OK)
return result;
if(*val < 0)
return PARAM_NEGATIVE_NUMERIC;
return PARAM_OK;
}
/*
* Parse the string and modify the long in the given address. Return
* non-zero on failure, zero on success.
*
* The string is a list of protocols
*
* Since this function gets called with the 'nextarg' pointer from within the
* getparameter a lot, we must check it for NULL before accessing the str
* data.
*/
long proto2num(struct OperationConfig *config, long *val, const char *str)
{
char *buffer;
const char *sep = ",";
char *token;
static struct sprotos {
const char *name;
long bit;
} const protos[] = {
{ "all", CURLPROTO_ALL },
{ "http", CURLPROTO_HTTP },
{ "https", CURLPROTO_HTTPS },
{ "ftp", CURLPROTO_FTP },
{ "ftps", CURLPROTO_FTPS },
{ "scp", CURLPROTO_SCP },
{ "sftp", CURLPROTO_SFTP },
{ "telnet", CURLPROTO_TELNET },
{ "ldap", CURLPROTO_LDAP },
{ "ldaps", CURLPROTO_LDAPS },
{ "dict", CURLPROTO_DICT },
{ "file", CURLPROTO_FILE },
{ "tftp", CURLPROTO_TFTP },
{ "imap", CURLPROTO_IMAP },
{ "imaps", CURLPROTO_IMAPS },
{ "pop3", CURLPROTO_POP3 },
{ "pop3s", CURLPROTO_POP3S },
{ "smtp", CURLPROTO_SMTP },
{ "smtps", CURLPROTO_SMTPS },
{ "rtsp", CURLPROTO_RTSP },
{ "gopher", CURLPROTO_GOPHER },
{ "smb", CURLPROTO_SMB },
{ "smbs", CURLPROTO_SMBS },
{ NULL, 0 }
};
if(!str)
return 1;
buffer = strdup(str); /* because strtok corrupts it */
if(!buffer)
return 1;
/* Allow strtok() here since this isn't used threaded */
/* !checksrc! disable BANNEDFUNC 2 */
for(token = strtok(buffer, sep);
token;
token = strtok(NULL, sep)) {
enum e_action { allow, deny, set } action = allow;
struct sprotos const *pp;
/* Process token modifiers */
while(!ISALNUM(*token)) { /* may be NULL if token is all modifiers */
switch (*token++) {
case '=':
action = set;
break;
case '-':
action = deny;
break;
case '+':
action = allow;
break;
default: /* Includes case of terminating NULL */
Curl_safefree(buffer);
return 1;
}
}
for(pp=protos; pp->name; pp++) {
if(curl_strequal(token, pp->name)) {
switch(action) {
case deny:
*val &= ~(pp->bit);
break;
case allow:
*val |= pp->bit;
break;
case set:
*val = pp->bit;
break;
}
break;
}
}
if(!(pp->name)) { /* unknown protocol */
/* If they have specified only this protocol, we say treat it as
if no protocols are allowed */
if(action == set)
*val = 0;
warnf(config->global, "unrecognized protocol '%s'\n", token);
}
}
Curl_safefree(buffer);
return 0;
}
/**
* Check if the given string is a protocol supported by libcurl
*
* @param str the protocol name
* @return PARAM_OK protocol supported
* @return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL protocol not supported
* @return PARAM_REQUIRES_PARAMETER missing parameter
*/
int check_protocol(const char *str)
{
const char * const *pp;
const curl_version_info_data *curlinfo = curl_version_info(CURLVERSION_NOW);
if(!str)
return PARAM_REQUIRES_PARAMETER;
for(pp = curlinfo->protocols; *pp; pp++) {
if(curl_strequal(*pp, str))
return PARAM_OK;
}
return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL;
}
/**
* Parses the given string looking for an offset (which may be a
* larger-than-integer value). The offset CANNOT be negative!
*
* @param val the offset to populate
* @param str the buffer containing the offset
* @return PARAM_OK if successful, a parameter specific error enum if failure.
*/
ParameterError str2offset(curl_off_t *val, const char *str)
{
char *endptr;
if(str[0] == '-')
/* offsets aren't negative, this indicates weird input */
return PARAM_NEGATIVE_NUMERIC;
#if(CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG)
*val = curlx_strtoofft(str, &endptr, 0);
if((*val == CURL_OFF_T_MAX || *val == CURL_OFF_T_MIN) && (ERRNO == ERANGE))
return PARAM_BAD_NUMERIC;
#else
*val = strtol(str, &endptr, 0);
if((*val == LONG_MIN || *val == LONG_MAX) && ERRNO == ERANGE)
return PARAM_BAD_NUMERIC;
#endif
if((endptr != str) && (endptr == str + strlen(str)))
return PARAM_OK;
return PARAM_BAD_NUMERIC;
}
static CURLcode checkpasswd(const char *kind, /* for what purpose */
const size_t i, /* operation index */
const bool last, /* TRUE if last operation */
char **userpwd) /* pointer to allocated string */
{
char *psep;
char *osep;
if(!*userpwd)
return CURLE_OK;
/* Attempt to find the password separator */
psep = strchr(*userpwd, ':');
/* Attempt to find the options separator */
osep = strchr(*userpwd, ';');
if(!psep && **userpwd != ';') {
/* no password present, prompt for one */
char passwd[256] = "";
char prompt[256];
size_t passwdlen;
size_t userlen = strlen(*userpwd);
char *passptr;
if(osep)
*osep = '\0';
/* build a nice-looking prompt */
if(!i && last)
curlx_msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s':",
kind, *userpwd);
else
curlx_msnprintf(prompt, sizeof(prompt),
"Enter %s password for user '%s' on URL #%"
CURL_FORMAT_CURL_OFF_TU ":",
kind, *userpwd, (curl_off_t) (i + 1));
/* get password */
getpass_r(prompt, passwd, sizeof(passwd));
passwdlen = strlen(passwd);
if(osep)
*osep = ';';
/* extend the allocated memory area to fit the password too */
passptr = realloc(*userpwd,
passwdlen + 1 + /* an extra for the colon */
userlen + 1); /* an extra for the zero */
if(!passptr)
return CURLE_OUT_OF_MEMORY;
/* append the password separated with a colon */
passptr[userlen] = ':';
memcpy(&passptr[userlen+1], passwd, passwdlen+1);
*userpwd = passptr;
}
return CURLE_OK;
}
ParameterError add2list(struct curl_slist **list, const char *ptr)
{
struct curl_slist *newlist = curl_slist_append(*list, ptr);
if(newlist)
*list = newlist;
else
return PARAM_NO_MEM;
return PARAM_OK;
}
int ftpfilemethod(struct OperationConfig *config, const char *str)
{
if(curl_strequal("singlecwd", str))
return CURLFTPMETHOD_SINGLECWD;
if(curl_strequal("nocwd", str))
return CURLFTPMETHOD_NOCWD;
if(curl_strequal("multicwd", str))
return CURLFTPMETHOD_MULTICWD;
warnf(config->global, "unrecognized ftp file method '%s', using default\n",
str);
return CURLFTPMETHOD_MULTICWD;
}
int ftpcccmethod(struct OperationConfig *config, const char *str)
{
if(curl_strequal("passive", str))
return CURLFTPSSL_CCC_PASSIVE;
if(curl_strequal("active", str))
return CURLFTPSSL_CCC_ACTIVE;
warnf(config->global, "unrecognized ftp CCC method '%s', using default\n",
str);
return CURLFTPSSL_CCC_PASSIVE;
}
long delegation(struct OperationConfig *config, char *str)
{
if(curl_strequal("none", str))
return CURLGSSAPI_DELEGATION_NONE;
if(curl_strequal("policy", str))
return CURLGSSAPI_DELEGATION_POLICY_FLAG;
if(curl_strequal("always", str))
return CURLGSSAPI_DELEGATION_FLAG;
warnf(config->global, "unrecognized delegation method '%s', using none\n",
str);
return CURLGSSAPI_DELEGATION_NONE;
}
/*
* my_useragent: returns allocated string with default user agent
*/
static char *my_useragent(void)
{
return strdup(CURL_NAME "/" CURL_VERSION);
}
CURLcode get_args(struct OperationConfig *config, const size_t i)
{
CURLcode result = CURLE_OK;
bool last = (config->next ? FALSE : TRUE);
/* Check we have a password for the given host user */
if(config->userpwd && !config->oauth_bearer) {
result = checkpasswd("host", i, last, &config->userpwd);
if(result)
return result;
}
/* Check we have a password for the given proxy user */
if(config->proxyuserpwd) {
result = checkpasswd("proxy", i, last, &config->proxyuserpwd);
if(result)
return result;
}
/* Check we have a user agent */
if(!config->useragent) {
config->useragent = my_useragent();
if(!config->useragent) {
helpf(config->global->errors, "out of memory\n");
result = CURLE_OUT_OF_MEMORY;
}
}
return result;
}

View File

@@ -0,0 +1,55 @@
#ifndef HEADER_CURL_TOOL_PARAMHLP_H
#define HEADER_CURL_TOOL_PARAMHLP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
struct getout *new_getout(struct OperationConfig *config);
ParameterError file2string(char **bufp, FILE *file);
ParameterError file2memory(char **bufp, size_t *size, FILE *file);
void cleanarg(char *str);
ParameterError str2num(long *val, const char *str);
ParameterError str2unum(long *val, const char *str);
ParameterError str2double(double *val, const char *str);
ParameterError str2udouble(double *val, const char *str);
long proto2num(struct OperationConfig *config, long *val, const char *str);
int check_protocol(const char *str);
ParameterError str2offset(curl_off_t *val, const char *str);
CURLcode get_args(struct OperationConfig *config, const size_t i);
ParameterError add2list(struct curl_slist **list, const char *ptr);
int ftpfilemethod(struct OperationConfig *config, const char *str);
int ftpcccmethod(struct OperationConfig *config, const char *str);
long delegation(struct OperationConfig *config, char *str);
#endif /* HEADER_CURL_TOOL_PARAMHLP_H */

View File

@@ -0,0 +1,361 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_getparam.h"
#include "tool_helpers.h"
#include "tool_homedir.h"
#include "tool_msgs.h"
#include "tool_parsecfg.h"
#include "memdebug.h" /* keep this as LAST include */
#define CURLRC DOT_CHAR "curlrc"
/* only acknowledge colon or equals as separators if the option was not
specified with an initial dash! */
#define ISSEP(x,dash) (!dash && (((x) == '=') || ((x) == ':')))
static const char *unslashquote(const char *line, char *param);
static char *my_get_line(FILE *fp);
/* return 0 on everything-is-fine, and non-zero otherwise */
int parseconfig(const char *filename, struct GlobalConfig *global)
{
int res;
FILE *file;
char filebuffer[512];
bool usedarg;
char *home;
int rc = 0;
struct OperationConfig *operation = global->first;
if(!filename || !*filename) {
/* NULL or no file name attempts to load .curlrc from the homedir! */
#ifndef __AMIGA__
filename = CURLRC; /* sensible default */
home = homedir(); /* portable homedir finder */
if(home) {
if(strlen(home) < (sizeof(filebuffer) - strlen(CURLRC))) {
snprintf(filebuffer, sizeof(filebuffer),
"%s%s%s", home, DIR_CHAR, CURLRC);
#ifdef WIN32
/* Check if the file exists - if not, try CURLRC in the same
* directory as our executable
*/
file = fopen(filebuffer, FOPEN_READTEXT);
if(file != NULL) {
fclose(file);
filename = filebuffer;
}
else {
/* Get the filename of our executable. GetModuleFileName is
* already declared via inclusions done in setup header file.
* We assume that we are using the ASCII version here.
*/
int n = GetModuleFileName(0, filebuffer, sizeof(filebuffer));
if(n > 0 && n < (int)sizeof(filebuffer)) {
/* We got a valid filename - get the directory part */
char *lastdirchar = strrchr(filebuffer, '\\');
if(lastdirchar) {
size_t remaining;
*lastdirchar = 0;
/* If we have enough space, build the RC filename */
remaining = sizeof(filebuffer) - strlen(filebuffer);
if(strlen(CURLRC) < remaining - 1) {
snprintf(lastdirchar, remaining,
"%s%s", DIR_CHAR, CURLRC);
/* Don't bother checking if it exists - we do
* that later
*/
filename = filebuffer;
}
}
}
}
#else /* WIN32 */
filename = filebuffer;
#endif /* WIN32 */
}
Curl_safefree(home); /* we've used it, now free it */
}
# else /* __AMIGA__ */
/* On AmigaOS all the config files are into env:
*/
filename = "ENV:" CURLRC;
#endif
}
if(strcmp(filename, "-"))
file = fopen(filename, FOPEN_READTEXT);
else
file = stdin;
if(file) {
char *line;
char *aline;
char *option;
char *param;
int lineno = 0;
bool alloced_param;
bool dashed_option;
while(NULL != (aline = my_get_line(file))) {
lineno++;
line = aline;
alloced_param=FALSE;
/* line with # in the first non-blank column is a comment! */
while(*line && ISSPACE(*line))
line++;
switch(*line) {
case '#':
case '/':
case '\r':
case '\n':
case '*':
case '\0':
Curl_safefree(aline);
continue;
}
/* the option keywords starts here */
option = line;
/* the option starts with a dash? */
dashed_option = option[0]=='-'?TRUE:FALSE;
while(*line && !ISSPACE(*line) && !ISSEP(*line, dashed_option))
line++;
/* ... and has ended here */
if(*line)
*line++ = '\0'; /* zero terminate, we have a local copy of the data */
#ifdef DEBUG_CONFIG
fprintf(stderr, "GOT: %s\n", option);
#endif
/* pass spaces and separator(s) */
while(*line && (ISSPACE(*line) || ISSEP(*line, dashed_option)))
line++;
/* the parameter starts here (unless quoted) */
if(*line == '\"') {
/* quoted parameter, do the quote dance */
line++;
param = malloc(strlen(line) + 1); /* parameter */
if(!param) {
/* out of memory */
Curl_safefree(aline);
rc = 1;
break;
}
alloced_param = TRUE;
(void)unslashquote(line, param);
}
else {
param = line; /* parameter starts here */
while(*line && !ISSPACE(*line))
line++;
if(*line) {
*line = '\0'; /* zero terminate */
/* to detect mistakes better, see if there's data following */
line++;
/* pass all spaces */
while(*line && ISSPACE(*line))
line++;
switch(*line) {
case '\0':
case '\r':
case '\n':
case '#': /* comment */
break;
default:
warnf(operation->global, "%s:%d: warning: '%s' uses unquoted "
"white space in the line that may cause side-effects!\n",
filename, lineno, option);
}
}
if(!*param)
/* do this so getparameter can check for required parameters.
Otherwise it always thinks there's a parameter. */
param = NULL;
}
#ifdef DEBUG_CONFIG
fprintf(stderr, "PARAM: \"%s\"\n",(param ? param : "(null)"));
#endif
res = getparameter(option, param, &usedarg, global, operation);
if(param && *param && !usedarg)
/* we passed in a parameter that wasn't used! */
res = PARAM_GOT_EXTRA_PARAMETER;
if(res == PARAM_NEXT_OPERATION) {
if(operation->url_list && operation->url_list->url) {
/* Allocate the next config */
operation->next = malloc(sizeof(struct OperationConfig));
if(operation->next) {
/* Initialise the newly created config */
config_init(operation->next);
/* Copy the easy handle */
operation->next->easy = global->easy;
/* Set the global config pointer */
operation->next->global = global;
/* Update the last operation pointer */
global->last = operation->next;
/* Move onto the new config */
operation->next->prev = operation;
operation = operation->next;
}
else
res = PARAM_NO_MEM;
}
}
if(res != PARAM_OK && res != PARAM_NEXT_OPERATION) {
/* the help request isn't really an error */
if(!strcmp(filename, "-")) {
filename = (char *)"<stdin>";
}
if(res != PARAM_HELP_REQUESTED &&
res != PARAM_MANUAL_REQUESTED &&
res != PARAM_VERSION_INFO_REQUESTED &&
res != PARAM_ENGINES_REQUESTED) {
const char *reason = param2text(res);
warnf(operation->global, "%s:%d: warning: '%s' %s\n",
filename, lineno, option, reason);
}
}
if(alloced_param)
Curl_safefree(param);
Curl_safefree(aline);
}
if(file != stdin)
fclose(file);
}
else
rc = 1; /* couldn't open the file */
return rc;
}
/*
* Copies the string from line to the buffer at param, unquoting
* backslash-quoted characters and NUL-terminating the output string.
* Stops at the first non-backslash-quoted double quote character or the
* end of the input string. param must be at least as long as the input
* string. Returns the pointer after the last handled input character.
*/
static const char *unslashquote(const char *line, char *param)
{
while(*line && (*line != '\"')) {
if(*line == '\\') {
char out;
line++;
/* default is to output the letter after the backslash */
switch(out = *line) {
case '\0':
continue; /* this'll break out of the loop */
case 't':
out = '\t';
break;
case 'n':
out = '\n';
break;
case 'r':
out = '\r';
break;
case 'v':
out = '\v';
break;
}
*param++ = out;
line++;
}
else
*param++ = *line++;
}
*param = '\0'; /* always zero terminate */
return line;
}
/*
* Reads a line from the given file, ensuring is NUL terminated.
* The pointer must be freed by the caller.
* NULL is returned on an out of memory condition.
*/
static char *my_get_line(FILE *fp)
{
char buf[4096];
char *nl = NULL;
char *line = NULL;
do {
if(NULL == fgets(buf, sizeof(buf), fp))
break;
if(!line) {
line = strdup(buf);
if(!line)
return NULL;
}
else {
char *ptr;
size_t linelen = strlen(line);
ptr = realloc(line, linelen + strlen(buf) + 1);
if(!ptr) {
Curl_safefree(line);
return NULL;
}
line = ptr;
strcpy(&line[linelen], buf);
}
nl = strchr(line, '\n');
} while(!nl);
if(nl)
*nl = '\0';
return line;
}

View File

@@ -0,0 +1,29 @@
#ifndef HEADER_CURL_TOOL_PARSECFG_H
#define HEADER_CURL_TOOL_PARSECFG_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
int parseconfig(const char *filename, struct GlobalConfig *config);
#endif /* HEADER_CURL_TOOL_PARSECFG_H */

151
3rd-party/curl-7.52.1/src/tool_sdecls.h vendored Normal file
View File

@@ -0,0 +1,151 @@
#ifndef HEADER_CURL_TOOL_SDECLS_H
#define HEADER_CURL_TOOL_SDECLS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef USE_METALINK
# include <metalink/metalink.h>
#endif /* USE_METALINK */
/*
* OutStruct variables keep track of information relative to curl's
* output writing, which may take place to a standard stream or a file.
*
* 'filename' member is either a pointer to a file name string or NULL
* when dealing with a standard stream.
*
* 'alloc_filename' member is TRUE when string pointed by 'filename' has been
* dynamically allocated and 'belongs' to this OutStruct, otherwise FALSE.
*
* 'is_cd_filename' member is TRUE when string pointed by 'filename' has been
* set using a server-specified Content-Disposition filename, otherwise FALSE.
*
* 's_isreg' member is TRUE when output goes to a regular file, this also
* implies that output is 'seekable' and 'appendable' and also that member
* 'filename' points to file name's string. For any standard stream member
* 's_isreg' will be FALSE.
*
* 'fopened' member is TRUE when output goes to a regular file and it
* has been fopen'ed, requiring it to be closed later on. In any other
* case this is FALSE.
*
* 'stream' member is a pointer to a stream controlling object as returned
* from a 'fopen' call or a standard stream.
*
* 'config' member is a pointer to associated 'OperationConfig' struct.
*
* 'bytes' member represents amount written so far.
*
* 'init' member holds original file size or offset at which truncation is
* taking place. Always zero unless appending to a non-empty regular file.
*
* 'metalink_parser' member is a pointer to Metalink XML parser
* context.
*/
struct OutStruct {
char *filename;
bool alloc_filename;
bool is_cd_filename;
bool s_isreg;
bool fopened;
FILE *stream;
struct OperationConfig *config;
curl_off_t bytes;
curl_off_t init;
#ifdef USE_METALINK
metalink_parser_context_t *metalink_parser;
#endif /* USE_METALINK */
};
/*
* InStruct variables keep track of information relative to curl's
* input reading, which may take place from stdin or from some file.
*
* 'fd' member is either 'stdin' file descriptor number STDIN_FILENO
* or a file descriptor as returned from an 'open' call for some file.
*
* 'config' member is a pointer to associated 'OperationConfig' struct.
*/
struct InStruct {
int fd;
struct OperationConfig *config;
};
/*
* A linked list of these 'getout' nodes contain URL's to fetch,
* as well as information relative to where URL contents should
* be stored or which file should be uploaded.
*/
struct getout {
struct getout *next; /* next one */
char *url; /* the URL we deal with */
char *outfile; /* where to store the output */
char *infile; /* file to upload, if GETOUT_UPLOAD is set */
int flags; /* options - composed of GETOUT_* bits */
};
#define GETOUT_OUTFILE (1<<0) /* set when outfile is deemed done */
#define GETOUT_URL (1<<1) /* set when URL is deemed done */
#define GETOUT_USEREMOTE (1<<2) /* use remote file name locally */
#define GETOUT_UPLOAD (1<<3) /* if set, -T has been used */
#define GETOUT_NOUPLOAD (1<<4) /* if set, -T "" has been used */
#define GETOUT_METALINK (1<<5) /* set when Metalink download */
/*
* 'trace' enumeration represents curl's output look'n feel possibilities.
*/
typedef enum {
TRACE_NONE, /* no trace/verbose output at all */
TRACE_BIN, /* tcpdump inspired look */
TRACE_ASCII, /* like *BIN but without the hex output */
TRACE_PLAIN /* -v/--verbose type */
} trace;
/*
* 'HttpReq' enumeration represents HTTP request types.
*/
typedef enum {
HTTPREQ_UNSPEC, /* first in list */
HTTPREQ_GET,
HTTPREQ_HEAD,
HTTPREQ_FORMPOST,
HTTPREQ_SIMPLEPOST
} HttpReq;
/*
* Complete struct declarations which have OperationConfig struct members,
* just in case this header is directly included in some source file.
*/
#include "tool_cfgable.h"
#endif /* HEADER_CURL_TOOL_SDECLS_H */

588
3rd-party/curl-7.52.1/src/tool_setopt.c vendored Normal file
View File

@@ -0,0 +1,588 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_easysrc.h"
#include "tool_setopt.h"
#include "memdebug.h" /* keep this as LAST include */
/* Lookup tables for converting setopt values back to symbols */
/* For enums, values may be in any order. */
/* For bit masks, put combinations first, then single bits, */
/* and finally any "NONE" value. */
#define NV(e) {#e, e}
#define NV1(e, v) {#e, (v)}
#define NVEND {NULL, 0} /* sentinel to mark end of list */
const NameValue setopt_nv_CURLPROXY[] = {
NV(CURLPROXY_HTTP),
NV(CURLPROXY_HTTP_1_0),
NV(CURLPROXY_HTTPS),
NV(CURLPROXY_SOCKS4),
NV(CURLPROXY_SOCKS5),
NV(CURLPROXY_SOCKS4A),
NV(CURLPROXY_SOCKS5_HOSTNAME),
NVEND,
};
const NameValue setopt_nv_CURL_SOCKS_PROXY[] = {
NV(CURLPROXY_SOCKS4),
NV(CURLPROXY_SOCKS5),
NV(CURLPROXY_SOCKS4A),
NV(CURLPROXY_SOCKS5_HOSTNAME),
NVEND,
};
const NameValueUnsigned setopt_nv_CURLAUTH[] = {
NV(CURLAUTH_ANY), /* combination */
NV(CURLAUTH_ANYSAFE), /* combination */
NV(CURLAUTH_BASIC),
NV(CURLAUTH_DIGEST),
NV(CURLAUTH_GSSNEGOTIATE),
NV(CURLAUTH_NTLM),
NV(CURLAUTH_DIGEST_IE),
NV(CURLAUTH_NTLM_WB),
NV(CURLAUTH_ONLY),
NV(CURLAUTH_NONE),
NVEND,
};
const NameValue setopt_nv_CURL_HTTP_VERSION[] = {
NV(CURL_HTTP_VERSION_NONE),
NV(CURL_HTTP_VERSION_1_0),
NV(CURL_HTTP_VERSION_1_1),
NV(CURL_HTTP_VERSION_2_0),
NV(CURL_HTTP_VERSION_2TLS),
NVEND,
};
const NameValue setopt_nv_CURL_SSLVERSION[] = {
NV(CURL_SSLVERSION_DEFAULT),
NV(CURL_SSLVERSION_TLSv1),
NV(CURL_SSLVERSION_SSLv2),
NV(CURL_SSLVERSION_SSLv3),
NV(CURL_SSLVERSION_TLSv1_0),
NV(CURL_SSLVERSION_TLSv1_1),
NV(CURL_SSLVERSION_TLSv1_2),
NV(CURL_SSLVERSION_TLSv1_3),
NVEND,
};
const NameValue setopt_nv_CURL_TIMECOND[] = {
NV(CURL_TIMECOND_IFMODSINCE),
NV(CURL_TIMECOND_IFUNMODSINCE),
NV(CURL_TIMECOND_LASTMOD),
NV(CURL_TIMECOND_NONE),
NVEND,
};
const NameValue setopt_nv_CURLFTPSSL_CCC[] = {
NV(CURLFTPSSL_CCC_NONE),
NV(CURLFTPSSL_CCC_PASSIVE),
NV(CURLFTPSSL_CCC_ACTIVE),
NVEND,
};
const NameValue setopt_nv_CURLUSESSL[] = {
NV(CURLUSESSL_NONE),
NV(CURLUSESSL_TRY),
NV(CURLUSESSL_CONTROL),
NV(CURLUSESSL_ALL),
NVEND,
};
const NameValueUnsigned setopt_nv_CURLSSLOPT[] = {
NV(CURLSSLOPT_ALLOW_BEAST),
NV(CURLSSLOPT_NO_REVOKE),
NVEND,
};
const NameValue setopt_nv_CURL_NETRC[] = {
NV(CURL_NETRC_IGNORED),
NV(CURL_NETRC_OPTIONAL),
NV(CURL_NETRC_REQUIRED),
NVEND,
};
/* These mappings essentially triplicated - see
* tool_libinfo.c and tool_paramhlp.c */
const NameValue setopt_nv_CURLPROTO[] = {
NV(CURLPROTO_ALL), /* combination */
NV(CURLPROTO_DICT),
NV(CURLPROTO_FILE),
NV(CURLPROTO_FTP),
NV(CURLPROTO_FTPS),
NV(CURLPROTO_GOPHER),
NV(CURLPROTO_HTTP),
NV(CURLPROTO_HTTPS),
NV(CURLPROTO_IMAP),
NV(CURLPROTO_IMAPS),
NV(CURLPROTO_LDAP),
NV(CURLPROTO_LDAPS),
NV(CURLPROTO_POP3),
NV(CURLPROTO_POP3S),
NV(CURLPROTO_RTSP),
NV(CURLPROTO_SCP),
NV(CURLPROTO_SFTP),
NV(CURLPROTO_SMB),
NV(CURLPROTO_SMBS),
NV(CURLPROTO_SMTP),
NV(CURLPROTO_SMTPS),
NV(CURLPROTO_TELNET),
NV(CURLPROTO_TFTP),
NVEND,
};
/* These options have non-zero default values. */
static const NameValue setopt_nv_CURLNONZERODEFAULTS[] = {
NV1(CURLOPT_SSL_VERIFYPEER, 1),
NV1(CURLOPT_SSL_VERIFYHOST, 1),
NV1(CURLOPT_SSL_ENABLE_NPN, 1),
NV1(CURLOPT_SSL_ENABLE_ALPN, 1),
NV1(CURLOPT_TCP_NODELAY, 1),
NV1(CURLOPT_PROXY_SSL_VERIFYPEER, 1),
NV1(CURLOPT_PROXY_SSL_VERIFYHOST, 1),
NVEND
};
/* Format and add code; jump to nomem on malloc error */
#define ADD(args) do { \
ret = easysrc_add args; \
if(ret) \
goto nomem; \
} WHILE_FALSE
#define ADDF(args) do { \
ret = easysrc_addf args; \
if(ret) \
goto nomem; \
} WHILE_FALSE
#define DECL0(s) ADD((&easysrc_decl, s))
#define DECL1(f,a) ADDF((&easysrc_decl, f,a))
#define DATA0(s) ADD((&easysrc_data, s))
#define DATA1(f,a) ADDF((&easysrc_data, f,a))
#define DATA2(f,a,b) ADDF((&easysrc_data, f,a,b))
#define DATA3(f,a,b,c) ADDF((&easysrc_data, f,a,b,c))
#define CODE0(s) ADD((&easysrc_code, s))
#define CODE1(f,a) ADDF((&easysrc_code, f,a))
#define CODE2(f,a,b) ADDF((&easysrc_code, f,a,b))
#define CODE3(f,a,b,c) ADDF((&easysrc_code, f,a,b,c))
#define CLEAN0(s) ADD((&easysrc_clean, s))
#define CLEAN1(f,a) ADDF((&easysrc_clean, f,a))
#define REM0(s) ADD((&easysrc_toohard, s))
#define REM1(f,a) ADDF((&easysrc_toohard, f,a))
#define REM2(f,a,b) ADDF((&easysrc_toohard, f,a,b))
/* Escape string to C string syntax. Return NULL if out of memory.
* Is this correct for those wacky EBCDIC guys? */
static char *c_escape(const char *str)
{
size_t len = 0;
const char *s;
unsigned char c;
char *escaped, *e;
/* Allocate space based on worst-case */
len = strlen(str);
escaped = malloc(4 * len + 1);
if(!escaped)
return NULL;
e = escaped;
for(s=str; (c=*s) != '\0'; s++) {
if(c=='\n') {
strcpy(e, "\\n");
e += 2;
}
else if(c=='\r') {
strcpy(e, "\\r");
e += 2;
}
else if(c=='\t') {
strcpy(e, "\\t");
e += 2;
}
else if(c=='\\') {
strcpy(e, "\\\\");
e += 2;
}
else if(c=='"') {
strcpy(e, "\\\"");
e += 2;
}
else if(! isprint(c)) {
snprintf(e, 5, "\\%03o", (unsigned)c);
e += 4;
}
else
*e++ = c;
}
*e = '\0';
return escaped;
}
/* setopt wrapper for enum types */
CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValue *nvlist, long lval)
{
CURLcode ret = CURLE_OK;
bool skip = FALSE;
ret = curl_easy_setopt(curl, tag, lval);
if(!lval)
skip = TRUE;
if(config->libcurl && !skip && !ret) {
/* we only use this for real if --libcurl was used */
const NameValue *nv = NULL;
for(nv=nvlist; nv->name; nv++) {
if(nv->value == lval) break; /* found it */
}
if(! nv->name) {
/* If no definition was found, output an explicit value.
* This could happen if new values are defined and used
* but the NameValue list is not updated. */
CODE2("curl_easy_setopt(hnd, %s, %ldL);", name, lval);
}
else {
CODE2("curl_easy_setopt(hnd, %s, (long)%s);", name, nv->name);
}
}
nomem:
return ret;
}
/* setopt wrapper for flags */
CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValue *nvlist, long lval)
{
CURLcode ret = CURLE_OK;
bool skip = FALSE;
ret = curl_easy_setopt(curl, tag, lval);
if(!lval)
skip = TRUE;
if(config->libcurl && !skip && !ret) {
/* we only use this for real if --libcurl was used */
char preamble[80]; /* should accommodate any symbol name */
long rest = lval; /* bits not handled yet */
const NameValue *nv = NULL;
snprintf(preamble, sizeof(preamble),
"curl_easy_setopt(hnd, %s, ", name);
for(nv=nvlist; nv->name; nv++) {
if((nv->value & ~ rest) == 0) {
/* all value flags contained in rest */
rest &= ~ nv->value; /* remove bits handled here */
CODE3("%s(long)%s%s",
preamble, nv->name, rest ? " |" : ");");
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.
* This could happen if new bits are defined and used
* but the NameValue list is not updated. */
if(rest)
CODE2("%s%ldL);", preamble, rest);
}
nomem:
return ret;
}
/* setopt wrapper for bitmasks */
CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValueUnsigned *nvlist,
long lval)
{
CURLcode ret = CURLE_OK;
bool skip = FALSE;
ret = curl_easy_setopt(curl, tag, lval);
if(!lval)
skip = TRUE;
if(config->libcurl && !skip && !ret) {
/* we only use this for real if --libcurl was used */
char preamble[80];
unsigned long rest = (unsigned long)lval;
const NameValueUnsigned *nv = NULL;
snprintf(preamble, sizeof(preamble),
"curl_easy_setopt(hnd, %s, ", name);
for(nv=nvlist; nv->name; nv++) {
if((nv->value & ~ rest) == 0) {
/* all value flags contained in rest */
rest &= ~ nv->value; /* remove bits handled here */
CODE3("%s(long)%s%s",
preamble, nv->name, rest ? " |" : ");");
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.
* This could happen if new bits are defined and used
* but the NameValue list is not updated. */
if(rest)
CODE2("%s%luUL);", preamble, rest);
}
nomem:
return ret;
}
/* setopt wrapper for CURLOPT_HTTPPOST */
CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
struct curl_httppost *post)
{
CURLcode ret = CURLE_OK;
char *escaped = NULL;
bool skip = FALSE;
ret = curl_easy_setopt(curl, tag, post);
if(!post)
skip = TRUE;
if(config->libcurl && !skip && !ret) {
struct curl_httppost *pp, *p;
int i;
/* May use several httppost lists, if multiple POST actions */
i = ++ easysrc_form_count;
DECL1("struct curl_httppost *post%d;", i);
DATA1("post%d = NULL;", i);
CLEAN1("curl_formfree(post%d);", i);
CLEAN1("post%d = NULL;", i);
if(i == 1)
DECL0("struct curl_httppost *postend;");
DATA0("postend = NULL;");
for(p=post; p; p=p->next) {
DATA1("curl_formadd(&post%d, &postend,", i);
DATA1(" CURLFORM_COPYNAME, \"%s\",", p->name);
for(pp=p; pp; pp=pp->more) {
/* May be several files uploaded for one name;
* these are linked through the 'more' pointer */
Curl_safefree(escaped);
escaped = c_escape(pp->contents);
if(!escaped) {
ret = CURLE_OUT_OF_MEMORY;
goto nomem;
}
if(pp->flags & CURL_HTTPPOST_FILENAME) {
/* file upload as for -F @filename */
DATA1(" CURLFORM_FILE, \"%s\",", escaped);
}
else if(pp->flags & CURL_HTTPPOST_READFILE) {
/* content from file as for -F <filename */
DATA1(" CURLFORM_FILECONTENT, \"%s\",", escaped);
}
else
DATA1(" CURLFORM_COPYCONTENTS, \"%s\",", escaped);
if(pp->showfilename) {
Curl_safefree(escaped);
escaped = c_escape(pp->showfilename);
if(!escaped) {
ret = CURLE_OUT_OF_MEMORY;
goto nomem;
}
DATA1(" CURLFORM_FILENAME, \"%s\",", escaped);
}
if(pp->contenttype) {
Curl_safefree(escaped);
escaped = c_escape(pp->contenttype);
if(!escaped) {
ret = CURLE_OUT_OF_MEMORY;
goto nomem;
}
DATA1(" CURLFORM_CONTENTTYPE, \"%s\",", escaped);
}
}
DATA0(" CURLFORM_END);");
}
CODE2("curl_easy_setopt(hnd, %s, post%d);", name, i);
}
nomem:
Curl_safefree(escaped);
return ret;
}
/* setopt wrapper for curl_slist options */
CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
struct curl_slist *list)
{
CURLcode ret = CURLE_OK;
char *escaped = NULL;
bool skip = FALSE;
ret = curl_easy_setopt(curl, tag, list);
if(!list)
skip = TRUE;
if(config->libcurl && !skip && !ret) {
struct curl_slist *s;
int i;
/* May need several slist variables, so invent name */
i = ++ easysrc_slist_count;
DECL1("struct curl_slist *slist%d;", i);
DATA1("slist%d = NULL;", i);
CLEAN1("curl_slist_free_all(slist%d);", i);
CLEAN1("slist%d = NULL;", i);
for(s=list; s; s=s->next) {
Curl_safefree(escaped);
escaped = c_escape(s->data);
if(!escaped) {
ret = CURLE_OUT_OF_MEMORY;
goto nomem;
}
DATA3("slist%d = curl_slist_append(slist%d, \"%s\");", i, i, escaped);
}
CODE2("curl_easy_setopt(hnd, %s, slist%d);", name, i);
}
nomem:
Curl_safefree(escaped);
return ret;
}
/* generic setopt wrapper for all other options.
* Some type information is encoded in the tag value. */
CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
const char *name, CURLoption tag, ...)
{
va_list arg;
char buf[256];
const char *value = NULL;
bool remark = FALSE;
bool skip = FALSE;
bool escape = FALSE;
char *escaped = NULL;
CURLcode ret = CURLE_OK;
va_start(arg, tag);
if(tag < CURLOPTTYPE_OBJECTPOINT) {
/* Value is expected to be a long */
long lval = va_arg(arg, long);
long defval = 0L;
const NameValue *nv = NULL;
for(nv=setopt_nv_CURLNONZERODEFAULTS; nv->name; nv++) {
if(!strcmp(name, nv->name)) {
defval = nv->value;
break; /* found it */
}
}
snprintf(buf, sizeof(buf), "%ldL", lval);
value = buf;
ret = curl_easy_setopt(curl, tag, lval);
if(lval == defval)
skip = TRUE;
}
else if(tag < CURLOPTTYPE_OFF_T) {
/* Value is some sort of object pointer */
void *pval = va_arg(arg, void *);
/* function pointers are never printable */
if(tag >= CURLOPTTYPE_FUNCTIONPOINT) {
if(pval) {
value = "functionpointer";
remark = TRUE;
}
else
skip = TRUE;
}
else if(pval && str) {
value = (char *)pval;
escape = TRUE;
}
else if(pval) {
value = "objectpointer";
remark = TRUE;
}
else
skip = TRUE;
ret = curl_easy_setopt(curl, tag, pval);
}
else {
/* Value is expected to be curl_off_t */
curl_off_t oval = va_arg(arg, curl_off_t);
snprintf(buf, sizeof(buf),
"(curl_off_t)%" CURL_FORMAT_CURL_OFF_T, oval);
value = buf;
ret = curl_easy_setopt(curl, tag, oval);
if(!oval)
skip = TRUE;
}
va_end(arg);
if(config->libcurl && !skip && !ret) {
/* we only use this for real if --libcurl was used */
if(remark)
REM2("%s set to a %s", name, value);
else {
if(escape) {
escaped = c_escape(value);
if(!escaped) {
ret = CURLE_OUT_OF_MEMORY;
goto nomem;
}
CODE2("curl_easy_setopt(hnd, %s, \"%s\");", name, escaped);
}
else
CODE2("curl_easy_setopt(hnd, %s, %s);", name, value);
}
}
nomem:
Curl_safefree(escaped);
return ret;
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */

153
3rd-party/curl-7.52.1/src/tool_setopt.h vendored Normal file
View File

@@ -0,0 +1,153 @@
#ifndef HEADER_CURL_TOOL_SETOPT_H
#define HEADER_CURL_TOOL_SETOPT_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
/*
* Macros used in operate()
*/
#define SETOPT_CHECK(v) do { \
result = (v); \
if(result) \
goto show_error; \
} WHILE_FALSE
#ifndef CURL_DISABLE_LIBCURL_OPTION
/* Associate symbolic names with option values */
typedef struct {
const char *name;
long value;
} NameValue;
typedef struct {
const char *name;
unsigned long value;
} NameValueUnsigned;
extern const NameValue setopt_nv_CURLPROXY[];
extern const NameValue setopt_nv_CURL_SOCKS_PROXY[];
extern const NameValue setopt_nv_CURL_HTTP_VERSION[];
extern const NameValue setopt_nv_CURL_SSLVERSION[];
extern const NameValue setopt_nv_CURL_TIMECOND[];
extern const NameValue setopt_nv_CURLFTPSSL_CCC[];
extern const NameValue setopt_nv_CURLUSESSL[];
extern const NameValueUnsigned setopt_nv_CURLSSLOPT[];
extern const NameValue setopt_nv_CURL_NETRC[];
extern const NameValue setopt_nv_CURLPROTO[];
extern const NameValueUnsigned setopt_nv_CURLAUTH[];
/* Map options to NameValue sets */
#define setopt_nv_CURLOPT_HTTP_VERSION setopt_nv_CURL_HTTP_VERSION
#define setopt_nv_CURLOPT_HTTPAUTH setopt_nv_CURLAUTH
#define setopt_nv_CURLOPT_SSLVERSION setopt_nv_CURL_SSLVERSION
#define setopt_nv_CURLOPT_PROXY_SSLVERSION setopt_nv_CURL_SSLVERSION
#define setopt_nv_CURLOPT_TIMECONDITION setopt_nv_CURL_TIMECOND
#define setopt_nv_CURLOPT_FTP_SSL_CCC setopt_nv_CURLFTPSSL_CCC
#define setopt_nv_CURLOPT_USE_SSL setopt_nv_CURLUSESSL
#define setopt_nv_CURLOPT_SSL_OPTIONS setopt_nv_CURLSSLOPT
#define setopt_nv_CURLOPT_NETRC setopt_nv_CURL_NETRC
#define setopt_nv_CURLOPT_PROTOCOLS setopt_nv_CURLPROTO
#define setopt_nv_CURLOPT_REDIR_PROTOCOLS setopt_nv_CURLPROTO
#define setopt_nv_CURLOPT_PROXYTYPE setopt_nv_CURLPROXY
#define setopt_nv_CURLOPT_SOCKS_PROXYTYPE setopt_nv_CURL_SOCKS_PROXY
#define setopt_nv_CURLOPT_PROXYAUTH setopt_nv_CURLAUTH
/* Intercept setopt calls for --libcurl */
CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValue *nv, long lval);
CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValue *nv, long lval);
CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
const NameValueUnsigned *nv, long lval);
CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
struct curl_httppost *httppost);
CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config,
const char *name, CURLoption tag,
struct curl_slist *list);
CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
const char *name, CURLoption tag, ...);
#define my_setopt(x,y,z) \
SETOPT_CHECK(tool_setopt(x, FALSE, global, #y, y, z))
#define my_setopt_str(x,y,z) \
SETOPT_CHECK(tool_setopt(x, TRUE, global, #y, y, z))
#define my_setopt_enum(x,y,z) \
SETOPT_CHECK(tool_setopt_enum(x, global, #y, y, setopt_nv_ ## y, z))
#define my_setopt_flags(x,y,z) \
SETOPT_CHECK(tool_setopt_flags(x, global, #y, y, setopt_nv_ ## y, z))
#define my_setopt_bitmask(x,y,z) \
SETOPT_CHECK(tool_setopt_bitmask(x, global, #y, y, setopt_nv_ ## y, z))
#define my_setopt_httppost(x,y,z) \
SETOPT_CHECK(tool_setopt_httppost(x, global, #y, y, z))
#define my_setopt_slist(x,y,z) \
SETOPT_CHECK(tool_setopt_slist(x, global, #y, y, z))
#define res_setopt(x,y,z) tool_setopt(x, FALSE, global, #y, y, z)
#define res_setopt_str(x,y,z) tool_setopt(x, TRUE, global, #y, y, z)
#else /* CURL_DISABLE_LIBCURL_OPTION */
/* No --libcurl, so pass options directly to library */
#define my_setopt(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_str(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_enum(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_flags(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_bitmask(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_httppost(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define my_setopt_slist(x,y,z) \
SETOPT_CHECK(curl_easy_setopt(x, y, z))
#define res_setopt(x,y,z) curl_easy_setopt(x,y,z)
#define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)
#endif /* CURL_DISABLE_LIBCURL_OPTION */
#endif /* HEADER_CURL_TOOL_SETOPT_H */

74
3rd-party/curl-7.52.1/src/tool_setup.h vendored Normal file
View File

@@ -0,0 +1,74 @@
#ifndef HEADER_CURL_TOOL_SETUP_H
#define HEADER_CURL_TOOL_SETUP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#define CURL_NO_OLDIES
/*
* curl_setup.h may define preprocessor macros such as _FILE_OFFSET_BITS and
* _LARGE_FILES in order to support files larger than 2 GB. On platforms
* where this happens it is mandatory that these macros are defined before
* any system header file is included, otherwise file handling function
* prototypes will be misdeclared and curl tool may not build properly;
* therefore we must include curl_setup.h before curl.h when building curl.
*/
#include "curl_setup.h" /* from the lib directory */
/*
* curl tool certainly uses libcurl's external interface.
*/
#include <curl/curl.h> /* external interface */
/*
* Platform specific stuff.
*/
#if defined(macintosh) && defined(__MRC__)
# define main(x,y) curl_main(x,y)
#endif
#ifdef TPF
# undef select
/* change which select is used for the curl command line tool */
# define select(a,b,c,d,e) tpf_select_bsd(a,b,c,d,e)
/* and turn off the progress meter */
# define CONF_DEFAULT (0|CONF_NOPROGRESS)
#endif
#ifndef OS
# define OS "unknown"
#endif
#ifndef UNPRINTABLE_CHAR
/* define what to use for unprintable characters */
# define UNPRINTABLE_CHAR '.'
#endif
#ifndef HAVE_STRDUP
# include "tool_strdup.h"
#endif
#endif /* HEADER_CURL_TOOL_SETUP_H */

58
3rd-party/curl-7.52.1/src/tool_sleep.c vendored Normal file
View File

@@ -0,0 +1,58 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
#elif defined(HAVE_POLL_H)
# include <poll.h>
#endif
#ifdef MSDOS
# include <dos.h>
#endif
#include "tool_sleep.h"
#include "memdebug.h" /* keep this as LAST include */
void tool_go_sleep(long ms)
{
#if defined(MSDOS)
delay(ms);
#elif defined(WIN32)
Sleep(ms);
#elif defined(HAVE_POLL_FINE)
(void)poll((void *)0, 0, (int)ms);
#else
struct timeval timeout;
timeout.tv_sec = ms / 1000L;
ms = ms % 1000L;
timeout.tv_usec = ms * 1000L;
select(0, NULL, NULL, NULL, &timeout);
#endif
}

29
3rd-party/curl-7.52.1/src/tool_sleep.h vendored Normal file
View File

@@ -0,0 +1,29 @@
#ifndef HEADER_CURL_TOOL_SLEEP_H
#define HEADER_CURL_TOOL_SLEEP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
void tool_go_sleep(long ms);
#endif /* HEADER_CURL_TOOL_SLEEP_H */

47
3rd-party/curl-7.52.1/src/tool_strdup.c vendored Normal file
View File

@@ -0,0 +1,47 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_strdup.h"
#ifndef HAVE_STRDUP
char *strdup(const char *str)
{
size_t len;
char *newstr;
if(!str)
return (char *)NULL;
len = strlen(str);
if(len >= ((size_t)-1) / sizeof(char))
return (char *)NULL;
newstr = malloc((len+1)*sizeof(char));
if(!newstr)
return (char *)NULL;
memcpy(newstr, str, (len+1)*sizeof(char));
return newstr;
}
#endif

30
3rd-party/curl-7.52.1/src/tool_strdup.h vendored Normal file
View File

@@ -0,0 +1,30 @@
#ifndef HEADER_TOOL_STRDUP_H
#define HEADER_TOOL_STRDUP_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifndef HAVE_STRDUP
extern char *strdup(const char *str);
#endif
#endif /* HEADER_TOOL_STRDUP_H */

705
3rd-party/curl-7.52.1/src/tool_urlglob.c vendored Normal file
View File

@@ -0,0 +1,705 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_doswin.h"
#include "tool_urlglob.h"
#include "tool_vms.h"
#include "memdebug.h" /* keep this as LAST include */
#define GLOBERROR(string, column, code) \
glob->error = string, glob->pos = column, code
void glob_cleanup(URLGlob* glob);
static CURLcode glob_fixed(URLGlob *glob, char *fixed, size_t len)
{
URLPattern *pat = &glob->pattern[glob->size];
pat->type = UPTSet;
pat->content.Set.size = 1;
pat->content.Set.ptr_s = 0;
pat->globindex = -1;
pat->content.Set.elements = malloc(sizeof(char *));
if(!pat->content.Set.elements)
return GLOBERROR("out of memory", 0, CURLE_OUT_OF_MEMORY);
pat->content.Set.elements[0] = malloc(len+1);
if(!pat->content.Set.elements[0])
return GLOBERROR("out of memory", 0, CURLE_OUT_OF_MEMORY);
memcpy(pat->content.Set.elements[0], fixed, len);
pat->content.Set.elements[0][len] = 0;
return CURLE_OK;
}
/* multiply
*
* Multiplies and checks for overflow.
*/
static int multiply(unsigned long *amount, long with)
{
unsigned long sum = *amount * with;
if(sum/with != *amount)
return 1; /* didn't fit, bail out */
*amount = sum;
return 0;
}
static CURLcode glob_set(URLGlob *glob, char **patternp,
size_t *posp, unsigned long *amount,
int globindex)
{
/* processes a set expression with the point behind the opening '{'
','-separated elements are collected until the next closing '}'
*/
URLPattern *pat;
bool done = FALSE;
char *buf = glob->glob_buffer;
char *pattern = *patternp;
char *opattern = pattern;
size_t opos = *posp-1;
pat = &glob->pattern[glob->size];
/* patterns 0,1,2,... correspond to size=1,3,5,... */
pat->type = UPTSet;
pat->content.Set.size = 0;
pat->content.Set.ptr_s = 0;
pat->content.Set.elements = NULL;
pat->globindex = globindex;
while(!done) {
switch (*pattern) {
case '\0': /* URL ended while set was still open */
return GLOBERROR("unmatched brace", opos, CURLE_URL_MALFORMAT);
case '{':
case '[': /* no nested expressions at this time */
return GLOBERROR("nested brace", *posp, CURLE_URL_MALFORMAT);
case '}': /* set element completed */
if(opattern == pattern)
return GLOBERROR("empty string within braces", *posp,
CURLE_URL_MALFORMAT);
/* add 1 to size since it'll be incremented below */
if(multiply(amount, pat->content.Set.size+1))
return GLOBERROR("range overflow", 0, CURLE_URL_MALFORMAT);
/* fall-through */
case ',':
*buf = '\0';
if(pat->content.Set.elements) {
char **new_arr = realloc(pat->content.Set.elements,
(pat->content.Set.size + 1) * sizeof(char *));
if(!new_arr)
return GLOBERROR("out of memory", 0, CURLE_OUT_OF_MEMORY);
pat->content.Set.elements = new_arr;
}
else
pat->content.Set.elements = malloc(sizeof(char *));
if(!pat->content.Set.elements)
return GLOBERROR("out of memory", 0, CURLE_OUT_OF_MEMORY);
pat->content.Set.elements[pat->content.Set.size] =
strdup(glob->glob_buffer);
if(!pat->content.Set.elements[pat->content.Set.size])
return GLOBERROR("out of memory", 0, CURLE_OUT_OF_MEMORY);
++pat->content.Set.size;
if(*pattern == '}') {
pattern++; /* pass the closing brace */
done = TRUE;
continue;
}
buf = glob->glob_buffer;
++pattern;
++(*posp);
break;
case ']': /* illegal closing bracket */
return GLOBERROR("unexpected close bracket", *posp, CURLE_URL_MALFORMAT);
case '\\': /* escaped character, skip '\' */
if(pattern[1]) {
++pattern;
++(*posp);
}
/* intentional fallthrough */
default:
*buf++ = *pattern++; /* copy character to set element */
++(*posp);
}
}
*patternp = pattern; /* return with the new position */
return CURLE_OK;
}
static CURLcode glob_range(URLGlob *glob, char **patternp,
size_t *posp, unsigned long *amount,
int globindex)
{
/* processes a range expression with the point behind the opening '['
- char range: e.g. "a-z]", "B-Q]"
- num range: e.g. "0-9]", "17-2000]"
- num range with leading zeros: e.g. "001-999]"
expression is checked for well-formedness and collected until the next ']'
*/
URLPattern *pat;
int rc;
char *pattern = *patternp;
char *c;
pat = &glob->pattern[glob->size];
pat->globindex = globindex;
if(ISALPHA(*pattern)) {
/* character range detected */
char min_c;
char max_c;
char end_c;
int step=1;
pat->type = UPTCharRange;
rc = sscanf(pattern, "%c-%c%c", &min_c, &max_c, &end_c);
if(rc == 3) {
if(end_c == ':') {
char *endp;
unsigned long lstep;
errno = 0;
lstep = strtoul(&pattern[4], &endp, 10);
if(errno || &pattern[4] == endp || *endp != ']')
step = -1;
else {
pattern = endp+1;
step = (int)lstep;
if(step > (max_c - min_c))
step = -1;
}
}
else if(end_c != ']')
/* then this is wrong */
rc = 0;
else
/* end_c == ']' */
pattern += 4;
}
*posp += (pattern - *patternp);
if((rc != 3) || (min_c >= max_c) || ((max_c - min_c) > ('z' - 'a')) ||
(step <= 0) )
/* the pattern is not well-formed */
return GLOBERROR("bad range", *posp, CURLE_URL_MALFORMAT);
/* if there was a ":[num]" thing, use that as step or else use 1 */
pat->content.CharRange.step = step;
pat->content.CharRange.ptr_c = pat->content.CharRange.min_c = min_c;
pat->content.CharRange.max_c = max_c;
if(multiply(amount, (pat->content.CharRange.max_c -
pat->content.CharRange.min_c) /
pat->content.CharRange.step + 1) )
return GLOBERROR("range overflow", *posp, CURLE_URL_MALFORMAT);
}
else if(ISDIGIT(*pattern)) {
/* numeric range detected */
unsigned long min_n;
unsigned long max_n = 0;
unsigned long step_n = 0;
char *endp;
pat->type = UPTNumRange;
pat->content.NumRange.padlength = 0;
if(*pattern == '0') {
/* leading zero specified, count them! */
c = pattern;
while(ISDIGIT(*c)) {
c++;
++pat->content.NumRange.padlength; /* padding length is set for all
instances of this pattern */
}
}
errno = 0;
min_n = strtoul(pattern, &endp, 10);
if(errno || (endp == pattern))
endp=NULL;
else {
if(*endp != '-')
endp = NULL;
else {
pattern = endp+1;
while(*pattern && ISBLANK(*pattern))
pattern++;
if(!ISDIGIT(*pattern)) {
endp = NULL;
goto fail;
}
errno = 0;
max_n = strtoul(pattern, &endp, 10);
if(errno || (*endp == ':')) {
pattern = endp+1;
errno = 0;
step_n = strtoul(pattern, &endp, 10);
if(errno)
/* over/underflow situation */
endp = NULL;
}
else
step_n = 1;
if(endp && (*endp == ']')) {
pattern= endp+1;
}
else
endp = NULL;
}
}
fail:
*posp += (pattern - *patternp);
if(!endp || (min_n > max_n) || (step_n > (max_n - min_n)) || !step_n)
/* the pattern is not well-formed */
return GLOBERROR("bad range", *posp, CURLE_URL_MALFORMAT);
/* typecasting to ints are fine here since we make sure above that we
are within 31 bits */
pat->content.NumRange.ptr_n = pat->content.NumRange.min_n = min_n;
pat->content.NumRange.max_n = max_n;
pat->content.NumRange.step = step_n;
if(multiply(amount, (pat->content.NumRange.max_n -
pat->content.NumRange.min_n) /
pat->content.NumRange.step + 1) )
return GLOBERROR("range overflow", *posp, CURLE_URL_MALFORMAT);
}
else
return GLOBERROR("bad range specification", *posp, CURLE_URL_MALFORMAT);
*patternp = pattern;
return CURLE_OK;
}
static bool peek_ipv6(const char *str, size_t *skip)
{
/*
* Scan for a potential IPv6 literal.
* - Valid globs contain a hyphen and <= 1 colon.
* - IPv6 literals contain no hyphens and >= 2 colons.
*/
size_t i = 0;
size_t colons = 0;
if(str[i++] != '[') {
return FALSE;
}
for(;;) {
const char c = str[i++];
if(ISALNUM(c) || c == '.' || c == '%') {
/* ok */
}
else if(c == ':') {
colons++;
}
else if(c == ']') {
*skip = i;
return colons >= 2 ? TRUE : FALSE;
}
else {
return FALSE;
}
}
}
static CURLcode glob_parse(URLGlob *glob, char *pattern,
size_t pos, unsigned long *amount)
{
/* processes a literal string component of a URL
special characters '{' and '[' branch to set/range processing functions
*/
CURLcode res = CURLE_OK;
int globindex = 0; /* count "actual" globs */
*amount = 1;
while(*pattern && !res) {
char *buf = glob->glob_buffer;
size_t sublen = 0;
while(*pattern && *pattern != '{') {
if(*pattern == '[') {
/* Skip over potential IPv6 literals. */
size_t skip;
if(peek_ipv6(pattern, &skip)) {
memcpy(buf, pattern, skip);
buf += skip;
pattern += skip;
sublen += skip;
continue;
}
break;
}
if(*pattern == '}' || *pattern == ']')
return GLOBERROR("unmatched close brace/bracket", pos,
CURLE_URL_MALFORMAT);
/* only allow \ to escape known "special letters" */
if(*pattern == '\\' &&
(*(pattern+1) == '{' || *(pattern+1) == '[' ||
*(pattern+1) == '}' || *(pattern+1) == ']') ) {
/* escape character, skip '\' */
++pattern;
++pos;
}
*buf++ = *pattern++; /* copy character to literal */
++pos;
sublen++;
}
if(sublen) {
/* we got a literal string, add it as a single-item list */
*buf = '\0';
res = glob_fixed(glob, glob->glob_buffer, sublen);
}
else {
switch (*pattern) {
case '\0': /* done */
break;
case '{':
/* process set pattern */
pattern++;
pos++;
res = glob_set(glob, &pattern, &pos, amount, globindex++);
break;
case '[':
/* process range pattern */
pattern++;
pos++;
res = glob_range(glob, &pattern, &pos, amount, globindex++);
break;
}
}
if(++glob->size >= GLOB_PATTERN_NUM)
return GLOBERROR("too many globs", pos, CURLE_URL_MALFORMAT);
}
return res;
}
CURLcode glob_url(URLGlob **glob, char *url, unsigned long *urlnum,
FILE *error)
{
/*
* We can deal with any-size, just make a buffer with the same length
* as the specified URL!
*/
URLGlob *glob_expand;
unsigned long amount = 0;
char *glob_buffer;
CURLcode res;
*glob = NULL;
glob_buffer = malloc(strlen(url) + 1);
if(!glob_buffer)
return CURLE_OUT_OF_MEMORY;
glob_buffer[0]=0;
glob_expand = calloc(1, sizeof(URLGlob));
if(!glob_expand) {
Curl_safefree(glob_buffer);
return CURLE_OUT_OF_MEMORY;
}
glob_expand->urllen = strlen(url);
glob_expand->glob_buffer = glob_buffer;
res = glob_parse(glob_expand, url, 1, &amount);
if(!res)
*urlnum = amount;
else {
if(error && glob_expand->error) {
char text[128];
const char *t;
if(glob_expand->pos) {
snprintf(text, sizeof(text), "%s in column %zu", glob_expand->error,
glob_expand->pos);
t = text;
}
else
t = glob_expand->error;
/* send error description to the error-stream */
fprintf(error, "curl: (%d) [globbing] %s\n", res, t);
}
/* it failed, we cleanup */
glob_cleanup(glob_expand);
*urlnum = 1;
return res;
}
*glob = glob_expand;
return CURLE_OK;
}
void glob_cleanup(URLGlob* glob)
{
size_t i;
int elem;
for(i = 0; i < glob->size; i++) {
if((glob->pattern[i].type == UPTSet) &&
(glob->pattern[i].content.Set.elements)) {
for(elem = glob->pattern[i].content.Set.size - 1;
elem >= 0;
--elem) {
Curl_safefree(glob->pattern[i].content.Set.elements[elem]);
}
Curl_safefree(glob->pattern[i].content.Set.elements);
}
}
Curl_safefree(glob->glob_buffer);
Curl_safefree(glob);
}
CURLcode glob_next_url(char **globbed, URLGlob *glob)
{
URLPattern *pat;
size_t i;
size_t len;
size_t buflen = glob->urllen + 1;
char *buf = glob->glob_buffer;
*globbed = NULL;
if(!glob->beenhere)
glob->beenhere = 1;
else {
bool carry = TRUE;
/* implement a counter over the index ranges of all patterns, starting
with the rightmost pattern */
for(i = 0; carry && (i < glob->size); i++) {
carry = FALSE;
pat = &glob->pattern[glob->size - 1 - i];
switch(pat->type) {
case UPTSet:
if((pat->content.Set.elements) &&
(++pat->content.Set.ptr_s == pat->content.Set.size)) {
pat->content.Set.ptr_s = 0;
carry = TRUE;
}
break;
case UPTCharRange:
pat->content.CharRange.ptr_c =
(char)(pat->content.CharRange.step +
(int)((unsigned char)pat->content.CharRange.ptr_c));
if(pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) {
pat->content.CharRange.ptr_c = pat->content.CharRange.min_c;
carry = TRUE;
}
break;
case UPTNumRange:
pat->content.NumRange.ptr_n += pat->content.NumRange.step;
if(pat->content.NumRange.ptr_n > pat->content.NumRange.max_n) {
pat->content.NumRange.ptr_n = pat->content.NumRange.min_n;
carry = TRUE;
}
break;
default:
printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
return CURLE_FAILED_INIT;
}
}
if(carry) { /* first pattern ptr has run into overflow, done! */
/* TODO: verify if this should actally return CURLE_OK. */
return CURLE_OK; /* CURLE_OK to match previous behavior */
}
}
for(i = 0; i < glob->size; ++i) {
pat = &glob->pattern[i];
switch(pat->type) {
case UPTSet:
if(pat->content.Set.elements) {
snprintf(buf, buflen, "%s",
pat->content.Set.elements[pat->content.Set.ptr_s]);
len = strlen(buf);
buf += len;
buflen -= len;
}
break;
case UPTCharRange:
if(buflen) {
*buf++ = pat->content.CharRange.ptr_c;
*buf = '\0';
buflen--;
}
break;
case UPTNumRange:
snprintf(buf, buflen, "%0*ld",
pat->content.NumRange.padlength,
pat->content.NumRange.ptr_n);
len = strlen(buf);
buf += len;
buflen -= len;
break;
default:
printf("internal error: invalid pattern type (%d)\n", (int)pat->type);
return CURLE_FAILED_INIT;
}
}
*globbed = strdup(glob->glob_buffer);
if(!*globbed)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
}
CURLcode glob_match_url(char **result, char *filename, URLGlob *glob)
{
char *target;
size_t allocsize;
char numbuf[18];
char *appendthis = NULL;
size_t appendlen = 0;
size_t stringlen = 0;
*result = NULL;
/* We cannot use the glob_buffer for storage here since the filename may
* be longer than the URL we use. We allocate a good start size, then
* we need to realloc in case of need.
*/
allocsize = strlen(filename) + 1; /* make it at least one byte to store the
trailing zero */
target = malloc(allocsize);
if(!target)
return CURLE_OUT_OF_MEMORY;
while(*filename) {
if(*filename == '#' && ISDIGIT(filename[1])) {
unsigned long i;
char *ptr = filename;
unsigned long num = strtoul(&filename[1], &filename, 10);
URLPattern *pat =NULL;
if(num < glob->size) {
num--; /* make it zero based */
/* find the correct glob entry */
for(i=0; i<glob->size; i++) {
if(glob->pattern[i].globindex == (int)num) {
pat = &glob->pattern[i];
break;
}
}
}
if(pat) {
switch(pat->type) {
case UPTSet:
if(pat->content.Set.elements) {
appendthis = pat->content.Set.elements[pat->content.Set.ptr_s];
appendlen =
strlen(pat->content.Set.elements[pat->content.Set.ptr_s]);
}
break;
case UPTCharRange:
numbuf[0] = pat->content.CharRange.ptr_c;
numbuf[1] = 0;
appendthis = numbuf;
appendlen = 1;
break;
case UPTNumRange:
snprintf(numbuf, sizeof(numbuf), "%0*d",
pat->content.NumRange.padlength,
pat->content.NumRange.ptr_n);
appendthis = numbuf;
appendlen = strlen(numbuf);
break;
default:
fprintf(stderr, "internal error: invalid pattern type (%d)\n",
(int)pat->type);
Curl_safefree(target);
return CURLE_FAILED_INIT;
}
}
else {
/* #[num] out of range, use the #[num] in the output */
filename = ptr;
appendthis = filename++;
appendlen = 1;
}
}
else {
appendthis = filename++;
appendlen = 1;
}
if(appendlen + stringlen >= allocsize) {
char *newstr;
/* we append a single byte to allow for the trailing byte to be appended
at the end of this function outside the while() loop */
allocsize = (appendlen + stringlen) * 2;
newstr = realloc(target, allocsize + 1);
if(!newstr) {
Curl_safefree(target);
return CURLE_OUT_OF_MEMORY;
}
target = newstr;
}
memcpy(&target[stringlen], appendthis, appendlen);
stringlen += appendlen;
}
target[stringlen]= '\0';
#if defined(MSDOS) || defined(WIN32)
{
char *sanitized;
SANITIZEcode sc = sanitize_file_name(&sanitized, target,
(SANITIZE_ALLOW_PATH |
SANITIZE_ALLOW_RESERVED));
Curl_safefree(target);
if(sc)
return CURLE_URL_MALFORMAT;
target = sanitized;
}
#endif /* MSDOS || WIN32 */
*result = target;
return CURLE_OK;
}

View File

@@ -0,0 +1,77 @@
#ifndef HEADER_CURL_TOOL_URLGLOB_H
#define HEADER_CURL_TOOL_URLGLOB_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
typedef enum {
UPTSet = 1,
UPTCharRange,
UPTNumRange
} URLPatternType;
typedef struct {
URLPatternType type;
int globindex; /* the number of this particular glob or -1 if not used
within {} or [] */
union {
struct {
char **elements;
int size;
int ptr_s;
} Set;
struct {
char min_c;
char max_c;
char ptr_c;
int step;
} CharRange;
struct {
unsigned long min_n;
unsigned long max_n;
int padlength;
unsigned long ptr_n;
unsigned long step;
} NumRange;
} content;
} URLPattern;
/* the total number of globs supported */
#define GLOB_PATTERN_NUM 100
typedef struct {
URLPattern pattern[GLOB_PATTERN_NUM];
size_t size;
size_t urllen;
char *glob_buffer;
char beenhere;
const char *error; /* error message */
size_t pos; /* column position of error or 0 */
} URLGlob;
CURLcode glob_url(URLGlob**, char *, unsigned long *, FILE *);
CURLcode glob_next_url(char **, URLGlob *);
CURLcode glob_match_url(char **, char *, URLGlob *);
void glob_cleanup(URLGlob* glob);
#endif /* HEADER_CURL_TOOL_URLGLOB_H */

147
3rd-party/curl-7.52.1/src/tool_util.c vendored Normal file
View File

@@ -0,0 +1,147 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_util.h"
#include "memdebug.h" /* keep this as LAST include */
#if defined(WIN32) && !defined(MSDOS)
struct timeval tool_tvnow(void)
{
/*
** GetTickCount() is available on _all_ Windows versions from W95 up
** to nowadays. Returns milliseconds elapsed since last system boot,
** increases monotonically and wraps once 49.7 days have elapsed.
**
** GetTickCount64() is available on Windows version from Windows Vista
** and Windows Server 2008 up to nowadays. The resolution of the
** function is limited to the resolution of the system timer, which
** is typically in the range of 10 milliseconds to 16 milliseconds.
*/
struct timeval now;
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
ULONGLONG milliseconds = GetTickCount64();
#else
DWORD milliseconds = GetTickCount();
#endif
now.tv_sec = (long)(milliseconds / 1000);
now.tv_usec = (milliseconds % 1000) * 1000;
return now;
}
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
struct timeval tool_tvnow(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
** monotonic clock is queried. Time starting point is unspecified, it
** could be the system start-up time, the Epoch, or something else,
** in any case the time starting point does not change once that the
** system has started up.
*/
struct timeval now;
struct timespec tsnow;
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
now.tv_sec = tsnow.tv_sec;
now.tv_usec = tsnow.tv_nsec / 1000;
}
/*
** Even when the configure process has truly detected monotonic clock
** availability, it might happen that it is not actually available at
** run-time. When this occurs simply fallback to other time source.
*/
#ifdef HAVE_GETTIMEOFDAY
else
(void)gettimeofday(&now, NULL);
#else
else {
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
}
#endif
return now;
}
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval tool_tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
** clock drifting and external source time synchronization it can jump
** forward or backward in time.
*/
struct timeval now;
(void)gettimeofday(&now, NULL);
return now;
}
#else
struct timeval tool_tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
*/
struct timeval now;
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
return now;
}
#endif
/*
* Make sure that the first argument is the more recent time, as otherwise
* we'll get a weird negative time-diff back...
*
* Returns: the time difference in number of milliseconds.
*/
long tool_tvdiff(struct timeval newer, struct timeval older)
{
return (newer.tv_sec-older.tv_sec)*1000+
(newer.tv_usec-older.tv_usec)/1000;
}
/*
* Same as tool_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double tool_tvdiff_secs(struct timeval newer, struct timeval older)
{
if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0;
else
return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
}
/* return the number of seconds in the given input timeval struct */
long tool_tvlong(struct timeval t1)
{
return t1.tv_sec;
}

56
3rd-party/curl-7.52.1/src/tool_util.h vendored Normal file
View File

@@ -0,0 +1,56 @@
#ifndef HEADER_CURL_TOOL_UTIL_H
#define HEADER_CURL_TOOL_UTIL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
struct timeval tool_tvnow(void);
/*
* Make sure that the first argument (t1) is the more recent time and t2 is
* the older time, as otherwise you get a weird negative time-diff back...
*
* Returns: the time difference in number of milliseconds.
*/
long tool_tvdiff(struct timeval t1, struct timeval t2);
/*
* Same as tool_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double tool_tvdiff_secs(struct timeval t1, struct timeval t2);
long tool_tvlong(struct timeval t1);
#undef tvnow
#undef tvdiff
#undef tvdiff_secs
#undef tvlong
#define tvnow() tool_tvnow()
#define tvdiff(a,b) tool_tvdiff((a), (b))
#define tvdiff_secs(a,b) tool_tvdiff_secs((a), (b))
#define tvlong(a) tool_tvlong((a))
#endif /* HEADER_CURL_TOOL_UTIL_H */

View File

@@ -0,0 +1,34 @@
#ifndef HEADER_CURL_TOOL_VERSION_H
#define HEADER_CURL_TOOL_VERSION_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include <curl/curlver.h>
#define CURL_NAME "curl"
#define CURL_COPYRIGHT LIBCURL_COPYRIGHT
#define CURL_VERSION "7.52.1"
#define CURL_VERSION_MAJOR LIBCURL_VERSION_MAJOR
#define CURL_VERSION_MINOR LIBCURL_VERSION_MINOR
#define CURL_VERSION_PATCH LIBCURL_VERSION_PATCH
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
#endif /* HEADER_CURL_TOOL_VERSION_H */

219
3rd-party/curl-7.52.1/src/tool_vms.c vendored Normal file
View File

@@ -0,0 +1,219 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#ifdef __VMS
#if defined(__DECC) && !defined(__VAX) && \
defined(__CRTL_VER) && (__CRTL_VER >= 70301000)
#include <unixlib.h>
#endif
#define ENABLE_CURLX_PRINTF
#include "curlx.h"
#include "curlmsg_vms.h"
#include "tool_vms.h"
#include "memdebug.h" /* keep this as LAST include */
void decc$__posix_exit(int __status);
void decc$exit(int __status);
static int vms_shell = -1;
/* VMS has a DCL shell and and also has Unix shells ported to it.
* When curl is running under a Unix shell, we want it to be as much
* like Unix as possible.
*/
int is_vms_shell(void)
{
char *shell;
/* Have we checked the shell yet? */
if(vms_shell >= 0)
return vms_shell;
shell = getenv("SHELL");
/* No shell, means DCL */
if(shell == NULL) {
vms_shell = 1;
return 1;
}
/* Have to make sure some one did not set shell to DCL */
if(strcmp(shell, "DCL") == 0) {
vms_shell = 1;
return 1;
}
vms_shell = 0;
return 0;
}
/*
* VMS has two exit() routines. When running under a Unix style shell, then
* Unix style and the __posix_exit() routine is used.
*
* When running under the DCL shell, then the VMS encoded codes and decc$exit()
* is used.
*
* We can not use exit() or return a code from main() because the actual
* routine called depends on both the compiler version, compile options, and
* feature macro settings, and one of the exit routines is hidden at compile
* time.
*
* Since we want Curl to work properly under the VMS DCL shell and Unix
* shells under VMS, this routine should compile correctly regardless of
* the settings.
*/
void vms_special_exit(int code, int vms_show)
{
int vms_code;
/* The Posix exit mode is only available after VMS 7.0 */
#if __CRTL_VER >= 70000000
if(is_vms_shell() == 0) {
decc$__posix_exit(code);
}
#endif
if(code > CURL_LAST) { /* If CURL_LAST exceeded then */
vms_code = CURL_LAST; /* curlmsg.h is out of sync. */
}
else {
vms_code = vms_cond[code] | vms_show;
}
decc$exit(vms_code);
}
#if defined(__DECC) && !defined(__VAX) && \
defined(__CRTL_VER) && (__CRTL_VER >= 70301000)
/*
* 2004-09-19 SMS.
*
* decc_init()
*
* On non-VAX systems, use LIB$INITIALIZE to set a collection of C
* RTL features without using the DECC$* logical name method, nor
* requiring the user to define the corresponding logical names.
*/
/* Structure to hold a DECC$* feature name and its desired value. */
typedef struct {
char *name;
int value;
} decc_feat_t;
/* Array of DECC$* feature names and their desired values. */
static decc_feat_t decc_feat_array[] = {
/* Preserve command-line case with SET PROCESS/PARSE_STYLE=EXTENDED */
{ "DECC$ARGV_PARSE_STYLE", 1 },
/* Preserve case for file names on ODS5 disks. */
{ "DECC$EFS_CASE_PRESERVE", 1 },
/* Enable multiple dots (and most characters) in ODS5 file names,
while preserving VMS-ness of ";version". */
{ "DECC$EFS_CHARSET", 1 },
/* List terminator. */
{ (char *)NULL, 0 }
};
/* Flag to sense if decc_init() was called. */
static int decc_init_done = -1;
/* LIB$INITIALIZE initialization function. */
static void decc_init(void)
{
int feat_index;
int feat_value;
int feat_value_max;
int feat_value_min;
int i;
int sts;
/* Set the global flag to indicate that LIB$INITIALIZE worked. */
decc_init_done = 1;
/* Loop through all items in the decc_feat_array[]. */
for(i = 0; decc_feat_array[i].name != NULL; i++) {
/* Get the feature index. */
feat_index = decc$feature_get_index(decc_feat_array[i].name);
if(feat_index >= 0) {
/* Valid item. Collect its properties. */
feat_value = decc$feature_get_value(feat_index, 1);
feat_value_min = decc$feature_get_value(feat_index, 2);
feat_value_max = decc$feature_get_value(feat_index, 3);
if((decc_feat_array[i].value >= feat_value_min) &&
(decc_feat_array[i].value <= feat_value_max)) {
/* Valid value. Set it if necessary. */
if(feat_value != decc_feat_array[i].value) {
sts = decc$feature_set_value(feat_index, 1,
decc_feat_array[i].value);
}
}
else {
/* Invalid DECC feature value. */
printf(" INVALID DECC FEATURE VALUE, %d: %d <= %s <= %d.\n",
feat_value,
feat_value_min, decc_feat_array[i].name, feat_value_max);
}
}
else {
/* Invalid DECC feature name. */
printf(" UNKNOWN DECC FEATURE: %s.\n", decc_feat_array[i].name);
}
}
}
/* Get "decc_init()" into a valid, loaded LIB$INITIALIZE PSECT. */
#pragma nostandard
/* Establish the LIB$INITIALIZE PSECTs, with proper alignment and
other attributes. Note that "nopic" is significant only on VAX. */
#pragma extern_model save
#pragma extern_model strict_refdef "LIB$INITIALIZ" 2, nopic, nowrt
const int spare[8] = {0};
#pragma extern_model strict_refdef "LIB$INITIALIZE" 2, nopic, nowrt
void (*const x_decc_init)() = decc_init;
#pragma extern_model restore
/* Fake reference to ensure loading the LIB$INITIALIZE PSECT. */
#pragma extern_model save
int LIB$INITIALIZE(void);
#pragma extern_model strict_refdef
int dmy_lib$initialize = (int) LIB$INITIALIZE;
#pragma extern_model restore
#pragma standard
#endif /* __DECC && !__VAX && __CRTL_VER && __CRTL_VER >= 70301000 */
#endif /* __VMS */

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