/***************************************************************************
 *                                  _   _ ____  _
 *  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 "tool_setup.h"

#if defined(_WIN32) || defined(MSDOS)

#include "curlx/basename.h" /* for curlx_basename() */
#include "curlx/version_win32.h" /* for curlx_verify_windows_version() */

#ifdef _WIN32
#  include <tlhelp32.h>
#elif !defined(__DJGPP__) || (__DJGPP__ < 2)  /* DJGPP 2.0 has _use_lfn() */
#  define CURL_USE_LFN(f) 0  /* long filenames never available */
#elif defined(__DJGPP__)
#  include <fcntl.h>         /* for _use_lfn(f) prototype */
#  define CURL_USE_LFN(f) _use_lfn(f)
#endif

#include "tool_cfgable.h"
#include "tool_doswin.h"
#include "tool_msgs.h"

#ifdef MSDOS

#ifndef S_ISCHR
#  ifdef S_IFCHR
#    define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#  else
#    define S_ISCHR(m) 0 /* cannot tell if file is a device */
