endif()
set(HAVE_SENDMSG 1)
set(HAVE_SETLOCALE 1)
-if(CYGWIN OR
- CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(HAVE_SETMODE 0)
-else()
- set(HAVE_SETMODE 1)
-endif()
set(HAVE_SETRLIMIT 1)
set(HAVE_SETSOCKOPT_SO_NONBLOCK 0)
set(HAVE_SIGACTION 1)
set(HAVE_UTIMES 1)
set(HAVE_UTIME_H 1)
set(HAVE_WRITABLE_ARGV 1)
-if(CYGWIN)
- set(HAVE__SETMODE 1)
-endif()
set(STDC_HEADERS 1)
set(USE_UNIX_SOCKETS 1)
set(HAVE_SENDMMSG 0)
set(HAVE_SENDMSG 0)
set(HAVE_SETLOCALE 1)
-set(HAVE_SETMODE 1)
set(HAVE_SETRLIMIT 0)
set(HAVE_SETSOCKOPT_SO_NONBLOCK 0)
set(HAVE_SIGACTION 0)
set(HAVE_TIME_T_UNSIGNED 0)
set(HAVE_UTIME 1)
set(HAVE_UTIMES 0)
-set(HAVE__SETMODE 1)
set(STDC_HEADERS 1)
# Types and sizes
check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI)
endif()
-check_function_exists("setmode" HAVE_SETMODE)
-if(WIN32 OR CYGWIN)
- check_function_exists("_setmode" HAVE__SETMODE)
-endif()
-
if(AMIGA)
check_symbol_exists("CloseSocket" "${CURL_INCLUDES}" HAVE_CLOSESOCKET_CAMEL) # sys/socket.h proto/bsdsocket.h
endif()
if test "$curl_cv_winuwp" = "yes"; then
curl_pflags="${curl_pflags} UWP"
fi
- if test "$curl_cv_cygwin" = "yes"; then
- curl_pflags="${curl_pflags} CYGWIN"
- fi
+ case $host_os in
+ cygwin*|msys*) curl_pflags="${curl_pflags} CYGWIN";;
+ esac
case $host_os in
msdos*) curl_pflags="${curl_pflags} DOS";;
amiga*) curl_pflags="${curl_pflags} AMIGA";;
CURL_SUPPORTS_BUILTIN_AVAILABLE
fi
-curl_cv_cygwin='no'
-case $host_os in
- cygwin*|msys*) curl_cv_cygwin='yes';;
-esac
-
AM_CONDITIONAL([HAVE_WINDRES],
[test "$curl_cv_native_windows" = "yes" && test -n "${RC}"])
CURL_CHECK_FUNC_STRICMP
fi
-AC_CHECK_FUNCS([setmode])
-if test "$curl_cv_native_windows" = "yes" || test "$curl_cv_cygwin" = "yes"; then
- AC_CHECK_FUNCS([_setmode])
-fi
-
if test -z "$ssl_backends"; then
AC_CHECK_FUNCS([arc4random])
fi
LIB_CURLX_HFILES = \
curlx/base64.h \
- curlx/binmode.h \
curlx/basename.h \
curlx/curlx.h \
curlx/dynbuf.h \
/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1
-/* Define if you have the setmode function. */
-#define HAVE_SETMODE 1
-
-/* Define if you have the _setmode function. */
-#define HAVE__SETMODE 1
-
/* Define if you have the socket function. */
#define HAVE_SOCKET 1
/* Define to 1 if you have the `setlocale' function. */
#cmakedefine HAVE_SETLOCALE 1
-/* Define to 1 if you have the `setmode' function. */
-#cmakedefine HAVE_SETMODE 1
-
-/* Define to 1 if you have the `_setmode' function. */
-#cmakedefine HAVE__SETMODE 1
-
/* Define to 1 if you have the `setrlimit' function. */
#cmakedefine HAVE_SETRLIMIT 1
/* Since O_BINARY is used in bitmasks, setting it to zero makes it usable in
source code but yet it does not ruin anything */
-#ifdef _O_BINARY /* for _WIN32 */
+#ifdef _O_BINARY /* for _WIN32 || MSDOS */
#define CURL_O_BINARY _O_BINARY
-#elif defined(O_BINARY)
+#elif defined(O_BINARY) /* __CYGWIN__ */
#define CURL_O_BINARY O_BINARY
#else
#define CURL_O_BINARY 0
#endif
+/* Requires io.h when available */
+#ifdef MSDOS
+#define CURL_BINMODE(stream) (void)setmode(fileno(stream), CURL_O_BINARY)
+#elif defined(_WIN32) || defined(__CYGWIN__)
+#define CURL_BINMODE(stream) (void)_setmode(fileno(stream), CURL_O_BINARY)
+#else
+#define CURL_BINMODE(stream) (void)stream
+#endif
+
/* In Windows the default file mode is text but an application can override it.
Therefore we specify it explicitly. https://github.com/curl/curl/pull/258
*/
+++ /dev/null
-#ifndef HEADER_CURL_TOOL_BINMODE_H
-#define HEADER_CURL_TOOL_BINMODE_H
-/***************************************************************************
- * _ _ ____ _
- * 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 "../curl_setup.h"
-
-#if (defined(HAVE_SETMODE) || defined(HAVE__SETMODE)) && defined(O_BINARY)
-/* Requires io.h and/or fcntl.h when available */
-#ifdef HAVE__SETMODE
-# define CURLX_SET_BINMODE(stream) (void)_setmode(fileno(stream), O_BINARY)
-#else
-# define CURLX_SET_BINMODE(stream) (void)setmode(fileno(stream), O_BINARY)
-#endif
-#else
-# define CURLX_SET_BINMODE(stream) (void)stream
-#endif
-
-#endif /* HEADER_CURL_TOOL_BINMODE_H */
#include "base64.h" /* for curlx_base64* */
#include "basename.h" /* for curlx_basename() */
-#include "binmode.h" /* for macro CURLX_SET_BINMODE() */
#include "dynbuf.h" /* for curlx_dyn_*() */
#include "fopen.h" /* for curlx_f*() */
#include "inet_ntop.h" /* for curlx_inet_ntop() */
../lib/curl_setup.h \
../lib/curlx/base64.h \
../lib/curlx/basename.h \
- ../lib/curlx/binmode.h \
../lib/curlx/dynbuf.h \
../lib/curlx/fopen.h \
../lib/curlx/multibyte.h \
curl_off_t origin;
curlx_struct_stat sbuf;
- CURLX_SET_BINMODE(stdin);
+ CURL_BINMODE(stdin);
origin = ftell(stdin);
/* If stdin is a regular file, do not buffer data but read it
when needed. */
/* a '@' letter, it means that a filename or - (stdin) follows */
if(!strcmp("-", p)) {
file = stdin;
- CURLX_SET_BINMODE(stdin);
+ CURL_BINMODE(stdin);
}
else {
file = curlx_fopen(p, "rb");
if(!strcmp("-", nextarg)) {
file = stdin;
if(cmd == C_DATA_BINARY) /* forced data-binary */
- CURLX_SET_BINMODE(stdin);
+ CURL_BINMODE(stdin);
}
else {
file = curlx_fopen(nextarg, "rb");
}
else {
/* always use binary mode for protocol header output */
- CURLX_SET_BINMODE(etag_save->stream);
+ CURL_BINMODE(etag_save->stream);
}
return CURLE_OK;
}
if(!strcmp(config->headerfile, "%")) {
heads->stream = stderr;
/* use binary mode for protocol header output */
- CURLX_SET_BINMODE(heads->stream);
+ CURL_BINMODE(heads->stream);
}
else if(strcmp(config->headerfile, "-")) {
FILE *newfile;
}
else {
/* always use binary mode for protocol header output */
- CURLX_SET_BINMODE(heads->stream);
+ CURL_BINMODE(heads->stream);
}
return CURLE_OK;
}
DEBUGASSERT(per->infdopen == FALSE);
DEBUGASSERT(per->infd == STDIN_FILENO);
- CURLX_SET_BINMODE(stdin);
+ CURL_BINMODE(stdin);
if(!strcmp(per->uploadfile, ".")) {
#if defined(USE_WINSOCK) && !defined(CURL_WINDOWS_UWP)
/* non-blocking stdin behavior on Windows is challenging
!config->use_ascii) {
/* We get the output to stdout and we have not got the ASCII/text flag,
then set stdout to be binary */
- CURLX_SET_BINMODE(stdout);
+ CURL_BINMODE(stdout);
}
/* explicitly passed to stdout means okaying binary gunk */
const char *env;
size_t tmp;
- CURLX_SET_BINMODE(stdout);
+ CURL_BINMODE(stdout);
memory_tracking_init();
#ifdef _WIN32
snprintf(loglockfile, sizeof(loglockfile), "%s/%s/mqtt-%s.lock",
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
- CURLX_SET_BINMODE(stdin);
- CURLX_SET_BINMODE(stdout);
- CURLX_SET_BINMODE(stderr);
+ CURL_BINMODE(stdin);
+ CURL_BINMODE(stdout);
+ CURL_BINMODE(stderr);
install_signal_handlers(FALSE);
}
}
- CURLX_SET_BINMODE(stdin);
- CURLX_SET_BINMODE(stdout);
- CURLX_SET_BINMODE(stderr);
+ CURL_BINMODE(stdin);
+ CURL_BINMODE(stdout);
+ CURL_BINMODE(stderr);
install_signal_handlers(false);
}
}
- CURLX_SET_BINMODE(stdin);
- CURLX_SET_BINMODE(stdout);
- CURLX_SET_BINMODE(stderr);
+ CURL_BINMODE(stdin);
+ CURL_BINMODE(stdout);
+ CURL_BINMODE(stderr);
install_signal_handlers(false);