init repo.
This commit is contained in:
83
third_party/curl/scripts/Makefile.am
vendored
Normal file
83
third_party/curl/scripts/Makefile.am
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \
|
||||
mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
|
||||
dmaketgz
|
||||
|
||||
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||
PERL = @PERL@
|
||||
|
||||
if USE_ZSH_COMPLETION
|
||||
ZSH_COMPLETION_FUNCTION_FILENAME = _curl
|
||||
endif
|
||||
if USE_FISH_COMPLETION
|
||||
FISH_COMPLETION_FUNCTION_FILENAME = curl.fish
|
||||
endif
|
||||
|
||||
CLEANFILES = $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
|
||||
all-local: $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
|
||||
if USE_ZSH_COMPLETION
|
||||
$(ZSH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't generate zsh completion when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
if test -z "$(PERL)"; then echo "No perl: can't install completion script"; else \
|
||||
$(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell zsh > $@ ; fi
|
||||
endif
|
||||
endif
|
||||
|
||||
if USE_FISH_COMPLETION
|
||||
$(FISH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't generate fish completion when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
if test -z "$(PERL)"; then echo "No perl: can't install completion script"; else \
|
||||
$(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell fish > $@ ; fi
|
||||
endif
|
||||
endif
|
||||
|
||||
install-data-local:
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't install completion scripts when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
if USE_ZSH_COMPLETION
|
||||
if test -n "$(PERL)"; then \
|
||||
$(MKDIR_P) $(DESTDIR)$(ZSH_FUNCTIONS_DIR); \
|
||||
$(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(ZSH_FUNCTIONS_DIR)/$(ZSH_COMPLETION_FUNCTION_FILENAME) ; \
|
||||
fi
|
||||
endif
|
||||
if USE_FISH_COMPLETION
|
||||
if test -n "$(PERL)"; then \
|
||||
$(MKDIR_P) $(DESTDIR)$(FISH_FUNCTIONS_DIR); \
|
||||
$(INSTALL_DATA) $(FISH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(FISH_FUNCTIONS_DIR)/$(FISH_COMPLETION_FUNCTION_FILENAME) ; \
|
||||
fi
|
||||
endif
|
||||
endif
|
||||
|
||||
distclean:
|
||||
rm -f $(CLEANFILES)
|
624
third_party/curl/scripts/Makefile.in
vendored
Normal file
624
third_party/curl/scripts/Makefile.in
vendored
Normal file
@ -0,0 +1,624 @@
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = scripts
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/curl-amissl.m4 \
|
||||
$(top_srcdir)/m4/curl-bearssl.m4 \
|
||||
$(top_srcdir)/m4/curl-compilers.m4 \
|
||||
$(top_srcdir)/m4/curl-confopts.m4 \
|
||||
$(top_srcdir)/m4/curl-functions.m4 \
|
||||
$(top_srcdir)/m4/curl-gnutls.m4 \
|
||||
$(top_srcdir)/m4/curl-mbedtls.m4 \
|
||||
$(top_srcdir)/m4/curl-openssl.m4 \
|
||||
$(top_srcdir)/m4/curl-override.m4 \
|
||||
$(top_srcdir)/m4/curl-reentrant.m4 \
|
||||
$(top_srcdir)/m4/curl-rustls.m4 \
|
||||
$(top_srcdir)/m4/curl-schannel.m4 \
|
||||
$(top_srcdir)/m4/curl-sectransp.m4 \
|
||||
$(top_srcdir)/m4/curl-sysconfig.m4 \
|
||||
$(top_srcdir)/m4/curl-wolfssl.m4 $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/m4/xc-am-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-cc-check.m4 \
|
||||
$(top_srcdir)/m4/xc-lt-iface.m4 \
|
||||
$(top_srcdir)/m4/xc-translit.m4 \
|
||||
$(top_srcdir)/m4/xc-val-flgs.m4 \
|
||||
$(top_srcdir)/m4/zz40-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz50-xc-ovr.m4 \
|
||||
$(top_srcdir)/m4/zz60-xc-ovr.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/lib/curl_config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
APACHECTL = @APACHECTL@
|
||||
APXS = @APXS@
|
||||
AR = @AR@
|
||||
AR_FLAGS = @AR_FLAGS@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BLANK_AT_MAKETIME = @BLANK_AT_MAKETIME@
|
||||
CADDY = @CADDY@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAG_CURL_SYMBOL_HIDING = @CFLAG_CURL_SYMBOL_HIDING@
|
||||
CONFIGURE_OPTIONS = @CONFIGURE_OPTIONS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CPPFLAG_CURL_STATICLIB = @CPPFLAG_CURL_STATICLIB@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CURLVERSION = @CURLVERSION@
|
||||
CURL_CA_BUNDLE = @CURL_CA_BUNDLE@
|
||||
CURL_CFLAG_EXTRAS = @CURL_CFLAG_EXTRAS@
|
||||
CURL_DISABLE_DICT = @CURL_DISABLE_DICT@
|
||||
CURL_DISABLE_FILE = @CURL_DISABLE_FILE@
|
||||
CURL_DISABLE_FTP = @CURL_DISABLE_FTP@
|
||||
CURL_DISABLE_GOPHER = @CURL_DISABLE_GOPHER@
|
||||
CURL_DISABLE_HTTP = @CURL_DISABLE_HTTP@
|
||||
CURL_DISABLE_IMAP = @CURL_DISABLE_IMAP@
|
||||
CURL_DISABLE_LDAP = @CURL_DISABLE_LDAP@
|
||||
CURL_DISABLE_LDAPS = @CURL_DISABLE_LDAPS@
|
||||
CURL_DISABLE_MQTT = @CURL_DISABLE_MQTT@
|
||||
CURL_DISABLE_POP3 = @CURL_DISABLE_POP3@
|
||||
CURL_DISABLE_PROXY = @CURL_DISABLE_PROXY@
|
||||
CURL_DISABLE_RTSP = @CURL_DISABLE_RTSP@
|
||||
CURL_DISABLE_SMB = @CURL_DISABLE_SMB@
|
||||
CURL_DISABLE_SMTP = @CURL_DISABLE_SMTP@
|
||||
CURL_DISABLE_TELNET = @CURL_DISABLE_TELNET@
|
||||
CURL_DISABLE_TFTP = @CURL_DISABLE_TFTP@
|
||||
CURL_LT_SHLIB_VERSIONED_FLAVOUR = @CURL_LT_SHLIB_VERSIONED_FLAVOUR@
|
||||
CURL_NETWORK_AND_TIME_LIBS = @CURL_NETWORK_AND_TIME_LIBS@
|
||||
CURL_NETWORK_LIBS = @CURL_NETWORK_LIBS@
|
||||
CURL_WITH_MULTI_SSL = @CURL_WITH_MULTI_SSL@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFAULT_SSL_BACKEND = @DEFAULT_SSL_BACKEND@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
ENABLE_STATIC = @ENABLE_STATIC@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||
GCOV = @GCOV@
|
||||
GREP = @GREP@
|
||||
HAVE_BROTLI = @HAVE_BROTLI@
|
||||
HAVE_GNUTLS_SRP = @HAVE_GNUTLS_SRP@
|
||||
HAVE_LDAP_SSL = @HAVE_LDAP_SSL@
|
||||
HAVE_LIBZ = @HAVE_LIBZ@
|
||||
HAVE_OPENSSL_QUIC = @HAVE_OPENSSL_QUIC@
|
||||
HAVE_OPENSSL_SRP = @HAVE_OPENSSL_SRP@
|
||||
HAVE_PROTO_BSDSOCKET_H = @HAVE_PROTO_BSDSOCKET_H@
|
||||
HAVE_ZSTD = @HAVE_ZSTD@
|
||||
HTTPD = @HTTPD@
|
||||
HTTPD_NGHTTPX = @HTTPD_NGHTTPX@
|
||||
IDN_ENABLED = @IDN_ENABLED@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
IPV6_ENABLED = @IPV6_ENABLED@
|
||||
LCOV = @LCOV@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCURL_LIBS = @LIBCURL_LIBS@
|
||||
LIBCURL_NO_SHARED = @LIBCURL_NO_SHARED@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKGADD_NAME = @PKGADD_NAME@
|
||||
PKGADD_PKG = @PKGADD_PKG@
|
||||
PKGADD_VENDOR = @PKGADD_VENDOR@
|
||||
PKGCONFIG = @PKGCONFIG@
|
||||
RANDOM_FILE = @RANDOM_FILE@
|
||||
RANLIB = @RANLIB@
|
||||
RC = @RC@
|
||||
REQUIRE_LIB_DEPS = @REQUIRE_LIB_DEPS@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SSL_BACKENDS = @SSL_BACKENDS@
|
||||
SSL_ENABLED = @SSL_ENABLED@
|
||||
SSL_LIBS = @SSL_LIBS@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT_FEATURES = @SUPPORT_FEATURES@
|
||||
SUPPORT_PROTOCOLS = @SUPPORT_PROTOCOLS@
|
||||
TEST_NGHTTPX = @TEST_NGHTTPX@
|
||||
USE_ARES = @USE_ARES@
|
||||
USE_BEARSSL = @USE_BEARSSL@
|
||||
USE_GNUTLS = @USE_GNUTLS@
|
||||
USE_HYPER = @USE_HYPER@
|
||||
USE_LIBPSL = @USE_LIBPSL@
|
||||
USE_LIBRTMP = @USE_LIBRTMP@
|
||||
USE_LIBSSH = @USE_LIBSSH@
|
||||
USE_LIBSSH2 = @USE_LIBSSH2@
|
||||
USE_MBEDTLS = @USE_MBEDTLS@
|
||||
USE_MSH3 = @USE_MSH3@
|
||||
USE_NGHTTP2 = @USE_NGHTTP2@
|
||||
USE_NGHTTP3 = @USE_NGHTTP3@
|
||||
USE_NGTCP2 = @USE_NGTCP2@
|
||||
USE_NGTCP2_CRYPTO_BORINGSSL = @USE_NGTCP2_CRYPTO_BORINGSSL@
|
||||
USE_NGTCP2_CRYPTO_GNUTLS = @USE_NGTCP2_CRYPTO_GNUTLS@
|
||||
USE_NGTCP2_CRYPTO_QUICTLS = @USE_NGTCP2_CRYPTO_QUICTLS@
|
||||
USE_NGTCP2_CRYPTO_WOLFSSL = @USE_NGTCP2_CRYPTO_WOLFSSL@
|
||||
USE_NGTCP2_H3 = @USE_NGTCP2_H3@
|
||||
USE_OPENLDAP = @USE_OPENLDAP@
|
||||
USE_OPENSSL_H3 = @USE_OPENSSL_H3@
|
||||
USE_OPENSSL_QUIC = @USE_OPENSSL_QUIC@
|
||||
USE_QUICHE = @USE_QUICHE@
|
||||
USE_RUSTLS = @USE_RUSTLS@
|
||||
USE_SCHANNEL = @USE_SCHANNEL@
|
||||
USE_SECTRANSP = @USE_SECTRANSP@
|
||||
USE_UNIX_SOCKETS = @USE_UNIX_SOCKETS@
|
||||
USE_WIN32_CRYPTO = @USE_WIN32_CRYPTO@
|
||||
USE_WIN32_LARGE_FILES = @USE_WIN32_LARGE_FILES@
|
||||
USE_WIN32_SMALL_FILES = @USE_WIN32_SMALL_FILES@
|
||||
USE_WINDOWS_SSPI = @USE_WINDOWS_SSPI@
|
||||
USE_WOLFSSH = @USE_WOLFSSH@
|
||||
USE_WOLFSSL = @USE_WOLFSSL@
|
||||
VERSION = @VERSION@
|
||||
VERSIONNUM = @VERSIONNUM@
|
||||
VSFTPD = @VSFTPD@
|
||||
ZLIB_LIBS = @ZLIB_LIBS@
|
||||
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libext = @libext@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl \
|
||||
mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
|
||||
dmaketgz
|
||||
|
||||
@USE_ZSH_COMPLETION_TRUE@ZSH_COMPLETION_FUNCTION_FILENAME = _curl
|
||||
@USE_FISH_COMPLETION_TRUE@FISH_COMPLETION_FUNCTION_FILENAME = curl.fish
|
||||
CLEANFILES = $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu scripts/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile all-local
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-data-local
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am all-local check check-am clean clean-generic \
|
||||
clean-libtool cscopelist-am ctags-am distclean \
|
||||
distclean-generic distclean-libtool distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-data-local install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
|
||||
uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
all-local: $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
|
||||
@USE_ZSH_COMPLETION_TRUE@$(ZSH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
@CROSSCOMPILING_TRUE@@USE_ZSH_COMPLETION_TRUE@ @echo "NOTICE: we can't generate zsh completion when cross-compiling!"
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ if test -z "$(PERL)"; then echo "No perl: can't install completion script"; else \
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ $(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell zsh > $@ ; fi
|
||||
|
||||
@USE_FISH_COMPLETION_TRUE@$(FISH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
@CROSSCOMPILING_TRUE@@USE_FISH_COMPLETION_TRUE@ @echo "NOTICE: we can't generate fish completion when cross-compiling!"
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ if test -z "$(PERL)"; then echo "No perl: can't install completion script"; else \
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ $(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell fish > $@ ; fi
|
||||
|
||||
install-data-local:
|
||||
@CROSSCOMPILING_TRUE@ @echo "NOTICE: we can't install completion scripts when cross-compiling!"
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ if test -n "$(PERL)"; then \
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ $(MKDIR_P) $(DESTDIR)$(ZSH_FUNCTIONS_DIR); \
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ $(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(ZSH_FUNCTIONS_DIR)/$(ZSH_COMPLETION_FUNCTION_FILENAME) ; \
|
||||
@CROSSCOMPILING_FALSE@@USE_ZSH_COMPLETION_TRUE@ fi
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ if test -n "$(PERL)"; then \
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ $(MKDIR_P) $(DESTDIR)$(FISH_FUNCTIONS_DIR); \
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ $(INSTALL_DATA) $(FISH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(FISH_FUNCTIONS_DIR)/$(FISH_COMPLETION_FUNCTION_FILENAME) ; \
|
||||
@CROSSCOMPILING_FALSE@@USE_FISH_COMPLETION_TRUE@ fi
|
||||
|
||||
distclean:
|
||||
rm -f $(CLEANFILES)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
226
third_party/curl/scripts/cd2cd
vendored
Executable file
226
third_party/curl/scripts/cd2cd
vendored
Executable file
@ -0,0 +1,226 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
=begin comment
|
||||
|
||||
This script updates a curldown file to current/better curldown.
|
||||
|
||||
Example: cd2cd [--in-place] <file.md> > <file.md>
|
||||
|
||||
--in-place: if used, it replaces the original file with the cleaned up
|
||||
version. When this is used, cd2cd accepts multiple files to work
|
||||
on and it ignores errors on single files.
|
||||
|
||||
=end comment
|
||||
=cut
|
||||
|
||||
my $cd2cd = "0.1"; # to keep check
|
||||
my $dir;
|
||||
my $extension;
|
||||
my $inplace = 0;
|
||||
|
||||
while(1) {
|
||||
if($ARGV[0] eq "--in-place") {
|
||||
shift @ARGV;
|
||||
$inplace = 1;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
use POSIX qw(strftime);
|
||||
my @ts;
|
||||
if (defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
@ts = localtime($ENV{SOURCE_DATE_EPOCH});
|
||||
} else {
|
||||
@ts = localtime;
|
||||
}
|
||||
my $date = strftime "%B %d %Y", @ts;
|
||||
|
||||
sub outseealso {
|
||||
my (@sa) = @_;
|
||||
my $comma = 0;
|
||||
my @o;
|
||||
push @o, ".SH SEE ALSO\n";
|
||||
for my $s (sort @sa) {
|
||||
push @o, sprintf "%s.BR $s", $comma ? ",\n": "";
|
||||
$comma = 1;
|
||||
}
|
||||
push @o, "\n";
|
||||
return @o;
|
||||
}
|
||||
|
||||
sub single {
|
||||
my @head;
|
||||
my @seealso;
|
||||
my ($f)=@_;
|
||||
my $title;
|
||||
my $section;
|
||||
my $source;
|
||||
my $start = 0;
|
||||
my $d;
|
||||
my $line = 0;
|
||||
open(F, "<:crlf", "$f") ||
|
||||
return 1;
|
||||
while(<F>) {
|
||||
$line++;
|
||||
$d = $_;
|
||||
if(!$start) {
|
||||
if(/^---/) {
|
||||
# header starts here
|
||||
$start = 1;
|
||||
push @head, $d;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if(/^Title: *(.*)/i) {
|
||||
$title=$1;
|
||||
}
|
||||
elsif(/^Section: *(.*)/i) {
|
||||
$section=$1;
|
||||
}
|
||||
elsif(/^Source: *(.*)/i) {
|
||||
$source=$1;
|
||||
}
|
||||
elsif(/^See-also: +(.*)/i) {
|
||||
$salist = 0;
|
||||
push @seealso, $1;
|
||||
}
|
||||
elsif(/^See-also: */i) {
|
||||
if($seealso[0]) {
|
||||
print STDERR "$f:$line:1:ERROR: bad See-Also, needs list\n";
|
||||
return 2;
|
||||
}
|
||||
$salist = 1;
|
||||
}
|
||||
elsif(/^ +- (.*)/i) {
|
||||
# the only list we support is the see-also
|
||||
if($salist) {
|
||||
push @seealso, $1;
|
||||
}
|
||||
}
|
||||
# REUSE-IgnoreStart
|
||||
elsif(/^C: (.*)/i) {
|
||||
$copyright=$1;
|
||||
}
|
||||
elsif(/^SPDX-License-Identifier: (.*)/i) {
|
||||
$spdx=$1;
|
||||
}
|
||||
# REUSE-IgnoreEnd
|
||||
elsif(/^---/) {
|
||||
# end of the header section
|
||||
if(!$title) {
|
||||
print STDERR "ERROR: no 'Title:' in $f\n";
|
||||
return 1;
|
||||
}
|
||||
if(!$section) {
|
||||
print STDERR "ERROR: no 'Section:' in $f\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$seealso[0]) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'See-also:' present\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$copyright) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'C:' field present\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$spdx) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'SPDX-License-Identifier:' field present\n";
|
||||
return 2;
|
||||
}
|
||||
last;
|
||||
}
|
||||
else {
|
||||
chomp;
|
||||
print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';"
|
||||
}
|
||||
}
|
||||
|
||||
if(!$start) {
|
||||
print STDERR "$f:$line:1:ERROR: no header present\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
my @desc;
|
||||
|
||||
push @desc, sprintf <<HEAD
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: $title
|
||||
Section: $section
|
||||
Source: $source
|
||||
HEAD
|
||||
;
|
||||
push @desc, "See-also:\n";
|
||||
for my $s (sort @seealso) {
|
||||
push @desc, " - $s\n" if($s);
|
||||
}
|
||||
push @desc, "---\n";
|
||||
|
||||
my $blankline = 0;
|
||||
while(<F>) {
|
||||
$d = $_;
|
||||
$line++;
|
||||
if($d =~ /^[ \t]*\n/) {
|
||||
$blankline++;
|
||||
}
|
||||
else {
|
||||
$blankline = 0;
|
||||
}
|
||||
# *italics* for curl symbol links get the asterisks removed
|
||||
$d =~ s/\*((lib|)curl[^ ]*\(3\))\*/$1/gi;
|
||||
|
||||
if(length($d) > 90) {
|
||||
print STDERR "$f:$line:1:WARN: excessive line length\n";
|
||||
}
|
||||
|
||||
push @desc, $d if($blankline < 2);
|
||||
}
|
||||
close(F);
|
||||
|
||||
if($inplace) {
|
||||
open(O, ">$f") || return 1;
|
||||
print O @desc;
|
||||
close(O);
|
||||
}
|
||||
else {
|
||||
print @desc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($inplace) {
|
||||
for my $a (@ARGV) {
|
||||
# this ignores errors
|
||||
single($a);
|
||||
}
|
||||
}
|
||||
else {
|
||||
exit single($ARGV[0]);
|
||||
}
|
526
third_party/curl/scripts/cd2nroff
vendored
Executable file
526
third_party/curl/scripts/cd2nroff
vendored
Executable file
@ -0,0 +1,526 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
=begin comment
|
||||
|
||||
Converts a curldown file to nroff (man page).
|
||||
|
||||
=end comment
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $cd2nroff = "0.1"; # to keep check
|
||||
my $dir;
|
||||
my $extension;
|
||||
my $keepfilename;
|
||||
|
||||
while(@ARGV) {
|
||||
if($ARGV[0] eq "-d") {
|
||||
shift @ARGV;
|
||||
$dir = shift @ARGV;
|
||||
}
|
||||
elsif($ARGV[0] eq "-e") {
|
||||
shift @ARGV;
|
||||
$extension = shift @ARGV;
|
||||
}
|
||||
elsif($ARGV[0] eq "-k") {
|
||||
shift @ARGV;
|
||||
$keepfilename = 1;
|
||||
}
|
||||
elsif($ARGV[0] eq "-h") {
|
||||
print <<HELP
|
||||
Usage: cd2nroff [options] [file.md]
|
||||
|
||||
-d <dir> Write the output to the file name from the meta-data in the
|
||||
specified directory, instead of writing to stdout
|
||||
-e <ext> If -d is used, this option can provide an added "extension", arbitrary
|
||||
text really, to append to the file name.
|
||||
-h This help text,
|
||||
-v Show version then exit
|
||||
HELP
|
||||
;
|
||||
exit 0;
|
||||
}
|
||||
elsif($ARGV[0] eq "-v") {
|
||||
print "cd2nroff version $cd2nroff\n";
|
||||
exit 0;
|
||||
}
|
||||
else {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
use POSIX qw(strftime);
|
||||
my @ts;
|
||||
if (defined($ENV{SOURCE_DATE_EPOCH})) {
|
||||
@ts = gmtime($ENV{SOURCE_DATE_EPOCH});
|
||||
} else {
|
||||
@ts = localtime;
|
||||
}
|
||||
my $date = strftime "%Y-%m-%d", @ts;
|
||||
|
||||
sub outseealso {
|
||||
my (@sa) = @_;
|
||||
my $comma = 0;
|
||||
my @o;
|
||||
push @o, ".SH SEE ALSO\n";
|
||||
for my $s (sort @sa) {
|
||||
push @o, sprintf "%s.BR $s", $comma ? ",\n": "";
|
||||
$comma = 1;
|
||||
}
|
||||
push @o, "\n";
|
||||
return @o;
|
||||
}
|
||||
|
||||
sub outprotocols {
|
||||
my (@p) = @_;
|
||||
my $comma = 0;
|
||||
my @o;
|
||||
push @o, ".SH PROTOCOLS\n";
|
||||
|
||||
if($p[0] eq "TLS") {
|
||||
push @o, "All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.";
|
||||
}
|
||||
else {
|
||||
my @s = sort @p;
|
||||
for my $e (sort @s) {
|
||||
push @o, sprintf "%s$e",
|
||||
$comma ? (($e eq $s[-1]) ? " and " : ", "): "";
|
||||
$comma = 1;
|
||||
}
|
||||
}
|
||||
push @o, "\n";
|
||||
return @o;
|
||||
}
|
||||
|
||||
sub outtls {
|
||||
my (@t) = @_;
|
||||
my $comma = 0;
|
||||
my @o;
|
||||
if($t[0] eq "All") {
|
||||
push @o, "\nAll TLS backends support this option.";
|
||||
}
|
||||
else {
|
||||
push @o, "\nThis option works only with the following TLS backends:\n";
|
||||
my @s = sort @t;
|
||||
for my $e (@s) {
|
||||
push @o, sprintf "%s$e",
|
||||
$comma ? (($e eq $s[-1]) ? " and " : ", "): "";
|
||||
$comma = 1;
|
||||
}
|
||||
}
|
||||
push @o, "\n";
|
||||
return @o;
|
||||
}
|
||||
|
||||
my %knownprotos = (
|
||||
'DICT' => 1,
|
||||
'FILE' => 1,
|
||||
'FTP' => 1,
|
||||
'FTPS' => 1,
|
||||
'GOPHER' => 1,
|
||||
'GOPHERS' => 1,
|
||||
'HTTP' => 1,
|
||||
'HTTPS' => 1,
|
||||
'IMAP' => 1,
|
||||
'IMAPS' => 1,
|
||||
'LDAP' => 1,
|
||||
'LDAPS' => 1,
|
||||
'MQTT' => 1,
|
||||
'POP3' => 1,
|
||||
'POP3S' => 1,
|
||||
'RTMP' => 1,
|
||||
'RTMPS' => 1,
|
||||
'RTSP' => 1,
|
||||
'SCP' => 1,
|
||||
'SFTP' => 1,
|
||||
'SMB' => 1,
|
||||
'SMBS' => 1,
|
||||
'SMTP' => 1,
|
||||
'SMTPS' => 1,
|
||||
'TELNET' => 1,
|
||||
'TFTP' => 1,
|
||||
'WS' => 1,
|
||||
'WSS' => 1,
|
||||
'TLS' => 1,
|
||||
'TCP' => 1,
|
||||
'All' => 1
|
||||
);
|
||||
|
||||
my %knowntls = (
|
||||
'BearSSL' => 1,
|
||||
'GnuTLS' => 1,
|
||||
'mbedTLS' => 1,
|
||||
'OpenSSL' => 1,
|
||||
'rustls' => 1,
|
||||
'Schannel' => 1,
|
||||
'Secure Transport' => 1,
|
||||
'wolfSSL' => 1,
|
||||
'All' => 1,
|
||||
);
|
||||
|
||||
sub single {
|
||||
my @seealso;
|
||||
my @proto;
|
||||
my @tls;
|
||||
my $d;
|
||||
my ($f)=@_;
|
||||
my $copyright;
|
||||
my $errors = 0;
|
||||
my $fh;
|
||||
my $line;
|
||||
my $list;
|
||||
my $tlslist;
|
||||
my $section;
|
||||
my $source;
|
||||
my $spdx;
|
||||
my $start = 0;
|
||||
my $title;
|
||||
|
||||
if(defined($f)) {
|
||||
if(!open($fh, "<:crlf", "$f")) {
|
||||
print STDERR "cd2nroff failed to open '$f' for reading: $!\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$f = "STDIN";
|
||||
$fh = \*STDIN;
|
||||
binmode($fh, ":crlf");
|
||||
}
|
||||
while(<$fh>) {
|
||||
$line++;
|
||||
if(!$start) {
|
||||
if(/^---/) {
|
||||
# header starts here
|
||||
$start = 1;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if(/^Title: *(.*)/i) {
|
||||
$title=$1;
|
||||
}
|
||||
elsif(/^Section: *(.*)/i) {
|
||||
$section=$1;
|
||||
}
|
||||
elsif(/^Source: *(.*)/i) {
|
||||
$source=$1;
|
||||
}
|
||||
elsif(/^See-also: +(.*)/i) {
|
||||
$list = 1; # 1 for see-also
|
||||
push @seealso, $1;
|
||||
}
|
||||
elsif(/^See-also: */i) {
|
||||
if($seealso[0]) {
|
||||
print STDERR "$f:$line:1:ERROR: bad See-Also, needs list\n";
|
||||
return 2;
|
||||
}
|
||||
$list = 1; # 1 for see-also
|
||||
}
|
||||
elsif(/^Protocol:/i) {
|
||||
$list = 2; # 2 for protocol
|
||||
}
|
||||
elsif(/^TLS-backend:/i) {
|
||||
$list = 3; # 3 for TLS backend
|
||||
}
|
||||
elsif(/^ +- (.*)/i) {
|
||||
# the only lists we support are see-also and protocol
|
||||
if($list == 1) {
|
||||
push @seealso, $1;
|
||||
}
|
||||
elsif($list == 2) {
|
||||
push @proto, $1;
|
||||
}
|
||||
elsif($list == 3) {
|
||||
push @tls, $1;
|
||||
}
|
||||
else {
|
||||
print STDERR "$f:$line:1:ERROR: list item without owner?\n";
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
# REUSE-IgnoreStart
|
||||
elsif(/^C: (.*)/i) {
|
||||
$copyright=$1;
|
||||
}
|
||||
elsif(/^SPDX-License-Identifier: (.*)/i) {
|
||||
$spdx=$1;
|
||||
}
|
||||
# REUSE-IgnoreEnd
|
||||
elsif(/^---/) {
|
||||
# end of the header section
|
||||
if(!$title) {
|
||||
print STDERR "ERROR: no 'Title:' in $f\n";
|
||||
return 1;
|
||||
}
|
||||
if(!$section) {
|
||||
print STDERR "ERROR: no 'Section:' in $f\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$seealso[0]) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'See-also:' present\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$copyright) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'C:' field present\n";
|
||||
return 2;
|
||||
}
|
||||
if(!$spdx) {
|
||||
print STDERR "$f:$line:1:ERROR: no 'SPDX-License-Identifier:' field present\n";
|
||||
return 2;
|
||||
}
|
||||
if($section == 3) {
|
||||
if(!$proto[0]) {
|
||||
printf STDERR "$f:$line:1:ERROR: missing Protocol:\n";
|
||||
exit 2;
|
||||
}
|
||||
my $tls = 0;
|
||||
for my $p (@proto) {
|
||||
if($p eq "TLS") {
|
||||
$tls = 1;
|
||||
}
|
||||
if(!$knownprotos{$p}) {
|
||||
printf STDERR "$f:$line:1:ERROR: invalid protocol used: $p:\n";
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
# This is for TLS, require TLS-backend:
|
||||
if($tls) {
|
||||
if(!$tls[0]) {
|
||||
printf STDERR "$f:$line:1:ERROR: missing TLS-backend:\n";
|
||||
exit 2;
|
||||
}
|
||||
for my $t (@tls) {
|
||||
if(!$knowntls{$t}) {
|
||||
printf STDERR "$f:$line:1:ERROR: invalid TLS backend: $t:\n";
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
last;
|
||||
}
|
||||
else {
|
||||
chomp;
|
||||
print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';"
|
||||
}
|
||||
}
|
||||
|
||||
if(!$start) {
|
||||
print STDERR "$f:$line:1:ERROR: no header present\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
my @desc;
|
||||
my $quote = 0;
|
||||
my $blankline = 0;
|
||||
my $header = 0;
|
||||
|
||||
# cut off the leading path from the file name, if any
|
||||
$f =~ s/^(.*[\\\/])//;
|
||||
|
||||
push @desc, ".\\\" generated by cd2nroff $cd2nroff from $f\n";
|
||||
push @desc, ".TH $title $section \"$date\" $source\n";
|
||||
while(<$fh>) {
|
||||
$line++;
|
||||
|
||||
$d = $_;
|
||||
|
||||
if($quote) {
|
||||
if($quote == 4) {
|
||||
# remove the indentation
|
||||
if($d =~ /^ (.*)/) {
|
||||
push @desc, "$1\n";
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# end of quote
|
||||
$quote = 0;
|
||||
push @desc, ".fi\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
if(/^~~~/) {
|
||||
# end of quote
|
||||
$quote = 0;
|
||||
push @desc, ".fi\n";
|
||||
next;
|
||||
}
|
||||
# convert single backslahes to doubles
|
||||
$d =~ s/\\/\\\\/g;
|
||||
# lines starting with a period needs it escaped
|
||||
$d =~ s/^\./\\&./;
|
||||
push @desc, $d;
|
||||
next;
|
||||
}
|
||||
|
||||
# remove single line HTML comments
|
||||
$d =~ s/<!--.*?-->//g;
|
||||
|
||||
# **bold**
|
||||
$d =~ s/\*\*(\S.*?)\*\*/\\fB$1\\fP/g;
|
||||
# *italics*
|
||||
$d =~ s/\*(\S.*?)\*/\\fI$1\\fP/g;
|
||||
|
||||
if($d =~ /[^\\][\<\>]/) {
|
||||
print STDERR "$f:$line:1:WARN: un-escaped < or > used\n";
|
||||
}
|
||||
# convert backslash-'<' or '> to just the second character
|
||||
$d =~ s/\\([<>])/$1/g;
|
||||
|
||||
# mentions of curl symbols with man pages use italics by default
|
||||
$d =~ s/((lib|)curl([^ ]*\(3\)))/\\fI$1\\fP/gi;
|
||||
|
||||
# backticked becomes italics
|
||||
$d =~ s/\`(.*?)\`/\\fI$1\\fP/g;
|
||||
|
||||
if(/^## (.*)/) {
|
||||
my $word = $1;
|
||||
# if there are enclosing quotes, remove them first
|
||||
$word =~ s/[\"\'\`](.*)[\"\'\`]\z/$1/;
|
||||
|
||||
# enclose in double quotes if there is a space present
|
||||
if($word =~ / /) {
|
||||
push @desc, ".IP \"$word\"\n";
|
||||
}
|
||||
else {
|
||||
push @desc, ".IP $word\n";
|
||||
}
|
||||
$header = 1;
|
||||
}
|
||||
elsif(/^# (.*)/) {
|
||||
my $word = $1;
|
||||
# if there are enclosing quotes, remove them first
|
||||
$word =~ s/[\"\'](.*)[\"\']\z/$1/;
|
||||
|
||||
if($word eq "PROTOCOLS") {
|
||||
print STDERR "$f:$line:1:WARN: PROTOCOLS section in source file\n";
|
||||
}
|
||||
elsif($word eq "EXAMPLE") {
|
||||
# insert the generated PROTOCOLS section before EXAMPLE
|
||||
push @desc, outprotocols(@proto);
|
||||
|
||||
if($proto[0] eq "TLS") {
|
||||
push @desc, outtls(@tls);
|
||||
}
|
||||
}
|
||||
push @desc, ".SH $word\n";
|
||||
$header = 1;
|
||||
}
|
||||
elsif(/^~~~c/) {
|
||||
# start of a code section, not indented
|
||||
$quote = 1;
|
||||
push @desc, "\n" if($blankline && !$header);
|
||||
$header = 0;
|
||||
push @desc, ".nf\n";
|
||||
}
|
||||
elsif(/^~~~/) {
|
||||
# start of a quote section; not code, not indented
|
||||
$quote = 1;
|
||||
push @desc, "\n" if($blankline && !$header);
|
||||
$header = 0;
|
||||
push @desc, ".nf\n";
|
||||
}
|
||||
elsif(/^ (.*)/) {
|
||||
# quoted, indented by 4 space
|
||||
$quote = 4;
|
||||
push @desc, "\n" if($blankline && !$header);
|
||||
$header = 0;
|
||||
push @desc, ".nf\n$1\n";
|
||||
}
|
||||
elsif(/^[ \t]*\n/) {
|
||||
# count and ignore blank lines
|
||||
$blankline++;
|
||||
}
|
||||
else {
|
||||
# don't output newlines if this is the first content after a
|
||||
# header
|
||||
push @desc, "\n" if($blankline && !$header);
|
||||
$blankline = 0;
|
||||
$header = 0;
|
||||
|
||||
# quote minuses in the output
|
||||
$d =~ s/([^\\])-/$1\\-/g;
|
||||
# replace single quotes
|
||||
$d =~ s/\'/\\(aq/g;
|
||||
# handle double quotes first on the line
|
||||
$d =~ s/^(\s*)\"/$1\\&\"/;
|
||||
|
||||
# lines starting with a period needs it escaped
|
||||
$d =~ s/^\./\\&./;
|
||||
|
||||
if($d =~ /^(.*) /) {
|
||||
printf STDERR "$f:$line:%d:ERROR: 2 spaces detected\n",
|
||||
length($1);
|
||||
$errors++;
|
||||
}
|
||||
if($d =~ /^[ \t]*\n/) {
|
||||
# replaced away all contents
|
||||
$blankline= 1;
|
||||
}
|
||||
else {
|
||||
push @desc, $d;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($fh != \*STDIN) {
|
||||
close($fh);
|
||||
}
|
||||
push @desc, outseealso(@seealso);
|
||||
if($dir) {
|
||||
if($keepfilename) {
|
||||
$title = $f;
|
||||
$title =~ s/\.[^.]*$//;
|
||||
}
|
||||
my $outfile = "$dir/$title.$section";
|
||||
if(defined($extension)) {
|
||||
$outfile .= $extension;
|
||||
}
|
||||
if(!open(O, ">", $outfile)) {
|
||||
print STDERR "Failed to open $outfile : $!\n";
|
||||
return 1;
|
||||
}
|
||||
print O @desc;
|
||||
close(O);
|
||||
}
|
||||
else {
|
||||
print @desc;
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
if(@ARGV) {
|
||||
for my $f (@ARGV) {
|
||||
my $r = single($f);
|
||||
if($r) {
|
||||
exit $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
exit single();
|
||||
}
|
44
third_party/curl/scripts/cdall
vendored
Executable file
44
third_party/curl/scripts/cdall
vendored
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# provide all dir names to scan on the cmdline
|
||||
|
||||
sub convert {
|
||||
my ($dir)=@_;
|
||||
opendir(my $dh, $dir) || die "could not open $dir";
|
||||
my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh);
|
||||
closedir $dh;
|
||||
|
||||
for my $cd (@cd) {
|
||||
my $nroff = "$cd";
|
||||
$nroff =~ s/\.md\z/.3/;
|
||||
print "$dir/$cd = $dir/$nroff\n";
|
||||
system("./scripts/cd2nroff -d $dir $dir/$cd");
|
||||
}
|
||||
}
|
||||
|
||||
for my $d (sort @ARGV) {
|
||||
convert($d);
|
||||
}
|
990
third_party/curl/scripts/checksrc.pl
vendored
Executable file
990
third_party/curl/scripts/checksrc.pl
vendored
Executable file
@ -0,0 +1,990 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $max_column = 79;
|
||||
my $indent = 2;
|
||||
|
||||
my $warnings = 0;
|
||||
my $swarnings = 0;
|
||||
my $errors = 0;
|
||||
my $serrors = 0;
|
||||
my $suppressed; # skipped problems
|
||||
my $file;
|
||||
my $dir=".";
|
||||
my $wlist="";
|
||||
my @alist;
|
||||
my $windows_os = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
|
||||
my $verbose;
|
||||
my %skiplist;
|
||||
|
||||
my %ignore;
|
||||
my %ignore_set;
|
||||
my %ignore_used;
|
||||
my @ignore_line;
|
||||
|
||||
my %warnings_extended = (
|
||||
'COPYRIGHTYEAR' => 'copyright year incorrect',
|
||||
'STRERROR', => 'strerror() detected',
|
||||
'STDERR', => 'stderr detected',
|
||||
);
|
||||
|
||||
my %warnings = (
|
||||
'ASSIGNWITHINCONDITION' => 'assignment within conditional expression',
|
||||
'ASTERISKNOSPACE' => 'pointer declared without space before asterisk',
|
||||
'ASTERISKSPACE' => 'pointer declared with space after asterisk',
|
||||
'BADCOMMAND' => 'bad !checksrc! instruction',
|
||||
'BANNEDFUNC' => 'a banned function was used',
|
||||
'BANNEDPREPROC' => 'a banned symbol was used on a preprocessor line',
|
||||
'BRACEELSE' => '} else on the same line',
|
||||
'BRACEPOS' => 'wrong position for an open brace',
|
||||
'BRACEWHILE' => 'A single space between open brace and while',
|
||||
'COMMANOSPACE' => 'comma without following space',
|
||||
'COMMENTNOSPACEEND' => 'no space before */',
|
||||
'COMMENTNOSPACESTART' => 'no space following /*',
|
||||
'COPYRIGHT' => 'file missing a copyright statement',
|
||||
'CPPCOMMENTS' => '// comment detected',
|
||||
'DOBRACE' => 'A single space between do and open brace',
|
||||
'EMPTYLINEBRACE' => 'Empty line before the open brace',
|
||||
'EQUALSNOSPACE' => 'equals sign without following space',
|
||||
'EQUALSNULL' => 'if/while comparison with == NULL',
|
||||
'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
|
||||
'FOPENMODE' => 'fopen needs a macro for the mode string',
|
||||
'INCLUDEDUP', => 'same file is included again',
|
||||
'INDENTATION' => 'wrong start column for code',
|
||||
'LONGLINE' => "Line longer than $max_column",
|
||||
'SPACEBEFORELABEL' => 'labels not at the start of the line',
|
||||
'MULTISPACE' => 'multiple spaces used when not suitable',
|
||||
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
||||
'NOTEQUALSZERO', => 'if/while comparison with != 0',
|
||||
'ONELINECONDITION' => 'conditional block on the same line as the if()',
|
||||
'OPENCOMMENT' => 'file ended with a /* comment still "open"',
|
||||
'PARENBRACE' => '){ without sufficient space',
|
||||
'RETURNNOSPACE' => 'return without space',
|
||||
'SEMINOSPACE' => 'semicolon without following space',
|
||||
'SIZEOFNOPAREN' => 'use of sizeof without parentheses',
|
||||
'SNPRINTF' => 'use of snprintf',
|
||||
'SPACEAFTERPAREN' => 'space after open parenthesis',
|
||||
'SPACEBEFORECLOSE' => 'space before a close parenthesis',
|
||||
'SPACEBEFORECOMMA' => 'space before a comma',
|
||||
'SPACEBEFOREPAREN' => 'space before an open parenthesis',
|
||||
'SPACESEMICOLON' => 'space before semicolon',
|
||||
'SPACESWITCHCOLON' => 'space before colon of switch label',
|
||||
'TABS' => 'TAB characters not allowed',
|
||||
'TRAILINGSPACE' => 'Trailing whitespace on the line',
|
||||
'TYPEDEFSTRUCT' => 'typedefed struct',
|
||||
'UNUSEDIGNORE' => 'a warning ignore was not used',
|
||||
);
|
||||
|
||||
sub readskiplist {
|
||||
open(my $W, '<', "$dir/checksrc.skip") or return;
|
||||
my @all=<$W>;
|
||||
for(@all) {
|
||||
$windows_os ? $_ =~ s/\r?\n$// : chomp;
|
||||
$skiplist{$_}=1;
|
||||
}
|
||||
close($W);
|
||||
}
|
||||
|
||||
# Reads the .checksrc in $dir for any extended warnings to enable locally.
|
||||
# Currently there is no support for disabling warnings from the standard set,
|
||||
# and since that's already handled via !checksrc! commands there is probably
|
||||
# little use to add it.
|
||||
sub readlocalfile {
|
||||
my $i = 0;
|
||||
|
||||
open(my $rcfile, "<", "$dir/.checksrc") or return;
|
||||
|
||||
while(<$rcfile>) {
|
||||
$windows_os ? $_ =~ s/\r?\n$// : chomp;
|
||||
$i++;
|
||||
|
||||
# Lines starting with '#' are considered comments
|
||||
if (/^\s*(#.*)/) {
|
||||
next;
|
||||
}
|
||||
elsif (/^\s*enable ([A-Z]+)$/) {
|
||||
if(!defined($warnings_extended{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
}
|
||||
$warnings{$1} = $warnings_extended{$1};
|
||||
}
|
||||
elsif (/^\s*disable ([A-Z]+)$/) {
|
||||
if(!defined($warnings{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
}
|
||||
# Accept-list
|
||||
push @alist, $1;
|
||||
}
|
||||
else {
|
||||
die "Invalid format in $dir/.checksrc on line $i\n";
|
||||
}
|
||||
}
|
||||
close($rcfile);
|
||||
}
|
||||
|
||||
sub checkwarn {
|
||||
my ($name, $num, $col, $file, $line, $msg, $error) = @_;
|
||||
|
||||
my $w=$error?"error":"warning";
|
||||
my $nowarn=0;
|
||||
|
||||
#if(!$warnings{$name}) {
|
||||
# print STDERR "Dev! there's no description for $name!\n";
|
||||
#}
|
||||
|
||||
# checksrc.skip
|
||||
if($skiplist{$line}) {
|
||||
$nowarn = 1;
|
||||
}
|
||||
# !checksrc! controlled
|
||||
elsif($ignore{$name}) {
|
||||
$ignore{$name}--;
|
||||
$ignore_used{$name}++;
|
||||
$nowarn = 1;
|
||||
if(!$ignore{$name}) {
|
||||
# reached zero, enable again
|
||||
enable_warn($name, $num, $file, $line);
|
||||
}
|
||||
}
|
||||
|
||||
if($nowarn) {
|
||||
$suppressed++;
|
||||
if($w) {
|
||||
$swarnings++;
|
||||
}
|
||||
else {
|
||||
$serrors++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if($w) {
|
||||
$warnings++;
|
||||
}
|
||||
else {
|
||||
$errors++;
|
||||
}
|
||||
|
||||
$col++;
|
||||
print "$file:$num:$col: $w: $msg ($name)\n";
|
||||
print " $line\n";
|
||||
|
||||
if($col < 80) {
|
||||
my $pref = (' ' x $col);
|
||||
print "${pref}^\n";
|
||||
}
|
||||
}
|
||||
|
||||
$file = shift @ARGV;
|
||||
|
||||
while(defined $file) {
|
||||
|
||||
if($file =~ /-D(.*)/) {
|
||||
$dir = $1;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-W(.*)/) {
|
||||
$wlist .= " $1 ";
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-A(.+)/) {
|
||||
push @alist, $1;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-i([1-9])/) {
|
||||
$indent = $1 + 0;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-m([0-9]+)/) {
|
||||
$max_column = $1 + 0;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /^(-h|--help)/) {
|
||||
undef $file;
|
||||
last;
|
||||
}
|
||||
|
||||
last;
|
||||
}
|
||||
|
||||
if(!$file) {
|
||||
print "checksrc.pl [option] <file1> [file2] ...\n";
|
||||
print " Options:\n";
|
||||
print " -A[rule] Accept this violation, can be used multiple times\n";
|
||||
print " -D[DIR] Directory to prepend file names\n";
|
||||
print " -h Show help output\n";
|
||||
print " -W[file] Skip the given file - ignore all its flaws\n";
|
||||
print " -i<n> Indent spaces. Default: 2\n";
|
||||
print " -m<n> Maximum line length. Default: 79\n";
|
||||
print "\nDetects and warns for these problems:\n";
|
||||
my @allw = keys %warnings;
|
||||
push @allw, keys %warnings_extended;
|
||||
for my $w (sort @allw) {
|
||||
if($warnings{$w}) {
|
||||
printf (" %-18s: %s\n", $w, $warnings{$w});
|
||||
}
|
||||
else {
|
||||
printf (" %-18s: %s[*]\n", $w, $warnings_extended{$w});
|
||||
}
|
||||
}
|
||||
print " [*] = disabled by default\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
readskiplist();
|
||||
readlocalfile();
|
||||
|
||||
do {
|
||||
if("$wlist" !~ / $file /) {
|
||||
my $fullname = $file;
|
||||
$fullname = "$dir/$file" if ($fullname !~ '^\.?\.?/');
|
||||
scanfile($fullname);
|
||||
}
|
||||
$file = shift @ARGV;
|
||||
|
||||
} while($file);
|
||||
|
||||
sub accept_violations {
|
||||
for my $r (@alist) {
|
||||
if(!$warnings{$r}) {
|
||||
print "'$r' is not a warning to accept!\n";
|
||||
exit;
|
||||
}
|
||||
$ignore{$r}=999999;
|
||||
$ignore_used{$r}=0;
|
||||
}
|
||||
}
|
||||
|
||||
sub checksrc_clear {
|
||||
undef %ignore;
|
||||
undef %ignore_set;
|
||||
undef @ignore_line;
|
||||
}
|
||||
|
||||
sub checksrc_endoffile {
|
||||
my ($file) = @_;
|
||||
for(keys %ignore_set) {
|
||||
if($ignore_set{$_} && !$ignore_used{$_}) {
|
||||
checkwarn("UNUSEDIGNORE", $ignore_set{$_},
|
||||
length($_)+11, $file,
|
||||
$ignore_line[$ignore_set{$_}],
|
||||
"Unused ignore: $_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub enable_warn {
|
||||
my ($what, $line, $file, $l) = @_;
|
||||
|
||||
# switch it back on, but warn if not triggered!
|
||||
if(!$ignore_used{$what}) {
|
||||
checkwarn("UNUSEDIGNORE",
|
||||
$line, length($what) + 11, $file, $l,
|
||||
"No warning was inhibited!");
|
||||
}
|
||||
$ignore_set{$what}=0;
|
||||
$ignore_used{$what}=0;
|
||||
$ignore{$what}=0;
|
||||
}
|
||||
sub checksrc {
|
||||
my ($cmd, $line, $file, $l) = @_;
|
||||
if($cmd =~ / *([^ ]*) *(.*)/) {
|
||||
my ($enable, $what) = ($1, $2);
|
||||
$what =~ s: *\*/$::; # cut off end of C comment
|
||||
# print "ENABLE $enable WHAT $what\n";
|
||||
if($enable eq "disable") {
|
||||
my ($warn, $scope)=($1, $2);
|
||||
if($what =~ /([^ ]*) +(.*)/) {
|
||||
($warn, $scope)=($1, $2);
|
||||
}
|
||||
else {
|
||||
$warn = $what;
|
||||
$scope = 1;
|
||||
}
|
||||
# print "IGNORE $warn for SCOPE $scope\n";
|
||||
if($scope eq "all") {
|
||||
$scope=999999;
|
||||
}
|
||||
|
||||
# Comparing for a literal zero rather than the scalar value zero
|
||||
# covers the case where $scope contains the ending '*' from the
|
||||
# comment. If we use a scalar comparison (==) we induce warnings
|
||||
# on non-scalar contents.
|
||||
if($scope eq "0") {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"Disable zero not supported, did you mean to enable?");
|
||||
}
|
||||
elsif($ignore_set{$warn}) {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"$warn already disabled from line $ignore_set{$warn}");
|
||||
}
|
||||
else {
|
||||
$ignore{$warn}=$scope;
|
||||
$ignore_set{$warn}=$line;
|
||||
$ignore_line[$line]=$l;
|
||||
}
|
||||
}
|
||||
elsif($enable eq "enable") {
|
||||
enable_warn($what, $line, $file, $l);
|
||||
}
|
||||
else {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"Illegal !checksrc! command");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nostrings {
|
||||
my ($str) = @_;
|
||||
$str =~ s/\".*\"//g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub scanfile {
|
||||
my ($file) = @_;
|
||||
|
||||
my $line = 1;
|
||||
my $prevl="";
|
||||
my $prevpl="";
|
||||
my $l = "";
|
||||
my $prep = 0;
|
||||
my $prevp = 0;
|
||||
open(my $R, '<', $file) || die "failed to open $file";
|
||||
|
||||
my $incomment=0;
|
||||
my @copyright=();
|
||||
my %includes;
|
||||
checksrc_clear(); # for file based ignores
|
||||
accept_violations();
|
||||
|
||||
while(<$R>) {
|
||||
$windows_os ? $_ =~ s/\r?\n$// : chomp;
|
||||
my $l = $_;
|
||||
my $ol = $l; # keep the unmodified line for error reporting
|
||||
my $column = 0;
|
||||
|
||||
# check for !checksrc! commands
|
||||
if($l =~ /\!checksrc\! (.*)/) {
|
||||
my $cmd = $1;
|
||||
checksrc($cmd, $line, $file, $l)
|
||||
}
|
||||
|
||||
if($l =~ /^#line (\d+) \"([^\"]*)\"/) {
|
||||
# a #line instruction
|
||||
$file = $2;
|
||||
$line = $1;
|
||||
next;
|
||||
}
|
||||
|
||||
# check for a copyright statement and save the years
|
||||
if($l =~ /\* +copyright .* (\d\d\d\d|)/i) {
|
||||
my $count = 0;
|
||||
while($l =~ /([\d]{4})/g) {
|
||||
push @copyright, {
|
||||
year => $1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
$count++;
|
||||
}
|
||||
if(!$count) {
|
||||
# year-less
|
||||
push @copyright, {
|
||||
year => -1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# detect long lines
|
||||
if(length($l) > $max_column) {
|
||||
checkwarn("LONGLINE", $line, length($l), $file, $l,
|
||||
"Longer than $max_column columns");
|
||||
}
|
||||
# detect TAB characters
|
||||
if($l =~ /^(.*)\t/) {
|
||||
checkwarn("TABS",
|
||||
$line, length($1), $file, $l, "Contains TAB character", 1);
|
||||
}
|
||||
# detect trailing whitespace
|
||||
if($l =~ /^(.*)[ \t]+\z/) {
|
||||
checkwarn("TRAILINGSPACE",
|
||||
$line, length($1), $file, $l, "Trailing whitespace");
|
||||
}
|
||||
|
||||
# no space after comment start
|
||||
if($l =~ /^(.*)\/\*\w/) {
|
||||
checkwarn("COMMENTNOSPACESTART",
|
||||
$line, length($1) + 2, $file, $l,
|
||||
"Missing space after comment start");
|
||||
}
|
||||
# no space at comment end
|
||||
if($l =~ /^(.*)\w\*\//) {
|
||||
checkwarn("COMMENTNOSPACEEND",
|
||||
$line, length($1) + 1, $file, $l,
|
||||
"Missing space end comment end");
|
||||
}
|
||||
# ------------------------------------------------------------
|
||||
# Above this marker, the checks were done on lines *including*
|
||||
# comments
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# strip off C89 comments
|
||||
|
||||
comment:
|
||||
if(!$incomment) {
|
||||
if($l =~ s/\/\*.*\*\// /g) {
|
||||
# full /* comments */ were removed!
|
||||
}
|
||||
if($l =~ s/\/\*.*//) {
|
||||
# start of /* comment was removed
|
||||
$incomment = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($l =~ s/.*\*\///) {
|
||||
# end of comment */ was removed
|
||||
$incomment = 0;
|
||||
goto comment;
|
||||
}
|
||||
else {
|
||||
# still within a comment
|
||||
$l="";
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Below this marker, the checks were done on lines *without*
|
||||
# comments
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# prev line was a preprocessor **and** ended with a backslash
|
||||
if($prep && ($prevpl =~ /\\ *\z/)) {
|
||||
# this is still a preprocessor line
|
||||
$prep = 1;
|
||||
goto preproc;
|
||||
}
|
||||
$prep = 0;
|
||||
|
||||
# crude attempt to detect // comments without too many false
|
||||
# positives
|
||||
if($l =~ /^(([^"\*]*)[^:"]|)\/\//) {
|
||||
checkwarn("CPPCOMMENTS",
|
||||
$line, length($1), $file, $l, "\/\/ comment");
|
||||
}
|
||||
|
||||
if($l =~ /^(\#\s*include\s+)([\">].*[>}"])/) {
|
||||
my ($pre, $path) = ($1, $2);
|
||||
if($includes{$path}) {
|
||||
checkwarn("INCLUDEDUP",
|
||||
$line, length($1), $file, $l, "duplicated include");
|
||||
}
|
||||
$includes{$path} = $l;
|
||||
}
|
||||
|
||||
# detect and strip preprocessor directives
|
||||
if($l =~ /^[ \t]*\#/) {
|
||||
# preprocessor line
|
||||
$prep = 1;
|
||||
goto preproc;
|
||||
}
|
||||
|
||||
my $nostr = nostrings($l);
|
||||
# check spaces after for/if/while/function call
|
||||
if($nostr =~ /^(.*)(for|if|while|switch| ([a-zA-Z0-9_]+)) \((.)/) {
|
||||
my ($leading, $word, $extra, $first)=($1,$2,$3,$4);
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
elsif(defined $3 && $3 eq "return") {
|
||||
# return must have a space
|
||||
}
|
||||
elsif(defined $3 && $3 eq "case") {
|
||||
# case must have a space
|
||||
}
|
||||
elsif(($first eq "*") && ($word !~ /(for|if|while|switch)/)) {
|
||||
# A "(*" beginning makes the space OK because it wants to
|
||||
# allow function pointer declared
|
||||
}
|
||||
elsif($1 =~ / *typedef/) {
|
||||
# typedefs can use space-paren
|
||||
}
|
||||
else {
|
||||
checkwarn("SPACEBEFOREPAREN", $line, length($leading)+length($word), $file, $l,
|
||||
"$word with space");
|
||||
}
|
||||
}
|
||||
# check for '== NULL' in if/while conditions but not if the thing on
|
||||
# the left of it is a function call
|
||||
if($nostr =~ /^(.*)(if|while)(\(.*?)([!=]= NULL|NULL [!=]=)/) {
|
||||
checkwarn("EQUALSNULL", $line,
|
||||
length($1) + length($2) + length($3),
|
||||
$file, $l, "we prefer !variable instead of \"== NULL\" comparisons");
|
||||
}
|
||||
|
||||
# check for '!= 0' in if/while conditions but not if the thing on
|
||||
# the left of it is a function call
|
||||
if($nostr =~ /^(.*)(if|while)(\(.*[^)]) != 0[^x]/) {
|
||||
checkwarn("NOTEQUALSZERO", $line,
|
||||
length($1) + length($2) + length($3),
|
||||
$file, $l, "we prefer if(rc) instead of \"rc != 0\" comparisons");
|
||||
}
|
||||
|
||||
# check spaces in 'do {'
|
||||
if($nostr =~ /^( *)do( *)\{/ && length($2) != 1) {
|
||||
checkwarn("DOBRACE", $line, length($1) + 2, $file, $l, "one space after do before brace");
|
||||
}
|
||||
# check spaces in 'do {'
|
||||
elsif($nostr =~ /^( *)\}( *)while/ && length($2) != 1) {
|
||||
checkwarn("BRACEWHILE", $line, length($1) + 2, $file, $l, "one space between brace and while");
|
||||
}
|
||||
if($nostr =~ /^((.*\s)(if) *\()(.*)\)(.*)/) {
|
||||
my $pos = length($1);
|
||||
my $postparen = $5;
|
||||
my $cond = $4;
|
||||
if($cond =~ / = /) {
|
||||
checkwarn("ASSIGNWITHINCONDITION",
|
||||
$line, $pos+1, $file, $l,
|
||||
"assignment within conditional expression");
|
||||
}
|
||||
my $temp = $cond;
|
||||
$temp =~ s/\(//g; # remove open parens
|
||||
my $openc = length($cond) - length($temp);
|
||||
|
||||
$temp = $cond;
|
||||
$temp =~ s/\)//g; # remove close parens
|
||||
my $closec = length($cond) - length($temp);
|
||||
my $even = $openc == $closec;
|
||||
|
||||
if($l =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
elsif($even && $postparen &&
|
||||
($postparen !~ /^ *$/) && ($postparen !~ /^ *[,{&|\\]+/)) {
|
||||
checkwarn("ONELINECONDITION",
|
||||
$line, length($l)-length($postparen), $file, $l,
|
||||
"conditional block on the same line");
|
||||
}
|
||||
}
|
||||
# check spaces after open parentheses
|
||||
if($l =~ /^(.*[a-z])\( /i) {
|
||||
checkwarn("SPACEAFTERPAREN",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space after open parenthesis");
|
||||
}
|
||||
|
||||
# check spaces before close parentheses, unless it was a space or a
|
||||
# close parenthesis!
|
||||
if($l =~ /(.*[^\) ]) \)/) {
|
||||
checkwarn("SPACEBEFORECLOSE",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space before close parenthesis");
|
||||
}
|
||||
|
||||
# check spaces before comma!
|
||||
if($l =~ /(.*[^ ]) ,/) {
|
||||
checkwarn("SPACEBEFORECOMMA",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space before comma");
|
||||
}
|
||||
|
||||
# check for "return(" without space
|
||||
if($l =~ /^(.*)return\(/) {
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
else {
|
||||
checkwarn("RETURNNOSPACE", $line, length($1)+6, $file, $l,
|
||||
"return without space before paren");
|
||||
}
|
||||
}
|
||||
|
||||
# check for "sizeof" without parenthesis
|
||||
if(($l =~ /^(.*)sizeof *([ (])/) && ($2 ne "(")) {
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
else {
|
||||
checkwarn("SIZEOFNOPAREN", $line, length($1)+6, $file, $l,
|
||||
"sizeof without parenthesis");
|
||||
}
|
||||
}
|
||||
|
||||
# check for comma without space
|
||||
if($l =~ /^(.*),[^ \n]/) {
|
||||
my $pref=$1;
|
||||
my $ign=0;
|
||||
if($pref =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /\/\*/) {
|
||||
# this is a comment
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /[\"\']/) {
|
||||
$ign = 1;
|
||||
# There is a quote here, figure out whether the comma is
|
||||
# within a string or '' or not.
|
||||
if($pref =~ /\"/) {
|
||||
# within a string
|
||||
}
|
||||
elsif($pref =~ /\'$/) {
|
||||
# a single letter
|
||||
}
|
||||
else {
|
||||
$ign = 0;
|
||||
}
|
||||
}
|
||||
if(!$ign) {
|
||||
checkwarn("COMMANOSPACE", $line, length($pref)+1, $file, $l,
|
||||
"comma without following space");
|
||||
}
|
||||
}
|
||||
|
||||
# check for "} else"
|
||||
if($l =~ /^(.*)\} *else/) {
|
||||
checkwarn("BRACEELSE",
|
||||
$line, length($1), $file, $l, "else after closing brace on same line");
|
||||
}
|
||||
# check for "){"
|
||||
if($l =~ /^(.*)\)\{/) {
|
||||
checkwarn("PARENBRACE",
|
||||
$line, length($1)+1, $file, $l, "missing space after close paren");
|
||||
}
|
||||
# check for "^{" with an empty line before it
|
||||
if(($l =~ /^\{/) && ($prevl =~ /^[ \t]*\z/)) {
|
||||
checkwarn("EMPTYLINEBRACE",
|
||||
$line, 0, $file, $l, "empty line before open brace");
|
||||
}
|
||||
|
||||
# check for space before the semicolon last in a line
|
||||
if($l =~ /^(.*[^ ].*) ;$/) {
|
||||
checkwarn("SPACESEMICOLON",
|
||||
$line, length($1), $file, $ol, "no space before semicolon");
|
||||
}
|
||||
|
||||
# check for space before the colon in a switch label
|
||||
if($l =~ /^( *(case .+|default)) :/) {
|
||||
checkwarn("SPACESWITCHCOLON",
|
||||
$line, length($1), $file, $ol, "no space before colon of switch label");
|
||||
}
|
||||
|
||||
if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
|
||||
checkwarn("SPACEBEFORELABEL",
|
||||
$line, length($1), $file, $ol, "no space before label");
|
||||
}
|
||||
|
||||
# scan for use of banned functions
|
||||
if($l =~ /^(.*\W)
|
||||
(gmtime|localtime|
|
||||
gets|
|
||||
strtok|
|
||||
v?sprintf|
|
||||
(str|_mbs|_tcs|_wcs)n?cat|
|
||||
LoadLibrary(Ex)?(A|W)?|
|
||||
_?w?access)
|
||||
\s*\(
|
||||
/x) {
|
||||
checkwarn("BANNEDFUNC",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
if($warnings{"STRERROR"}) {
|
||||
# scan for use of banned strerror. This is not a BANNEDFUNC to
|
||||
# allow for individual enable/disable of this warning.
|
||||
if($l =~ /^(.*\W)(strerror)\s*\(/x) {
|
||||
if($1 !~ /^ *\#/) {
|
||||
# skip preprocessor lines
|
||||
checkwarn("STRERROR",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
}
|
||||
}
|
||||
if($warnings{"STDERR"}) {
|
||||
# scan for use of banned stderr. This is not a BANNEDFUNC to
|
||||
# allow for individual enable/disable of this warning.
|
||||
if($l =~ /^([^\"-]*\W)(stderr)[^\"_]/x) {
|
||||
if($1 !~ /^ *\#/) {
|
||||
# skip preprocessor lines
|
||||
checkwarn("STDERR",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned (use tool_stderr instead)");
|
||||
}
|
||||
}
|
||||
}
|
||||
# scan for use of snprintf for curl-internals reasons
|
||||
if($l =~ /^(.*\W)(v?snprintf)\s*\(/x) {
|
||||
checkwarn("SNPRINTF",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
|
||||
# scan for use of non-binary fopen without the macro
|
||||
if($l =~ /^(.*\W)fopen\s*\([^,]*, *\"([^"]*)/) {
|
||||
my $mode = $2;
|
||||
if($mode !~ /b/) {
|
||||
checkwarn("FOPENMODE",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of non-binary fopen without FOPEN_* macro: $mode");
|
||||
}
|
||||
}
|
||||
|
||||
# check for open brace first on line but not first column only alert
|
||||
# if previous line ended with a close paren and it wasn't a cpp line
|
||||
if(($prevl =~ /\)\z/) && ($l =~ /^( +)\{/) && !$prevp) {
|
||||
checkwarn("BRACEPOS",
|
||||
$line, length($1), $file, $ol, "badly placed open brace");
|
||||
}
|
||||
|
||||
# if the previous line starts with if/while/for AND ends with an open
|
||||
# brace, or an else statement, check that this line is indented $indent
|
||||
# more steps, if not a cpp line
|
||||
if(!$prevp && ($prevl =~ /^( *)((if|while|for)\(.*\{|else)\z/)) {
|
||||
my $first = length($1);
|
||||
# this line has some character besides spaces
|
||||
if($l =~ /^( *)[^ ]/) {
|
||||
my $second = length($1);
|
||||
my $expect = $first+$indent;
|
||||
if($expect != $second) {
|
||||
my $diff = $second - $first;
|
||||
checkwarn("INDENTATION", $line, length($1), $file, $ol,
|
||||
"not indented $indent steps (uses $diff)");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if the previous line starts with if/while/for AND ends with a closed
|
||||
# parenthesis and there's an equal number of open and closed
|
||||
# parentheses, check that this line is indented $indent more steps, if
|
||||
# not a cpp line
|
||||
elsif(!$prevp && ($prevl =~ /^( *)(if|while|for)(\(.*\))\z/)) {
|
||||
my $first = length($1);
|
||||
my $op = $3;
|
||||
my $cl = $3;
|
||||
|
||||
$op =~ s/[^(]//g;
|
||||
$cl =~ s/[^)]//g;
|
||||
|
||||
if(length($op) == length($cl)) {
|
||||
# this line has some character besides spaces
|
||||
if($l =~ /^( *)[^ ]/) {
|
||||
my $second = length($1);
|
||||
my $expect = $first+$indent;
|
||||
if($expect != $second) {
|
||||
my $diff = $second - $first;
|
||||
checkwarn("INDENTATION", $line, length($1), $file, $ol,
|
||||
"not indented $indent steps (uses $diff)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# check for 'char * name'
|
||||
if(($l =~ /(^.*(char|int|long|void|CURL|CURLM|CURLMsg|[cC]url_[A-Za-z_]+|struct [a-zA-Z_]+) *(\*+)) (\w+)/) && ($4 !~ /^(const|volatile)$/)) {
|
||||
checkwarn("ASTERISKSPACE",
|
||||
$line, length($1), $file, $ol,
|
||||
"space after declarative asterisk");
|
||||
}
|
||||
# check for 'char*'
|
||||
if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost|sockaddr_in|FILE)\*)/)) {
|
||||
checkwarn("ASTERISKNOSPACE",
|
||||
$line, length($1)-1, $file, $ol,
|
||||
"no space before asterisk");
|
||||
}
|
||||
|
||||
# check for 'void func() {', but avoid false positives by requiring
|
||||
# both an open and closed parentheses before the open brace
|
||||
if($l =~ /^((\w).*)\{\z/) {
|
||||
my $k = $1;
|
||||
$k =~ s/const *//;
|
||||
$k =~ s/static *//;
|
||||
if($k =~ /\(.*\)/) {
|
||||
checkwarn("BRACEPOS",
|
||||
$line, length($l)-1, $file, $ol,
|
||||
"wrongly placed open brace");
|
||||
}
|
||||
}
|
||||
|
||||
# check for equals sign without spaces next to it
|
||||
if($nostr =~ /(.*)\=[a-z0-9]/i) {
|
||||
checkwarn("EQUALSNOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after equals sign");
|
||||
}
|
||||
# check for equals sign without spaces before it
|
||||
elsif($nostr =~ /(.*)[a-z0-9]\=/i) {
|
||||
checkwarn("NOSPACEEQUALS",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space before equals sign");
|
||||
}
|
||||
|
||||
# check for plus signs without spaces next to it
|
||||
if($nostr =~ /(.*)[^+]\+[a-z0-9]/i) {
|
||||
checkwarn("PLUSNOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after plus sign");
|
||||
}
|
||||
# check for plus sign without spaces before it
|
||||
elsif($nostr =~ /(.*)[a-z0-9]\+[^+]/i) {
|
||||
checkwarn("NOSPACEPLUS",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space before plus sign");
|
||||
}
|
||||
|
||||
# check for semicolons without space next to it
|
||||
if($nostr =~ /(.*)\;[a-z0-9]/i) {
|
||||
checkwarn("SEMINOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after semicolon");
|
||||
}
|
||||
|
||||
# typedef struct ... {
|
||||
if($nostr =~ /^(.*)typedef struct.*{/) {
|
||||
checkwarn("TYPEDEFSTRUCT",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"typedef'ed struct");
|
||||
}
|
||||
|
||||
if($nostr =~ /(.*)! +(\w|\()/) {
|
||||
checkwarn("EXCLAMATIONSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"space after exclamation mark");
|
||||
}
|
||||
|
||||
# check for more than one consecutive space before open brace or
|
||||
# question mark. Skip lines containing strings since they make it hard
|
||||
# due to artificially getting multiple spaces
|
||||
if(($l eq $nostr) &&
|
||||
$nostr =~ /^(.*(\S)) + [{?]/i) {
|
||||
checkwarn("MULTISPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"multiple spaces");
|
||||
}
|
||||
preproc:
|
||||
if($prep) {
|
||||
# scan for use of banned symbols on a preprocessor line
|
||||
if($l =~ /^(^|.*\W)
|
||||
(WIN32)
|
||||
(\W|$)
|
||||
/x) {
|
||||
checkwarn("BANNEDPREPROC",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned from preprocessor lines" .
|
||||
(($2 eq "WIN32") ? ", use _WIN32 instead" : ""));
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
$prevp = $prep;
|
||||
$prevl = $ol if(!$prep);
|
||||
$prevpl = $ol if($prep);
|
||||
}
|
||||
|
||||
if(!scalar(@copyright)) {
|
||||
checkwarn("COPYRIGHT", 1, 0, $file, "", "Missing copyright statement", 1);
|
||||
}
|
||||
|
||||
# COPYRIGHTYEAR is an extended warning so we must first see if it has been
|
||||
# enabled in .checksrc
|
||||
if(defined($warnings{"COPYRIGHTYEAR"})) {
|
||||
# The check for updated copyrightyear is overly complicated in order to
|
||||
# not punish current hacking for past sins. The copyright years are
|
||||
# right now a bit behind, so enforcing copyright year checking on all
|
||||
# files would cause hundreds of errors. Instead we only look at files
|
||||
# which are tracked in the Git repo and edited in the workdir, or
|
||||
# committed locally on the branch without being in upstream master.
|
||||
#
|
||||
# The simple and naive test is to simply check for the current year,
|
||||
# but updating the year even without an edit is against project policy
|
||||
# (and it would fail every file on January 1st).
|
||||
#
|
||||
# A rather more interesting, and correct, check would be to not test
|
||||
# only locally committed files but inspect all files wrt the year of
|
||||
# their last commit. Removing the `git rev-list origin/master..HEAD`
|
||||
# condition below will enforce copyright year checks against the year
|
||||
# the file was last committed (and thus edited to some degree).
|
||||
my $commityear = undef;
|
||||
@copyright = sort {$$b{year} cmp $$a{year}} @copyright;
|
||||
|
||||
# if the file is modified, assume commit year this year
|
||||
if(`git status -s -- "$file"` =~ /^ [MARCU]/) {
|
||||
$commityear = (localtime(time))[5] + 1900;
|
||||
}
|
||||
else {
|
||||
# min-parents=1 to ignore wrong initial commit in truncated repos
|
||||
my $grl = `git rev-list --max-count=1 --min-parents=1 --timestamp HEAD -- "$file"`;
|
||||
if($grl) {
|
||||
chomp $grl;
|
||||
$commityear = (localtime((split(/ /, $grl))[0]))[5] + 1900;
|
||||
}
|
||||
}
|
||||
|
||||
if(defined($commityear) && scalar(@copyright) &&
|
||||
$copyright[0]{year} != $commityear) {
|
||||
checkwarn("COPYRIGHTYEAR", $copyright[0]{line}, $copyright[0]{col},
|
||||
$file, $copyright[0]{code},
|
||||
"Copyright year out of date, should be $commityear, " .
|
||||
"is $copyright[0]{year}", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if($incomment) {
|
||||
checkwarn("OPENCOMMENT", 1, 0, $file, "", "Missing closing comment", 1);
|
||||
}
|
||||
|
||||
checksrc_endoffile($file);
|
||||
|
||||
close($R);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($errors || $warnings || $verbose) {
|
||||
printf "checksrc: %d errors and %d warnings\n", $errors, $warnings;
|
||||
if($suppressed) {
|
||||
printf "checksrc: %d errors and %d warnings suppressed\n",
|
||||
$serrors,
|
||||
$swarnings;
|
||||
}
|
||||
exit 5; # return failure
|
||||
}
|
166
third_party/curl/scripts/completion.pl
vendored
Executable file
166
third_party/curl/scripts/completion.pl
vendored
Executable file
@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long();
|
||||
use Pod::Usage();
|
||||
|
||||
my $curl = 'curl';
|
||||
my $shell = 'zsh';
|
||||
my $help = 0;
|
||||
Getopt::Long::GetOptions(
|
||||
'curl=s' => \$curl,
|
||||
'shell=s' => \$shell,
|
||||
'help' => \$help,
|
||||
) or Pod::Usage::pod2usage();
|
||||
Pod::Usage::pod2usage() if $help;
|
||||
|
||||
my $regex = '\s+(?:(-[^\s]+),\s)?(--[^\s]+)\s*(\<.+?\>)?\s+(.*)';
|
||||
my @opts = parse_main_opts('--help all', $regex);
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
print "# curl fish completion\n\n";
|
||||
print qq{$_ \n} foreach (@opts);
|
||||
} elsif ($shell eq 'zsh') {
|
||||
my $opts_str;
|
||||
|
||||
$opts_str .= qq{ $_ \\\n} foreach (@opts);
|
||||
chomp $opts_str;
|
||||
|
||||
my $tmpl = <<"EOS";
|
||||
#compdef curl
|
||||
|
||||
# curl zsh completion
|
||||
|
||||
local curcontext="\$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
local rc=1
|
||||
|
||||
_arguments -C -S \\
|
||||
$opts_str
|
||||
'*:URL:_urls' && rc=0
|
||||
|
||||
return rc
|
||||
EOS
|
||||
|
||||
print $tmpl;
|
||||
} else {
|
||||
die("Unsupported shell: $shell");
|
||||
}
|
||||
|
||||
sub parse_main_opts {
|
||||
my ($cmd, $regex) = @_;
|
||||
|
||||
my @list;
|
||||
my @lines = call_curl($cmd);
|
||||
|
||||
foreach my $line (@lines) {
|
||||
my ($short, $long, $arg, $desc) = ($line =~ /^$regex/) or next;
|
||||
|
||||
my $option = '';
|
||||
|
||||
$arg =~ s/\:/\\\:/g if defined $arg;
|
||||
|
||||
$desc =~ s/'/'\\''/g if defined $desc;
|
||||
$desc =~ s/\[/\\\[/g if defined $desc;
|
||||
$desc =~ s/\]/\\\]/g if defined $desc;
|
||||
$desc =~ s/\:/\\\:/g if defined $desc;
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
$option .= "complete --command curl";
|
||||
$option .= " --short-option '" . strip_dash(trim($short)) . "'"
|
||||
if defined $short;
|
||||
$option .= " --long-option '" . strip_dash(trim($long)) . "'"
|
||||
if defined $long;
|
||||
$option .= " --description '" . strip_dash(trim($desc)) . "'"
|
||||
if defined $desc;
|
||||
} elsif ($shell eq 'zsh') {
|
||||
$option .= '{' . trim($short) . ',' if defined $short;
|
||||
$option .= trim($long) if defined $long;
|
||||
$option .= '}' if defined $short;
|
||||
$option .= '\'[' . trim($desc) . ']\'' if defined $desc;
|
||||
|
||||
if (defined $arg) {
|
||||
$option .= ":'$arg'";
|
||||
if ($arg =~ /<file ?(name)?>|<path>/) {
|
||||
$option .= ':_files';
|
||||
} elsif ($arg =~ /<dir>/) {
|
||||
$option .= ":'_path_files -/'";
|
||||
} elsif ($arg =~ /<url>/i) {
|
||||
$option .= ':_urls';
|
||||
} elsif ($long =~ /ftp/ && $arg =~ /<method>/) {
|
||||
$option .= ":'(multicwd nocwd singlecwd)'";
|
||||
} elsif ($arg =~ /<method>/) {
|
||||
$option .= ":'(DELETE GET HEAD POST PUT)'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push @list, $option;
|
||||
}
|
||||
|
||||
# Sort longest first, because zsh won't complete an option listed
|
||||
# after one that's a prefix of it.
|
||||
@list = sort {
|
||||
$a =~ /([^=]*)/; my $ma = $1;
|
||||
$b =~ /([^=]*)/; my $mb = $1;
|
||||
|
||||
length($mb) <=> length($ma)
|
||||
} @list if $shell eq 'zsh';
|
||||
|
||||
return @list;
|
||||
}
|
||||
|
||||
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
|
||||
sub strip_dash { my $s = shift; $s =~ s/^-+//g; return $s };
|
||||
|
||||
sub call_curl {
|
||||
my ($cmd) = @_;
|
||||
my $output = `"$curl" $cmd`;
|
||||
if ($? == -1) {
|
||||
die "Could not run curl: $!";
|
||||
} elsif ((my $exit_code = $? >> 8) != 0) {
|
||||
die "curl returned $exit_code with output:\n$output";
|
||||
}
|
||||
return split /\n/, $output;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
completion.pl - Generates tab-completion files for various shells
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
completion.pl [options...]
|
||||
|
||||
--curl path to curl executable
|
||||
--shell zsh/fish
|
||||
--help prints this help
|
||||
|
||||
=cut
|
41
third_party/curl/scripts/coverage.sh
vendored
Executable file
41
third_party/curl/scripts/coverage.sh
vendored
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
set -eu
|
||||
|
||||
autoreconf -fi
|
||||
mkdir -p cvr
|
||||
cd cvr
|
||||
../configure --disable-shared --enable-debug --enable-maintainer-mode --enable-code-coverage
|
||||
make -sj
|
||||
# the regular test run
|
||||
make TFLAGS=-n test-nonflaky
|
||||
# make all allocs/file operations fail
|
||||
#make TFLAGS=-n test-torture
|
||||
# do everything event-based
|
||||
make TFLAGS=-n test-event
|
||||
lcov -d . -c -o cov.lcov
|
||||
genhtml cov.lcov --output-directory coverage --title "curl code coverage"
|
||||
tar -cjf curl-coverage.tar.bz2 coverage
|
52
third_party/curl/scripts/dmaketgz
vendored
Executable file
52
third_party/curl/scripts/dmaketgz
vendored
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# docker-maketgz
|
||||
#
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
set -eu
|
||||
|
||||
version="${1:-}"
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
echo "Specify a version number!"
|
||||
exit
|
||||
fi
|
||||
|
||||
timestamp="${2:-$(date -u +%s)}"
|
||||
|
||||
make distclean
|
||||
docker build \
|
||||
--build-arg SOURCE_DATE_EPOCH="$timestamp" \
|
||||
--build-arg UID="$(id -u)" \
|
||||
--build-arg GID="$(id -g)" \
|
||||
-t curl/curl .
|
||||
|
||||
docker run --rm -it -u "$(id -u):$(id -g)" \
|
||||
-v "$(pwd):/usr/src" -w /usr/src curl/curl sh -c "
|
||||
set -e
|
||||
autoreconf -fi
|
||||
./configure --without-ssl --without-libpsl
|
||||
make -sj8
|
||||
./maketgz $version"
|
58
third_party/curl/scripts/firefox-db2pem.sh
vendored
Executable file
58
third_party/curl/scripts/firefox-db2pem.sh
vendored
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# ***************************************************************************
|
||||
# * _ _ ____ _
|
||||
# * Project ___| | | | _ \| |
|
||||
# * / __| | | | |_) | |
|
||||
# * | (__| |_| | _ <| |___
|
||||
# * \___|\___/|_| \_\_____|
|
||||
# *
|
||||
# * Copyright (C) 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.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.
|
||||
# *
|
||||
# * SPDX-License-Identifier: curl
|
||||
# *
|
||||
# ***************************************************************************
|
||||
# This shell script creates a fresh ca-bundle.crt file for use with libcurl.
|
||||
# It extracts all ca certs it finds in the local Firefox database and converts
|
||||
# them all into PEM format.
|
||||
#
|
||||
|
||||
set -eu
|
||||
|
||||
db=$(ls -1d "$HOME"/.mozilla/firefox/*default*)
|
||||
out="${1:-}"
|
||||
|
||||
if test -z "$out"; then
|
||||
out="ca-bundle.crt" # use a sensible default
|
||||
fi
|
||||
|
||||
currentdate=$(date)
|
||||
|
||||
cat > "$out" <<EOF
|
||||
##
|
||||
## Bundle of CA Root Certificates
|
||||
##
|
||||
## Converted at: ${currentdate}
|
||||
## These were converted from the local Firefox directory by the db2pem script.
|
||||
##
|
||||
EOF
|
||||
|
||||
|
||||
certutil -L -h 'Builtin Object Token' -d "$db" | \
|
||||
grep ' *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$' | \
|
||||
sed -e 's/ *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$//' -e 's/\(.*\)/"\1"/' | \
|
||||
sort | \
|
||||
while read -r nickname; \
|
||||
do echo "$nickname" | sed -e "s/Builtin Object Token://g"; \
|
||||
eval certutil -d "$db" -L -n "$nickname" -a ; \
|
||||
done >> "$out"
|
1143
third_party/curl/scripts/managen
vendored
Executable file
1143
third_party/curl/scripts/managen
vendored
Executable file
File diff suppressed because it is too large
Load Diff
713
third_party/curl/scripts/mk-ca-bundle.pl
vendored
Executable file
713
third_party/curl/scripts/mk-ca-bundle.pl
vendored
Executable file
@ -0,0 +1,713 @@
|
||||
#!/usr/bin/env perl
|
||||
# ***************************************************************************
|
||||
# * _ _ ____ _
|
||||
# * Project ___| | | | _ \| |
|
||||
# * / __| | | | |_) | |
|
||||
# * | (__| |_| | _ <| |___
|
||||
# * \___|\___/|_| \_\_____|
|
||||
# *
|
||||
# * Copyright (C) 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.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.
|
||||
# *
|
||||
# * SPDX-License-Identifier: curl
|
||||
# *
|
||||
# ***************************************************************************
|
||||
# This Perl script creates a fresh ca-bundle.crt file for use with libcurl.
|
||||
# It downloads certdata.txt from Mozilla's source tree (see URL below),
|
||||
# then parses certdata.txt and extracts CA Root Certificates into PEM format.
|
||||
# These are then processed with the OpenSSL commandline tool to produce the
|
||||
# final ca-bundle.crt file.
|
||||
# The script is based on the parse-certs script written by Roland Krikava.
|
||||
# This Perl script works on almost any platform since its only external
|
||||
# dependency is the OpenSSL commandline tool for optional text listing.
|
||||
# Hacked by Guenter Knauf.
|
||||
#
|
||||
use Encode;
|
||||
use Getopt::Std;
|
||||
use MIME::Base64;
|
||||
use strict;
|
||||
use warnings;
|
||||
use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_k $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w);
|
||||
use List::Util;
|
||||
use Text::Wrap;
|
||||
use Time::Local;
|
||||
my $MOD_SHA = "Digest::SHA";
|
||||
eval "require $MOD_SHA";
|
||||
if ($@) {
|
||||
$MOD_SHA = "Digest::SHA::PurePerl";
|
||||
eval "require $MOD_SHA";
|
||||
}
|
||||
eval "require LWP::UserAgent";
|
||||
|
||||
my %urls = (
|
||||
'nss' =>
|
||||
'https://hg.mozilla.org/projects/nss/raw-file/default/lib/ckfw/builtins/certdata.txt',
|
||||
'central' =>
|
||||
'https://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
'beta' =>
|
||||
'https://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
'release' =>
|
||||
'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
);
|
||||
|
||||
$opt_d = 'release';
|
||||
|
||||
# If the OpenSSL commandline is not in search path you can configure it here!
|
||||
my $openssl = 'openssl';
|
||||
|
||||
my $version = '1.29';
|
||||
|
||||
$opt_w = 76; # default base64 encoded lines length
|
||||
|
||||
# default cert types to include in the output (default is to include CAs which
|
||||
# may issue SSL server certs)
|
||||
my $default_mozilla_trust_purposes = "SERVER_AUTH";
|
||||
my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR";
|
||||
$opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels;
|
||||
|
||||
my @valid_mozilla_trust_purposes = (
|
||||
"DIGITAL_SIGNATURE",
|
||||
"NON_REPUDIATION",
|
||||
"KEY_ENCIPHERMENT",
|
||||
"DATA_ENCIPHERMENT",
|
||||
"KEY_AGREEMENT",
|
||||
"KEY_CERT_SIGN",
|
||||
"CRL_SIGN",
|
||||
"SERVER_AUTH",
|
||||
"CLIENT_AUTH",
|
||||
"CODE_SIGNING",
|
||||
"EMAIL_PROTECTION",
|
||||
"IPSEC_END_SYSTEM",
|
||||
"IPSEC_TUNNEL",
|
||||
"IPSEC_USER",
|
||||
"TIME_STAMPING",
|
||||
"STEP_UP_APPROVED"
|
||||
);
|
||||
|
||||
my @valid_mozilla_trust_levels = (
|
||||
"TRUSTED_DELEGATOR", # CAs
|
||||
"NOT_TRUSTED", # Don't trust these certs.
|
||||
"MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is
|
||||
# otherwise ok. In other words, this should tell the
|
||||
# app to ignore any other sources that claim this is
|
||||
# a CA.
|
||||
"TRUSTED" # This cert is trusted, but only for itself and not
|
||||
# for delegates (i.e. it is not a CA).
|
||||
);
|
||||
|
||||
my $default_signature_algorithms = $opt_s = "MD5";
|
||||
|
||||
my @valid_signature_algorithms = (
|
||||
"MD5",
|
||||
"SHA1",
|
||||
"SHA256",
|
||||
"SHA384",
|
||||
"SHA512"
|
||||
);
|
||||
|
||||
$0 =~ s@.*(/|\\)@@;
|
||||
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||
getopts('bd:fhiklmnp:qs:tuvw:');
|
||||
|
||||
if(!defined($opt_d)) {
|
||||
# to make plain "-d" use not cause warnings, and actually still work
|
||||
$opt_d = 'release';
|
||||
}
|
||||
|
||||
# Use predefined URL or else custom URL specified on command line.
|
||||
my $url;
|
||||
if(defined($urls{$opt_d})) {
|
||||
$url = $urls{$opt_d};
|
||||
if(!$opt_k && $url !~ /^https:\/\//i) {
|
||||
die "The URL for '$opt_d' is not HTTPS. Use -k to override (insecure).\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$url = $opt_d;
|
||||
}
|
||||
|
||||
my $curl = `curl -V`;
|
||||
|
||||
if ($opt_i) {
|
||||
print ("=" x 78 . "\n");
|
||||
print "Script Version : $version\n";
|
||||
print "Perl Version : $]\n";
|
||||
print "Operating System Name : $^O\n";
|
||||
print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
|
||||
print "Encode::Encoding.pm Version : ${Encode::Encoding::VERSION}\n";
|
||||
print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
|
||||
print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n" if($LWP::UserAgent::VERSION);
|
||||
print "LWP.pm Version : ${LWP::VERSION}\n" if($LWP::VERSION);
|
||||
print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION);
|
||||
print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION);
|
||||
print ("=" x 78 . "\n");
|
||||
}
|
||||
|
||||
sub warning_message() {
|
||||
if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit
|
||||
print "Warning: Use of this script may pose some risk:\n";
|
||||
print "\n";
|
||||
print " 1) If you use HTTP URLs they are subject to a man in the middle attack\n";
|
||||
print " 2) Default to 'release', but more recent updates may be found in other trees\n";
|
||||
print " 3) certdata.txt file format may change, lag time to update this script\n";
|
||||
print " 4) Generally unwise to blindly trust CAs without manual review & verification\n";
|
||||
print " 5) Mozilla apps use additional security checks aren't represented in certdata\n";
|
||||
print " 6) Use of this script will make a security engineer grind his teeth and\n";
|
||||
print " swear at you. ;)\n";
|
||||
exit;
|
||||
} else { # Short Form Warning
|
||||
print "Warning: Use of this script may pose some risk, -d risk for more details.\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE() {
|
||||
print "Usage:\t${0} [-b] [-d<certdata>] [-f] [-i] [-k] [-l] [-n] [-p<purposes:levels>] [-q] [-s<algorithms>] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
|
||||
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
|
||||
print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
|
||||
print "\t\t Valid names are:\n";
|
||||
print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
|
||||
print "\t-f\tforce rebuild even if certdata.txt is current\n";
|
||||
print "\t-i\tprint version info about used modules\n";
|
||||
print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
|
||||
print "\t-l\tprint license info about certdata.txt\n";
|
||||
print "\t-m\tinclude meta data in output\n";
|
||||
print "\t-n\tno download of certdata.txt (to use existing)\n";
|
||||
print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
|
||||
print "\t\t Valid purposes are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
|
||||
print "\t\t Valid levels are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
|
||||
print "\t-q\tbe really quiet (no progress output at all)\n";
|
||||
print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
|
||||
print "\t\t Valid signature algorithms are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
|
||||
print "\t-t\tinclude plain text listing of certificates\n";
|
||||
print "\t-u\tunlink (remove) certdata.txt after processing\n";
|
||||
print "\t-v\tbe verbose and print out processed CAs\n";
|
||||
print "\t-w <l>\twrap base64 output lines after <l> chars (default: ${opt_w})\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub VERSION_MESSAGE() {
|
||||
print "${0} version ${version} running Perl ${]} on ${^O}\n";
|
||||
}
|
||||
|
||||
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
|
||||
HELP_MESSAGE() if ($opt_h);
|
||||
|
||||
sub report($@) {
|
||||
my $output = shift;
|
||||
|
||||
print STDERR $output . "\n" unless $opt_q;
|
||||
}
|
||||
|
||||
sub is_in_list($@) {
|
||||
my $target = shift;
|
||||
|
||||
return defined(List::Util::first { $target eq $_ } @_);
|
||||
}
|
||||
|
||||
# Parses $param_string as a case insensitive comma separated list with optional
|
||||
# whitespace validates that only allowed parameters are supplied
|
||||
sub parse_csv_param($$@) {
|
||||
my $description = shift;
|
||||
my $param_string = shift;
|
||||
my @valid_values = @_;
|
||||
|
||||
my @values = map {
|
||||
s/^\s+//; # strip leading spaces
|
||||
s/\s+$//; # strip trailing spaces
|
||||
uc $_ # return the modified string as upper case
|
||||
} split( ',', $param_string );
|
||||
|
||||
# Find all values which are not in the list of valid values or "ALL"
|
||||
my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
|
||||
|
||||
if ( scalar(@invalid) > 0 ) {
|
||||
# Tell the user which parameters were invalid and print the standard help
|
||||
# message which will exit
|
||||
print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
|
||||
HELP_MESSAGE();
|
||||
}
|
||||
|
||||
@values = @valid_values if ( is_in_list("ALL",@values) );
|
||||
|
||||
return @values;
|
||||
}
|
||||
|
||||
sub sha256 {
|
||||
my $result;
|
||||
if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) {
|
||||
open(FILE, $_[0]) or die "Can't open '$_[0]': $!";
|
||||
binmode(FILE);
|
||||
$result = $MOD_SHA->new(256)->addfile(*FILE)->hexdigest;
|
||||
close(FILE);
|
||||
} else {
|
||||
# Use OpenSSL command if Perl Digest::SHA modules not available
|
||||
$result = `"$openssl" dgst -r -sha256 "$_[0]"`;
|
||||
$result =~ s/^([0-9a-f]{64}) .+/$1/is;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
sub oldhash {
|
||||
my $hash = "";
|
||||
open(C, "<$_[0]") || return 0;
|
||||
while(<C>) {
|
||||
chomp;
|
||||
if($_ =~ /^\#\# SHA256: (.*)/) {
|
||||
$hash = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(C);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
if ( $opt_p !~ m/:/ ) {
|
||||
print "Error: Mozilla trust identifier list must include both purposes and levels\n";
|
||||
HELP_MESSAGE();
|
||||
}
|
||||
|
||||
(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
|
||||
my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
|
||||
my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
|
||||
|
||||
my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
|
||||
|
||||
sub should_output_cert(%) {
|
||||
my %trust_purposes_by_level = @_;
|
||||
|
||||
foreach my $level (@included_mozilla_trust_levels) {
|
||||
# for each level we want to output, see if any of our desired purposes are
|
||||
# included
|
||||
return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $crt = $ARGV[0] || 'ca-bundle.crt';
|
||||
(my $txt = $url) =~ s@(.*/|\?.*)@@g;
|
||||
|
||||
my $stdout = $crt eq '-';
|
||||
my $resp;
|
||||
my $fetched;
|
||||
|
||||
my $oldhash = oldhash($crt);
|
||||
|
||||
report "SHA256 of old file: $oldhash";
|
||||
|
||||
if(!$opt_n) {
|
||||
report "Downloading $txt ...";
|
||||
|
||||
# If we have an HTTPS URL then use curl
|
||||
if($url =~ /^https:\/\//i) {
|
||||
if($curl) {
|
||||
if($curl =~ /^Protocols:.* https( |$)/m) {
|
||||
report "Get certdata with curl!";
|
||||
my $proto = !$opt_k ? "--proto =https" : "";
|
||||
my $quiet = $opt_q ? "-s" : "";
|
||||
my @out = `curl -w %{response_code} $proto $quiet -o "$txt" "$url"`;
|
||||
if(!$? && @out && $out[0] == 200) {
|
||||
$fetched = 1;
|
||||
report "Downloaded $txt";
|
||||
}
|
||||
else {
|
||||
report "Failed downloading via HTTPS with curl";
|
||||
if(-e $txt && !unlink($txt)) {
|
||||
report "Failed to remove '$txt': $!";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
report "curl lacks https support";
|
||||
}
|
||||
}
|
||||
else {
|
||||
report "curl not found";
|
||||
}
|
||||
}
|
||||
|
||||
# If nothing was fetched then use LWP
|
||||
if(!$fetched) {
|
||||
if($url =~ /^https:\/\//i) {
|
||||
report "Falling back to HTTP";
|
||||
$url =~ s/^https:\/\//http:\/\//i;
|
||||
}
|
||||
if(!$opt_k) {
|
||||
report "URLs other than HTTPS are disabled by default, to enable use -k";
|
||||
exit 1;
|
||||
}
|
||||
report "Get certdata with LWP!";
|
||||
if(!defined(${LWP::UserAgent::VERSION})) {
|
||||
report "LWP is not available (LWP::UserAgent not found)";
|
||||
exit 1;
|
||||
}
|
||||
my $ua = new LWP::UserAgent(agent => "$0/$version");
|
||||
$ua->env_proxy();
|
||||
$resp = $ua->mirror($url, $txt);
|
||||
if($resp && $resp->code eq '304') {
|
||||
report "Not modified";
|
||||
exit 0 if -e $crt && !$opt_f;
|
||||
}
|
||||
else {
|
||||
$fetched = 1;
|
||||
report "Downloaded $txt";
|
||||
}
|
||||
if(!$resp || $resp->code !~ /^(?:200|304)$/) {
|
||||
report "Unable to download latest data: "
|
||||
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
|
||||
exit 1 if -e $crt || ! -r $txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $filedate = $resp ? $resp->last_modified : (stat($txt))[9];
|
||||
my $datesrc = "as of";
|
||||
if(!$filedate) {
|
||||
# mxr.mozilla.org gave us a time, hg.mozilla.org does not!
|
||||
$filedate = time();
|
||||
$datesrc="downloaded on";
|
||||
}
|
||||
|
||||
# get the hash from the download file
|
||||
my $newhash= sha256($txt);
|
||||
|
||||
if(!$opt_f && $oldhash eq $newhash) {
|
||||
report "Downloaded file identical to previous run\'s source file. Exiting";
|
||||
if($opt_u && -e $txt && !unlink($txt)) {
|
||||
report "Failed to remove $txt: $!\n";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
report "SHA256 of new file: $newhash";
|
||||
|
||||
my $currentdate = scalar gmtime($filedate);
|
||||
|
||||
my $format = $opt_t ? "plain text and " : "";
|
||||
if( $stdout ) {
|
||||
open(CRT, '> -') or die "Couldn't open STDOUT: $!\n";
|
||||
} else {
|
||||
open(CRT,">$crt.~") or die "Couldn't open $crt.~: $!\n";
|
||||
}
|
||||
print CRT <<EOT;
|
||||
##
|
||||
## Bundle of CA Root Certificates
|
||||
##
|
||||
## Certificate data from Mozilla ${datesrc}: ${currentdate} GMT
|
||||
##
|
||||
## This is a bundle of X.509 certificates of public Certificate Authorities
|
||||
## (CA). These were automatically extracted from Mozilla's root certificates
|
||||
## file (certdata.txt). This file can be found in the mozilla source tree:
|
||||
## ${url}
|
||||
##
|
||||
## It contains the certificates in ${format}PEM format and therefore
|
||||
## can be directly used with curl / libcurl / php_curl, or with
|
||||
## an Apache+mod_ssl webserver for SSL client authentication.
|
||||
## Just configure this file as the SSLCACertificateFile.
|
||||
##
|
||||
## Conversion done with mk-ca-bundle.pl version $version.
|
||||
## SHA256: $newhash
|
||||
##
|
||||
|
||||
EOT
|
||||
|
||||
report "Processing '$txt' ...";
|
||||
my $caname;
|
||||
my $certnum = 0;
|
||||
my $skipnum = 0;
|
||||
my $start_of_cert = 0;
|
||||
my $main_block = 0;
|
||||
my $main_block_name;
|
||||
my $trust_block = 0;
|
||||
my $trust_block_name;
|
||||
my @precert;
|
||||
my $cka_value;
|
||||
my $valid = 0;
|
||||
|
||||
open(TXT,"$txt") or die "Couldn't open $txt: $!\n";
|
||||
while (<TXT>) {
|
||||
if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
|
||||
print CRT;
|
||||
print if ($opt_l);
|
||||
while (<TXT>) {
|
||||
print CRT;
|
||||
print if ($opt_l);
|
||||
last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/);
|
||||
}
|
||||
next;
|
||||
}
|
||||
# The input file format consists of blocks of Mozilla objects.
|
||||
# The blocks are separated by blank lines but may be related.
|
||||
elsif(/^\s*$/) {
|
||||
$main_block = 0;
|
||||
$trust_block = 0;
|
||||
next;
|
||||
}
|
||||
# Each certificate has a main block.
|
||||
elsif(/^# Certificate "(.*)"/) {
|
||||
(!$main_block && !$trust_block) or die "Unexpected certificate block";
|
||||
$main_block = 1;
|
||||
$main_block_name = $1;
|
||||
# Reset all other certificate variables.
|
||||
$trust_block = 0;
|
||||
$trust_block_name = "";
|
||||
$valid = 0;
|
||||
$start_of_cert = 0;
|
||||
$caname = "";
|
||||
$cka_value = "";
|
||||
undef @precert;
|
||||
next;
|
||||
}
|
||||
# Each certificate's main block is followed by a trust block.
|
||||
elsif(/^# Trust for (?:Certificate )?"(.*)"/) {
|
||||
(!$main_block && !$trust_block) or die "Unexpected trust block";
|
||||
$trust_block = 1;
|
||||
$trust_block_name = $1;
|
||||
if($main_block_name ne $trust_block_name) {
|
||||
die "cert name \"$main_block_name\" != trust name \"$trust_block_name\"";
|
||||
}
|
||||
next;
|
||||
}
|
||||
# Ignore other blocks.
|
||||
#
|
||||
# There is a documentation comment block, a BEGINDATA block, and a bunch of
|
||||
# blocks starting with "# Explicitly Distrust <certname>".
|
||||
#
|
||||
# The latter is for certificates that have already been removed and are not
|
||||
# included. Not all explicitly distrusted certificates are ignored at this
|
||||
# point, just those without an actual certificate.
|
||||
elsif(!$main_block && !$trust_block) {
|
||||
next;
|
||||
}
|
||||
elsif(/^#/) {
|
||||
# The commented lines in a main block are plaintext metadata that describes
|
||||
# the certificate. Issuer, Subject, Fingerprint, etc.
|
||||
if($main_block) {
|
||||
push @precert, $_ if not /^#$/;
|
||||
if(/^# Not Valid After : (.*)/) {
|
||||
my $stamp = $1;
|
||||
use Time::Piece;
|
||||
# Not Valid After : Thu Sep 30 14:01:15 2021
|
||||
my $t = Time::Piece->strptime($stamp, "%a %b %d %H:%M:%S %Y");
|
||||
my $delta = ($t->epoch - time()); # negative means no longer valid
|
||||
if($delta < 0) {
|
||||
$skipnum++;
|
||||
report "Skipping: $main_block_name is not valid anymore" if ($opt_v);
|
||||
$valid = 0;
|
||||
}
|
||||
else {
|
||||
$valid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif(!$valid) {
|
||||
next;
|
||||
}
|
||||
|
||||
chomp;
|
||||
|
||||
if($main_block) {
|
||||
if(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) {
|
||||
!$start_of_cert or die "Duplicate CKO_CERTIFICATE object";
|
||||
$start_of_cert = 1;
|
||||
next;
|
||||
}
|
||||
elsif(!$start_of_cert) {
|
||||
next;
|
||||
}
|
||||
elsif(/^CKA_LABEL UTF8 \"(.*)\"/) {
|
||||
($caname eq "") or die "Duplicate CKA_LABEL attribute";
|
||||
$caname = $1;
|
||||
if($caname ne $main_block_name) {
|
||||
die "caname \"$caname\" != cert name \"$main_block_name\"";
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif(/^CKA_VALUE MULTILINE_OCTAL/) {
|
||||
($cka_value eq "") or die "Duplicate CKA_VALUE attribute";
|
||||
while (<TXT>) {
|
||||
last if (/^END/);
|
||||
chomp;
|
||||
my @octets = split(/\\/);
|
||||
shift @octets;
|
||||
for (@octets) {
|
||||
$cka_value .= chr(oct);
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif (/^CKA_NSS_SERVER_DISTRUST_AFTER (CK_BBOOL CK_FALSE|MULTILINE_OCTAL)/) {
|
||||
# Example:
|
||||
# CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL
|
||||
# \062\060\060\066\061\067\060\060\060\060\060\060\132
|
||||
# END
|
||||
if($1 eq "MULTILINE_OCTAL") {
|
||||
my @timestamp;
|
||||
while (<TXT>) {
|
||||
last if (/^END/);
|
||||
chomp;
|
||||
my @octets = split(/\\/);
|
||||
shift @octets;
|
||||
for (@octets) {
|
||||
push @timestamp, chr(oct);
|
||||
}
|
||||
}
|
||||
scalar(@timestamp) == 13 or die "Failed parsing timestamp";
|
||||
# A trailing Z in the timestamp signifies UTC
|
||||
if($timestamp[12] ne "Z") {
|
||||
report "distrust date stamp is not using UTC";
|
||||
}
|
||||
# Example date: 200617000000Z
|
||||
# Means 2020-06-17 00:00:00 UTC
|
||||
my $distrustat =
|
||||
timegm($timestamp[10] . $timestamp[11], # second
|
||||
$timestamp[8] . $timestamp[9], # minute
|
||||
$timestamp[6] . $timestamp[7], # hour
|
||||
$timestamp[4] . $timestamp[5], # day
|
||||
($timestamp[2] . $timestamp[3]) - 1, # month
|
||||
"20" . $timestamp[0] . $timestamp[1]); # year
|
||||
if(time >= $distrustat) {
|
||||
# not trusted anymore
|
||||
$skipnum++;
|
||||
report "Skipping: $main_block_name is not trusted anymore" if ($opt_v);
|
||||
$valid = 0;
|
||||
}
|
||||
else {
|
||||
# still trusted
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$trust_block || !$start_of_cert || $caname eq "" || $cka_value eq "") {
|
||||
die "Certificate extraction failed";
|
||||
}
|
||||
|
||||
my %trust_purposes_by_level;
|
||||
|
||||
if(/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/) {
|
||||
# now scan the trust part to determine how we should trust this cert
|
||||
while (<TXT>) {
|
||||
if(/^\s*$/) {
|
||||
$trust_block = 0;
|
||||
last;
|
||||
}
|
||||
if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
|
||||
if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
|
||||
report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
|
||||
} elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
|
||||
report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
|
||||
} else {
|
||||
push @{$trust_purposes_by_level{$2}}, $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Sanity check that an explicitly distrusted certificate only has trust
|
||||
# purposes with a trust level of NOT_TRUSTED.
|
||||
#
|
||||
# Certificate objects that are explicitly distrusted are in a certificate
|
||||
# block that starts # Certificate "Explicitly Distrust(ed) <certname>",
|
||||
# where "Explicitly Distrust(ed) " was prepended to the original cert name.
|
||||
if($caname =~ /distrust/i ||
|
||||
$main_block_name =~ /distrust/i ||
|
||||
$trust_block_name =~ /distrust/i) {
|
||||
my @levels = keys %trust_purposes_by_level;
|
||||
if(scalar(@levels) != 1 || $levels[0] ne "NOT_TRUSTED") {
|
||||
die "\"$caname\" must have all trust purposes at level NOT_TRUSTED.";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !should_output_cert(%trust_purposes_by_level) ) {
|
||||
$skipnum ++;
|
||||
report "Skipping: $caname lacks acceptable trust level" if ($opt_v);
|
||||
} else {
|
||||
my $encoded = MIME::Base64::encode_base64($cka_value, '');
|
||||
$encoded =~ s/(.{1,${opt_w}})/$1\n/g;
|
||||
my $pem = "-----BEGIN CERTIFICATE-----\n"
|
||||
. $encoded
|
||||
. "-----END CERTIFICATE-----\n";
|
||||
print CRT "\n$caname\n";
|
||||
my $maxStringLength = length(decode('UTF-8', $caname, Encode::FB_CROAK | Encode::LEAVE_SRC));
|
||||
print CRT ("=" x $maxStringLength . "\n");
|
||||
if ($opt_t) {
|
||||
foreach my $key (sort keys %trust_purposes_by_level) {
|
||||
my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}});
|
||||
print CRT $string . "\n";
|
||||
}
|
||||
}
|
||||
if($opt_m) {
|
||||
print CRT for @precert;
|
||||
}
|
||||
if (!$opt_t) {
|
||||
print CRT $pem;
|
||||
} else {
|
||||
my $pipe = "";
|
||||
foreach my $hash (@included_signature_algorithms) {
|
||||
$pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM";
|
||||
if (!$stdout) {
|
||||
$pipe .= " >> $crt.~";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!";
|
||||
}
|
||||
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
|
||||
print TMP $pem;
|
||||
close(TMP) or die "Couldn't close openssl pipe: $!";
|
||||
if (!$stdout) {
|
||||
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
|
||||
}
|
||||
}
|
||||
$pipe = "|$openssl x509 -text -inform PEM";
|
||||
if (!$stdout) {
|
||||
$pipe .= " >> $crt.~";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!";
|
||||
}
|
||||
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
|
||||
print TMP $pem;
|
||||
close(TMP) or die "Couldn't close openssl pipe: $!";
|
||||
if (!$stdout) {
|
||||
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
|
||||
}
|
||||
}
|
||||
report "Processed: $caname" if ($opt_v);
|
||||
$certnum ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(TXT) or die "Couldn't close $txt: $!\n";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!\n";
|
||||
unless( $stdout ) {
|
||||
if ($opt_b && -e $crt) {
|
||||
my $bk = 1;
|
||||
while (-e "$crt.~${bk}~") {
|
||||
$bk++;
|
||||
}
|
||||
rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n";
|
||||
} elsif( -e $crt ) {
|
||||
unlink( $crt ) or die "Failed to remove $crt: $!\n";
|
||||
}
|
||||
rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
|
||||
}
|
||||
if($opt_u && -e $txt && !unlink($txt)) {
|
||||
report "Failed to remove $txt: $!\n";
|
||||
}
|
||||
report "Done ($certnum CA certs processed, $skipnum skipped).";
|
192
third_party/curl/scripts/nroff2cd
vendored
Executable file
192
third_party/curl/scripts/nroff2cd
vendored
Executable file
@ -0,0 +1,192 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 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.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.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
=begin comment
|
||||
|
||||
This script converts an nroff file to curldown
|
||||
|
||||
Example: cd2nroff [options] <file.md> > <file.3>
|
||||
|
||||
Note: when converting .nf sections, this tool does not know if the
|
||||
section is code or just regular quotes. It then assumes and uses ~~~c
|
||||
for code.
|
||||
|
||||
=end comment
|
||||
=cut
|
||||
|
||||
my $nroff2cd = "0.1"; # to keep check
|
||||
|
||||
sub single {
|
||||
my ($f)=@_;
|
||||
open(F, "<:crlf", "$f") ||
|
||||
return 1;
|
||||
my $line;
|
||||
my $title;
|
||||
my $section;
|
||||
my $source;
|
||||
my @seealso;
|
||||
my @desc;
|
||||
my $header; # non-zero when TH is passed
|
||||
my $quote = 0; # quote state
|
||||
while(<F>) {
|
||||
$line++;
|
||||
my $d = $_;
|
||||
if($_ =~ /^.\\\"/) {
|
||||
# a comment we can ignore
|
||||
next;
|
||||
}
|
||||
if(!$header) {
|
||||
if($d =~ /.so (.*)/) {
|
||||
# this is basically an include, so do that
|
||||
my $f = $1;
|
||||
# remove leading directory
|
||||
$f =~ s/(.*?\/)//;
|
||||
close(F);
|
||||
open(F, "<:crlf", "$f") || return 1;
|
||||
}
|
||||
if($d =~ /^\.TH ([^ ]*) (\d) \"(.*?)\" ([^ \n]*)/) {
|
||||
# header, this needs to be the first thing after leading comments
|
||||
$title = $1;
|
||||
$section = $2;
|
||||
# date is $3
|
||||
$source = $4;
|
||||
# if there are enclosing quotes around source, remove them
|
||||
$source =~ s/[\"\'](.*)[\"\']\z/$1/;
|
||||
$header = 1;
|
||||
|
||||
print <<HEAD
|
||||
---
|
||||
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
SPDX-License-Identifier: curl
|
||||
Title: $title
|
||||
Section: $section
|
||||
Source: $source
|
||||
HEAD
|
||||
;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
if($quote) {
|
||||
if($d =~ /^\.SH/) {
|
||||
#end of quote without an .fi
|
||||
$quote = 0;
|
||||
push @desc, "~~~\n";
|
||||
}
|
||||
elsif($d =~ /^\.fi/) {
|
||||
#end of quote
|
||||
$quote = 0;
|
||||
push @desc, "~~~\n";
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# double-backslashes converted to single ones
|
||||
$d =~ s/\\\\/\\/g;
|
||||
push @desc, $d;
|
||||
next;
|
||||
}
|
||||
}
|
||||
if($d =~ /^\.SH (.*)/) {
|
||||
my $word = $1;
|
||||
# if there are enclosing quotes, remove them first
|
||||
$word =~ s/[\"\'](.*)[\"\']\z/$1/;
|
||||
if($word eq "SEE ALSO") {
|
||||
# we just slurp up this section
|
||||
next;
|
||||
}
|
||||
push @desc, "\n# $word\n\n";
|
||||
}
|
||||
elsif($d =~ /^\.(RS|RE)/) {
|
||||
# ignore these
|
||||
}
|
||||
elsif($d =~ /^\.IP (.*)/) {
|
||||
my $word = $1;
|
||||
# if there are enclosing quotes, remove them first
|
||||
$word =~ s/[\"\'](.*)[\"\']\z/$1/;
|
||||
push @desc, "\n## $word\n\n";
|
||||
}
|
||||
elsif($d =~ /^\.IP/) {
|
||||
# .IP with no text we just skip
|
||||
}
|
||||
elsif($d =~ /^\.BR (.*)/) {
|
||||
# only used for SEE ALSO
|
||||
my $word = $1;
|
||||
# remove trailing comma
|
||||
$word =~ s/,\z//;
|
||||
|
||||
for my $s (split(/,/, $word)) {
|
||||
# remove all double quotes
|
||||
$s =~ s/\"//g;
|
||||
# tream leading whitespace
|
||||
$s =~ s/^ +//g;
|
||||
push @seealso, $s;
|
||||
}
|
||||
}
|
||||
elsif($d =~ /^\.I (.*)/) {
|
||||
push @desc, "*$1*\n";
|
||||
}
|
||||
elsif($d =~ /^\.B (.*)/) {
|
||||
push @desc, "**$1**\n";
|
||||
}
|
||||
elsif($d =~ /^\.nf/) {
|
||||
push @desc, "~~~c\n";
|
||||
$quote = 1;
|
||||
}
|
||||
else {
|
||||
# embolden
|
||||
$d =~ s/\\fB(.*?)\\fP/**$1**/g;
|
||||
# links to "curl.*()" are left bare since cd2nroff handles them
|
||||
# specially
|
||||
$d =~ s/\\fI(curl.*?\(3\))\\fP/$1/ig;
|
||||
# emphasize
|
||||
$d =~ s/\\fI(.*?)\\fP/*$1*/g;
|
||||
# emphasize on a split line
|
||||
$d =~ s/\\fI/*/g;
|
||||
# bold on a split line
|
||||
$d =~ s/\\fB/**/g;
|
||||
# remove backslash amp
|
||||
$d =~ s/\\&//g;
|
||||
# remove backslashes
|
||||
$d =~ s/\\//g;
|
||||
# fix single quotes
|
||||
$d =~ s/\(aq/'/g;
|
||||
# fix double quotes
|
||||
$d =~ s/\(dq/\"/g;
|
||||
push @desc, $d;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
|
||||
print "See-also:\n";
|
||||
for my $s (sort @seealso) {
|
||||
print " - $s\n" if($s);
|
||||
}
|
||||
print "---\n";
|
||||
print @desc;
|
||||
|
||||
return !$header;
|
||||
}
|
||||
|
||||
exit single($ARGV[0]);
|
207
third_party/curl/scripts/schemetable.c
vendored
Normal file
207
third_party/curl/scripts/schemetable.c
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 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.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.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/*
|
||||
* Use this tool to generate an updated table for the Curl_getn_scheme_handler
|
||||
* function in url.c.
|
||||
*/
|
||||
|
||||
struct detail {
|
||||
const char *n;
|
||||
const char *ifdef;
|
||||
};
|
||||
|
||||
static const struct detail scheme[] = {
|
||||
{"dict", "#ifndef CURL_DISABLE_DICT" },
|
||||
{"file", "#ifndef CURL_DISABLE_FILE" },
|
||||
{"ftp", "#ifndef CURL_DISABLE_FTP" },
|
||||
{"ftps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)" },
|
||||
{"gopher", "#ifndef CURL_DISABLE_GOPHER" },
|
||||
{"gophers", "#if defined(USE_SSL) && !defined(CURL_DISABLE_GOPHER)" },
|
||||
{"http", "#ifndef CURL_DISABLE_HTTP" },
|
||||
{"https", "#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{"imap", "#ifndef CURL_DISABLE_IMAP" },
|
||||
{"imaps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)" },
|
||||
{"ldap", "#ifndef CURL_DISABLE_LDAP" },
|
||||
{"ldaps", "#if !defined(CURL_DISABLE_LDAP) && \\\n"
|
||||
" !defined(CURL_DISABLE_LDAPS) && \\\n"
|
||||
" ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \\\n"
|
||||
" (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))" },
|
||||
{"mqtt", "#ifndef CURL_DISABLE_MQTT" },
|
||||
{"pop3", "#ifndef CURL_DISABLE_POP3" },
|
||||
{"pop3s", "#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)" },
|
||||
{"rtmp", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpt", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpe", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpte", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmps", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpts", "#ifdef USE_LIBRTMP" },
|
||||
{"rtsp", "#ifndef CURL_DISABLE_RTSP" },
|
||||
{"scp", "#if defined(USE_SSH) && !defined(USE_WOLFSSH)" },
|
||||
{"sftp", "#if defined(USE_SSH)" },
|
||||
{"smb", "#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \\\n"
|
||||
" (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smbs", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMB) && \\\n"
|
||||
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smtp", "#ifndef CURL_DISABLE_SMTP" },
|
||||
{"smtps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)" },
|
||||
{"telnet", "#ifndef CURL_DISABLE_TELNET" },
|
||||
{"tftp", "#ifndef CURL_DISABLE_TFTP" },
|
||||
{"ws", "#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{"wss", "#if defined(USE_WEBSOCKETS) && \\\n"
|
||||
" defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
unsigned int calc(const char *s, int add, int shift)
|
||||
{
|
||||
const char *so = s;
|
||||
unsigned int c = add;
|
||||
while(*s) {
|
||||
c <<= shift;
|
||||
c += *s;
|
||||
s++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
unsigned int num[100];
|
||||
unsigned int ix[100];
|
||||
|
||||
static void showtable(int try, int init, int shift)
|
||||
{
|
||||
int nulls = 0;
|
||||
int i;
|
||||
for(i = 0; scheme[i].n; ++i)
|
||||
num[i] = calc(scheme[i].n, init, shift);
|
||||
for(i = 0; scheme[i].n; ++i)
|
||||
ix[i] = num[i] % try;
|
||||
printf("/*\n"
|
||||
" unsigned int c = %d\n"
|
||||
" while(l) {\n"
|
||||
" c <<= %d;\n"
|
||||
" c += Curl_raw_tolower(*s);\n"
|
||||
" s++;\n"
|
||||
" l--;\n"
|
||||
" }\n"
|
||||
"*/\n", init, shift);
|
||||
|
||||
printf(" static const struct Curl_handler * const protocols[%d] = {", try);
|
||||
|
||||
/* generate table */
|
||||
for(i=0; i < try; i++) {
|
||||
int match = 0;
|
||||
int j;
|
||||
for(j=0; scheme[j].n; j++) {
|
||||
if(ix[j] == i) {
|
||||
printf("\n");
|
||||
printf("%s\n", scheme[j].ifdef);
|
||||
printf(" &Curl_handler_%s,\n", scheme[j].n);
|
||||
printf("#else\n NULL,\n");
|
||||
printf("#endif");
|
||||
match = 1;
|
||||
nulls = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!match) {
|
||||
if(!nulls || (nulls>10)) {
|
||||
printf("\n ");
|
||||
nulls = 0;
|
||||
}
|
||||
printf(" NULL,", nulls);
|
||||
nulls++;
|
||||
}
|
||||
}
|
||||
printf("\n };\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int try;
|
||||
int besttry = 9999;
|
||||
int bestadd = 0;
|
||||
int bestshift = 0;
|
||||
int add;
|
||||
int shift;
|
||||
for(shift = 0; shift < 8; shift++) {
|
||||
for(add = 0; add < 999; add++) {
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
unsigned int v = calc(scheme[i].n, add, shift);
|
||||
int j;
|
||||
int badcombo = 0;
|
||||
for(j=0; j < i; j++) {
|
||||
|
||||
if(num[j] == v) {
|
||||
/*
|
||||
printf("NOPE: %u is a dupe (%s and %s)\n",
|
||||
v, scheme[i], scheme[j]);
|
||||
*/
|
||||
badcombo = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(badcombo)
|
||||
break;
|
||||
num[i] = v;
|
||||
}
|
||||
#if 0
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
printf("%u - %s\n", num[i], scheme[i].n);
|
||||
}
|
||||
#endif
|
||||
/* try different remainders to find smallest possible table */
|
||||
for(try = 28; try < 199; try++) {
|
||||
int good = 1;
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
ix[i] = num[i] % try;
|
||||
}
|
||||
/* check for dupes */
|
||||
for(i = 0; scheme[i].n && good; ++i) {
|
||||
int j;
|
||||
for(j=0; j < i; j++) {
|
||||
if(ix[j] == ix[i]) {
|
||||
/* printf("NOPE, try %u causes dupes (%d and %d)\n", try, j, i); */
|
||||
good = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(good) {
|
||||
if(try < besttry) {
|
||||
besttry = try;
|
||||
bestadd = add;
|
||||
bestshift = shift;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showtable(besttry, bestadd, bestshift);
|
||||
}
|
Reference in New Issue
Block a user