C89 is missing some nice things. As is MSVC. This adds the string related functionality for:
- Windows
- MSVC 2005
- MSVC 2022 (should support all other versions also)
- MinGW
- Cygwin
- Open Watcom 2.0 (including DOS target)
- SunOS
- Linux
- *BSD
- macOS
Everything is hidden behind ifdef
s so if the compiler/OS supports the function, that function will be used instead of the one provided by this library.
Function | Citation |
---|---|
strcasestr |
From MUSL |
strncasecmp |
Alias for MSVC's _strnicmp |
strcasecmp |
Alias for MSVC's _stricmp |
snprintf |
Mostly from WTF_StringExtras |
vsnprintf |
Mostly from WTF_StringExtras |
strnstr |
Mostly from WTF_StringExtras |
strerrorlen_s |
From Safe C Library |
asprintf |
From libressl-portable |
Additionally jasprintf
, a version of asprintf
that concatenates on successive calls.
- CMake (3.11 for MSVC 2005 or newer versions for other targets)
- C compiler (any that work with CMake, and were released within the last 30 years)
mkdir build && cd build
cmake ..
cmake --build .
ctest -C Debug
Build, test, and package for:
- Cygwin;
- MinGW (32-bit and 64-bit);
- MSVC 2005 (32-bit and 64-bit);
- MSVC 2022 (32-bit and 64-bit);
- OpenWatcom's DOS target (16-bit).
…by running in Command Prompt: https://github.com/offscale/win-cmake-multi-build
(also handles upload to GitHub Releases)
With cmake-3.11.4 specified, do:
mkdir build_msvc2005 && cd build_msvc2005
cmake-3.11.4-win64-x64\bin\cmake -DCMAKE_WARN_VS8=OFF -DCMAKE_BUILD_TYPE="Debug" -G "Visual Studio 8 2005" ..
cmake-3.11.4-win64-x64\bin\cmake --build .
cmake-3.11.4-win64-x64\bin\ctest -C Debug
(the last two commands can be run by opening the solution in Visual Studio 2005)
Alternatively with newer versions of CMake (tested 3.26.3):
mkdir build_msvc_nmake2005 && cd build_msvc_nmake2005
cmake -DCMAKE_BUILD_TYPE="Debug" -G "NMake Makefiles" ..
cmake --build .
ctest -C Debug
With v2 from https://github.com/open-watcom/open-watcom-v2/releases installed:
[path]\WATCOM\owsetenv.bat
mkdir build_dos && cd build_dos
cmake -G "Watcom WMake" -D CMAKE_SYSTEM_NAME "DOS" -D CMAKE_SYSTEM_PROCESSOR "I86" ..
cmake --build .
ctest -C Debug
(that test phase might fail if you're running this on a non-DOS host)
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.