diff --git a/.github/workflows/ci-cell.yml b/.github/workflows/ci-cell.yml new file mode 100644 index 0000000..5331b72 --- /dev/null +++ b/.github/workflows/ci-cell.yml @@ -0,0 +1,289 @@ +name: CI cell + +on: + workflow_call: + inputs: + cell-id: + required: true + type: string + os: + required: true + type: string + c-compiler: + required: true + type: string + cpp-compiler: + required: true + type: string + build-type: + required: false + type: string + default: Release + +jobs: + build: + name: Build (${{ inputs.cell-id }}) + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + + - name: Install test dependencies (STLSoft + shwild + xTests) + shell: bash + run: | + set -euxo pipefail + + DEPS="${RUNNER_TEMP}/sis-deps" + STLSRC="${RUNNER_TEMP}/stlsoft-src" + STLBUILD="${RUNNER_TEMP}/stlsoft-build" + SHWSRC="${RUNNER_TEMP}/shwild-src" + SHWBUILD="${RUNNER_TEMP}/shwild-build" + XTSRC="${RUNNER_TEMP}/xtests-src" + XTBUILD="${RUNNER_TEMP}/xtests-build" + + mkdir -p "$DEPS" + + # 1. STLSoft + git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$STLSRC" -B "$STLBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$STLBUILD" --config "${{ inputs.build-type }}" + else + export PATH="/mingw64/bin:$PATH" + cmake -S "$STLSRC" -B "$STLBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$STLBUILD" --parallel 2 + cmake --install "$STLBUILD" + fi + + # 2. shwild + git clone --depth 1 https://github.com/synesissoftware/shwild "$SHWSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$SHWSRC" -B "$SHWBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$SHWBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$SHWBUILD" --config "${{ inputs.build-type }}" + else + export PATH="/mingw64/bin:$PATH" + cmake -S "$SHWSRC" -B "$SHWBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$SHWBUILD" --parallel 2 + cmake --install "$SHWBUILD" + fi + + # 3. xTests + git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC" + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -S "$XTSRC" -B "$XTBUILD" \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$XTBUILD" --config "${{ inputs.build-type }}" --parallel + cmake --install "$XTBUILD" --config "${{ inputs.build-type }}" + else + export PATH="/mingw64/bin:$PATH" + cmake -S "$XTSRC" -B "$XTBUILD" -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_INSTALL_PREFIX="$DEPS" \ + -DCMAKE_PREFIX_PATH="$DEPS" \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + cmake --build "$XTBUILD" --parallel 2 + cmake --install "$XTBUILD" + fi + + - name: Configure + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake -B build -S . \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_TESTING=ON + else + export PATH="/mingw64/bin:$PATH" + cmake -B build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ inputs.build-type }}" \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DCMAKE_PREFIX_PATH="${RUNNER_TEMP}/sis-deps" \ + -DBUILD_EXAMPLES=ON \ + -DBUILD_TESTING=ON + fi + + - name: Build + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "cl" ]; then + cmake --build build --config "${{ inputs.build-type }}" --parallel + else + export PATH="/mingw64/bin:$PATH" + cmake --build build --parallel 2 + fi + + - name: Upload build tree + uses: actions/upload-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + retention-days: 1 + + run-examples: + name: Examples (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run examples + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_examples.sh -M + + test-unit: + name: Unit tests (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run unit tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + export SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" + # Prefer .cmd on Windows (MSVC/MinGW) for reliable .exe discovery — see sistools/realpath + cmd.exe //c "run_all_unit_tests.cmd -M -v --unit-only" + + test-component: + name: Component tests (${{ inputs.cell-id }}) + needs: build + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run component tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + export SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" + cmd.exe //c "run_all_unit_tests.cmd -M -v --component-only" + + test-scratch: + name: Scratch tests (${{ inputs.cell-id }}) + needs: build + continue-on-error: true + runs-on: ${{ inputs.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: inputs.c-compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: mingw-w64-x86_64-toolchain + + - name: Download build tree + uses: actions/download-artifact@v4 + with: + name: sis-build-${{ inputs.cell-id }} + path: build + + - name: Run scratch tests + shell: bash + run: | + set -euo pipefail + if [ "${{ inputs.c-compiler }}" = "mingw" ]; then + export PATH="/mingw64/bin:$PATH" + fi + SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/build" ./run_all_scratch_tests.sh -M diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8bbcf0e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,152 @@ +name: CI + +on: + push: + branches: + - master + - dev + - boilerplate + - idiomatic + - rc1 + - rc2 + - rc3 + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + BUILD_TYPE: Release + +jobs: + cell: + name: CI (${{ matrix.id }}) + strategy: + fail-fast: false + matrix: + include: + - id: windows-cl + os: windows-latest + c_compiler: cl + cpp_compiler: cl + - id: windows-mingw + os: windows-latest + c_compiler: mingw + cpp_compiler: g++ + uses: ./.github/workflows/ci-cell.yml + with: + cell-id: ${{ matrix.id }} + os: ${{ matrix.os }} + c-compiler: ${{ matrix.c_compiler }} + cpp-compiler: ${{ matrix.cpp_compiler }} + build-type: Release + + install-smoke: + name: Install smoke (${{ matrix.os }}, ${{ matrix.c_compiler }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + c_compiler: cl + cpp_compiler: cl + - os: windows-latest + c_compiler: mingw + cpp_compiler: g++ + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 MinGW + if: matrix.c_compiler == 'mingw' + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-make + + - name: Configure + shell: bash + run: | + set -euo pipefail + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake -B build -S . \ + -DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + else + export PATH="/mingw64/bin:$PATH" + cmake -B build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_C_COMPILER=gcc \ + -DCMAKE_CXX_COMPILER=g++ \ + -DBUILD_EXAMPLES=OFF \ + -DBUILD_TESTING=OFF + fi + + - name: Build + shell: bash + run: | + set -euo pipefail + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake --build build --config "${{ env.BUILD_TYPE }}" --parallel + else + export PATH="/mingw64/bin:$PATH" + cmake --build build --parallel 2 + fi + + - name: Install + shell: bash + run: | + set -euo pipefail + PREFIX="${RUNNER_TEMP}/install-prefix" + echo "INSTALL_PREFIX=$PREFIX" >> "$GITHUB_ENV" + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake --install build --config "${{ env.BUILD_TYPE }}" --prefix "$PREFIX" + else + export PATH="/mingw64/bin:$PATH" + cmake --install build --prefix "$PREFIX" + fi + + - name: Verify install tree + shell: bash + run: | + set -euo pipefail + test -f "${INSTALL_PREFIX}/include/unixem/unixem.h" + test -f "${INSTALL_PREFIX}/lib/cmake/unixem/unixem-config.cmake" + + - name: Configure and run install smoke consumer + shell: bash + run: | + set -euo pipefail + CONSUMER="${RUNNER_TEMP}/consumer" + mkdir -p "$CONSUMER" + cat > "$CONSUMER/CMakeLists.txt" <<'EOF' + cmake_minimum_required(VERSION 3.20) + project(unixem_install_smoke C) + find_package(unixem REQUIRED) + add_executable(consumer consumer.c) + target_link_libraries(consumer PRIVATE UNIXem::UNIXem) + EOF + cat > "$CONSUMER/consumer.c" <<'EOF' + #include + int main(void) { return 0; } + EOF + if [ "${{ matrix.c_compiler }}" = "cl" ]; then + cmake -S "$CONSUMER" -B consumer-build \ + -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}" + cmake --build consumer-build --config "${{ env.BUILD_TYPE }}" --parallel + consumer-build/${{ env.BUILD_TYPE }}/consumer.exe + else + export PATH="/mingw64/bin:$PATH" + cmake -S "$CONSUMER" -B consumer-build -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \ + -DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}" + cmake --build consumer-build --parallel 2 + consumer-build/consumer.exe + fi diff --git a/.sis/project_name.txt b/.sis/project_name.txt new file mode 100644 index 0000000..06713ce --- /dev/null +++ b/.sis/project_name.txt @@ -0,0 +1 @@ +UNIXem diff --git a/AUTHORS.md b/AUTHORS.md index 6e1295a..43416ae 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,22 +1,23 @@ -# UNIXem - Authors +# UNIXem - Authors + ## Major Contributors: - Matthew Wilson +* Matthew Wilson ## Defect reports, fixes and suggestions (for which we are very grateful): - | Contributor | Contribution(s) | - | ------------------- | --------------------------------------------- | - | chen1088 | merge request assistance | - | Marc Treib | `gettimeofday()` return type | - | Mikko Koivunalho | **CMake** support | - | Paulo Custodio | fixing syntax errors in header(s) | - | zydxhs | project documentation | +| Contributor | Contribution(s) | +| ---------------- | ----------------------------------- | +| chen1088 | merge request assistance | +| Garth Lancaster | much useful feedback over the years | +| Marc Treib | `gettimeofday()` return type | +| Mikko Koivunalho | **CMake** support | +| Paulo Custodio | fixing syntax errors in header(s) | +| zydxhs | project documentation | Contributions are welcomed. - diff --git a/CHANGES.md b/CHANGES.md new file mode 100644 index 0000000..e499fd7 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1,198 @@ +# UNIXem - CHANGES + + +## 1.13.0-beta1 - 4th August 2026 + +* added modular GitHub Actions CI (**ci.yml** / **ci-cell.yml**) for Windows (MSVC + MinGW) with install-smoke coverage; +* converted **CHANGES.txt** to **CHANGES.md** and removed **HISTORY.md**; +* expanded **FAQ.md**, **INSTALL.md**, and **README.md** (incl. CI badges and Components tables); +* fixed **CMakeLists.txt** so **STLSoft** is required only when **BUILD_TESTING** is enabled (removed erroneous **NO_B64_CPP_API** guard); +* **CMake** now fails early on non-Windows hosts (`${PROJECT_NAME} targets Windows only`); +* removed Visual Studio project/solution/workspace files (**unixem.vc10.sln**, **unixem.vc6.dsw**, **projects/**, per-test **vc6**/**vc10** trees); +* project boilerplate canonicalisation (**AUTHORS.md**, **NEWS.md**, **TODO.md**, **.sis/**, **.vimrc**); +* CMake helper-script enhancements (**ProjectName** from **.sis/project_name.txt**; modernised **run_all_unit_tests.sh** / **run_all_unit_tests.cmd** with `--unit-only` / `--component-only`); +* added **LanguageFullVersion.cmake** and related CMake tidy; +* added **ctest_cmake.sh**; +* scratch programs **test.scratch.dlfcn**, **test.scratch.link**, and **test.scratch.uio** now smoke successfully with no arguments (defaults / self-path); + + +## 1.13.0-alpha1 - 7th September 2025 + +* version bump to **1.13.0**; +* project boilerplate canonicalisation begun (markdown docs, helper scripts, **LICENSE**); + + +## 1.12.8 - 19th May 2025 + +* `glob()` now provides a pseudo-random order when `GLOB_NOSORT` flag is specified; +* Added **UNIXem.Util.FS** API, and applied in refactoring some API functions; +* Added **UNIXem.Util.Str** API, and applied in refactoring some API functions; +* Expanded **test.component.dirent**; +* Expanded **test.component.glob**; +* Miscellaneous consistency improvements; +* CMake optional dependency on **shwild**; +* Standard names of implementation files of unit/component tests; + + +## 1.12.7 - 1st May 2025 + +* CMake support; +* MinGW support; +* `usleep()` now sleeps for (at least) 1ms when given sleep time in range 1-999 nanoseconds; +* Simplying `glob()` API; +* Simplified implementation of `unixem__setenv__putenv_()` (and avoided warnings w MinGW); +* Refactored discrimination of integer types; +* Refactored in terms of `unixem_internal_Windows_HANDLE_from_file_handle()`; +* Added **test.component.unistd.usleep**; +* **test.component.unistd.mkdtemp** ensures created temporary directories and temporary files are removed; +* **test.scratch.getrusage** ensures created temporary files are removed; +* Visual C++ warnings; +* VS Code settings; +* Removed support for Comeau compiler; +* Miscellaneous tidying and consistency fixes; +* Added .gitattributes; + + +## 1.12.6 - 17th December 2020 + +* compatibility with Visual Studio 2019 (16.8.2); + + +## 1.12.5 - 19th July 2020 + +* added support for Visual C++ 15 and 16; + + +## 1.12.4 - 19th July 2020 + +* refactored makefiles (in auto-generation); + + +## 1.12.3 - 14th October 2019 + +* added GCC 4.9 (MinGW) compatibility; + + +## 1.12.2 - 14th October 2019 + +* fixing generated library names to match implicit-link; +* fixed invalid value of 1.11.4's UNIXEM_VER by bumping minor version; +* added GCC 8.1 (MinGW) compatibility; + + +## 1.11.4 - 9th October 2019 + +* fixing up setenv() / unsetenv(); +* incorporating latest changes from GitHub repo; +* fleshing out README.md for the GitHub site; + + +## 1.11.2 - 2nd January 2017 + +* fixed name of built library prefix from "unixem.core.1.*" to "unixem.1.core.*"; +* moved build/vc6/unixem.dsp => projects/core/vc6/unixem.core.dsp; +* added VC++10 project and props files; + + +## 1.11.1 - 7th October 2015 + +* built library name prefix changes from "unixem" to "unixem.core"; +* added mkdtemp(); +* added mkstemp(); +* added VC++14 support; + + +## 1.10.2 - 25th September 2015 + +* minor fix to unixem_gettimeofday(); + + +## 1.10.1 - 30th July 2015 + +* added unixem_timegm() / timegm(); +* added VC++11 and VC++12 support; + + +## 1.9.3 - 16th June 2012 + +* GLOB_ONLYFILE => GLOB_ONLYREG; +* glob() now preserves dots directories when included in leaf-most pattern part; +* fix to definition of WIN32 when using WinSock; + + +## 1.9.2 - 4th February 2011 + +* removed include/sys/select.h (which was vestigial); +* various tidyings; +* handling EZERO, ERROR_FILE_TOO_LARGE, ERROR_DISK_TOO_FRAGMENTED (in unixem_internal_errno_from_Win32()); + + +## 1.9.1 - 12th August 2010 + +* reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros; +* 64-bit compatibility fixes; + + +## 1.8.5 - 13th August 2010 + +* gettimeofday() now returns int (instead of void); +* added VC++ 10 implicit-link support; + + +## 1.8.4 - 4th April 2010 + +* fixed erroneous library name in implicit link file; +* added VC++ 10 support; + + +## 1.8.3 - 6th February 2010 + +* refactored headers to resolve conflict(s) between unistd.h and winsock(2).h withouth using #define to prevent subsequent inclusion of winsock(2).h; +* added empty (placeholder) files: arpa/inet.h, netinet/in.h, sys/socket.h; +* fixed _M_X86 implicit link defect; +* added implicit link support for Borland 5.9+, 6.1+ and Intel C/C++ 9, 10, 11; +* changed library name/implicit link directives for VC++ x64/IA64 targets; +* added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build; +* various other minor changes; + + +## 1.8.2 - 13th May 2008 + +* Win64 compatibility; + + +## 1.8.1 - 22nd April 2008 + +* added gethostname(); +* added getpid(); +* changed 2nd param of gettimeofday() to void*; +* improved semantics for glob() when a pattern search in an existing directory matches no entries; + + +## 1.7.5 - 20th April 2008 + +* the distribution is now rooted at unixem-1.7.5/; +* makefiles for VC++ 8 & 9; +* implicit linking for Borland C/C++ 5.82; +* implicit linking for VC++ 9; +* bundles shwild 0.9.13; +* bundles xTests 0.6.1; +* makefiles for Visual C++ 8 & 9; + + +## 1.7.4 - 24th February 2008 + +* include/unixem/internal/safestr.h; +* safe string library for src/glob.c; +* improved handling of offsets and errors in src/mmap.c; +* safe string library for src/setenv.c; +* fixed bug in gettimeofday(), which was showing local time, rather than the required system time; + + +## 1.7.3 - 12th March 2007 + +* fixed gettimeofday() - was returning local and not system time; +* library now compatible with Secure Library string functions; + + + diff --git a/CHANGES.txt b/CHANGES.txt deleted file mode 100644 index 5777532..0000000 --- a/CHANGES.txt +++ /dev/null @@ -1,1227 +0,0 @@ -UNIXem - Changes -================ - -Updated: 1st May 2025 - - - ************************************ - * Change key: * - * * - * ~ means something has changed * - * + means a new addition * - * - means removal of something * - * * means a general bullet-point * - * * - ************************************ - - -19th May 2025 - 1.12.8 -====================== - -Summary: --------- - - * `glob()` now provides a pseudo-random order when `GLOB_NOSORT` flag is specified; - * Added **UNIXem.Util.FS** API, and applied in refactoring some API functions; - * Added **UNIXem.Util.Str** API, and applied in refactoring some API functions; - * Expanded **test.component.dirent**; - * Expanded **test.component.glob**; - * Miscellaneous consistency improvements; - * CMake optional dependency on **shwild**; - * Standard names of implementation files of unit/component tests; - -Details: --------- - - - -Depends on: - * STLSoft v1.11.1-rc1 or later (testing only); - * shwild v0.12.6 or later (optional, testing only); - * xTests v0.26.4 or later (testing only); - - -1st May 2025 - 1.12.7 -===================== - -Summary: --------- - - * CMake support; - * MinGW support; - * `usleep()` now sleeps for (at least) 1ms when given sleep time in range 1-999 nanoseconds; - * Simplying `glob()` API; - * Simplified implementation of `unixem__setenv__putenv_()` (and avoided warnings w MinGW); - * Refactored discrimination of integer types; - * Refactored in terms of `unixem_internal_Windows_HANDLE_from_file_handle()` - * Added **test.component.unistd.usleep**; - * **test.component.unistd.mkdtemp** ensures created temporary directories and temporary files are removed; - * **test.scratch.getrusage** ensures created temporary files are removed; - * Visual C++ warnings; - * VS Code settings; - * Removed support for Comeau compiler; - * Miscellaneous tidying and consistency fixes; - * Added .gitattributes; - -Details: --------- - -Depends on: - * STLSoft v1.11.1-beta7 or later (testing only); - * xTests v0.26.2 or later (testing only); - - -17th December 2020 - 1.12.6 -=========================== - -Summary: --------- - - * compatibility with Visual Studio 2019 (16.8.2) - -Details: --------- - -General: - - ~ include/unixem/implicit_link.h: - ~ include/unixem/unixem.h: - ~ compatibility with Visual Studio 2019 (16.8.2) - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - -19th July 2020 - 1.12.5 -======================= - -Summary: --------- - - * added support for Visual C++ 15 and 16 - -Details: --------- - -General: - - ~ include/unixem/implicit_link.h: - ~ include/unixem/unixem.h: - + added support for Visual C++ 15 and 16 - -Distribution: - -Makefiles / Project-files: - - + build/vc15.x64/makefile: - + build/vc15/makefile: - + build/vc16.x64/makefile: - + build/vc16/makefile: - + added support for Visual C++ 15 and 16 - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - -19th July 2020 - 1.12.4 -======================= - -Summary: --------- - - * refactored makefiles (in auto-generation) - -Details: --------- - -General: - - ~ include/unixem/unixem.h: - ~ updated makefiles - -Distribution: - -Makefiles / Project-files: - - ~ build/ar/makefile: - ~ build/bc55/makefile: - ~ build/bc551/makefile: - ~ build/bc56/makefile: - ~ build/bc564/makefile: - ~ build/bc582/makefile: - ~ build/bc59x/makefile: - ~ build/bc61x/makefile: - ~ build/como433/makefile: - ~ build/cw7/makefile: - ~ build/cw8/makefile: - ~ build/dm/makefile: - ~ build/gcc295/makefile: - ~ build/gcc32/makefile: - ~ build/gcc33/makefile: - ~ build/gcc34/makefile: - ~ build/gcc49/makefile: - ~ build/gcc81/makefile: - ~ build/icl10/makefile: - ~ build/icl11/makefile: - ~ build/icl6/makefile: - ~ build/icl7/makefile: - ~ build/icl8/makefile: - ~ build/icl9/makefile: - ~ build/makefile.tmpl: - ~ build/makefile.tools.xml: - ~ build/ow12/makefile: - ~ build/ow13/makefile: - ~ build/ow14/makefile: - ~ build/ow15/makefile: - ~ build/ow16/makefile: - ~ build/ow17/makefile: - ~ build/vc10.x64/makefile: - ~ build/vc10/makefile: - ~ build/vc11.x64/makefile: - ~ build/vc11/makefile: - ~ build/vc12.x64/makefile: - ~ build/vc12/makefile: - ~ build/vc14.x64/makefile: - ~ build/vc14/makefile: - ~ build/vc42/makefile: - ~ build/vc5/makefile: - ~ build/vc6/makefile: - ~ build/vc7/makefile: - ~ build/vc71/makefile: - ~ build/vc8.x64/makefile: - ~ build/vc8/makefile: - ~ build/vc9.x64/makefile: - ~ build/vc9/makefile: - ~ updated variant libs - ~ tools file refactoring - ~ makefile refactoring - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - -14th October 2019 - 1.12.3 -========================== - -Summary: --------- - - * added GCC 4.9 (MinGW) compatibility - -Details: --------- - -General: - - ~ src/mmap.c: - + added GCC 4.9 (MinGW) compatibility - -Distribution: - -Makefiles / Project-files: - - ~ build/gcc49/makefile: - + added GCC 4.9 (MinGW) compatibility - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - -14th October 2019 - 1.12.2 -========================== - -Summary: --------- - - * fixing generated library names to match implicit-link - * fixed invalid value of 1.11.4's UNIXEM_VER by bumping minor version - * added GCC 8.1 (MinGW) compatibility - -Details: --------- - -General: - - ~ include/unixem/unixem.h: - ~ fixed invalid value of 1.11.4's UNIXEM_VER by bumping minor version - -Distribution: - -Makefiles / Project-files: - - ~ build/ar/makefile: - ~ build/bc55/makefile: - ~ build/bc551/makefile: - ~ build/bc56/makefile: - ~ build/bc564/makefile: - ~ build/bc582/makefile: - ~ build/bc59x/makefile: - ~ build/bc61x/makefile: - ~ build/como433/makefile: - ~ build/cw7/makefile: - ~ build/cw8/makefile: - ~ build/dm/makefile: - ~ build/gcc295/makefile: - ~ build/gcc32/makefile: - ~ build/gcc33/makefile: - ~ build/gcc34/makefile: - ~ build/icl10/makefile: - ~ build/icl11/makefile: - ~ build/icl6/makefile: - ~ build/icl7/makefile: - ~ build/icl8/makefile: - ~ build/icl9/makefile: - ~ build/makefile.tmpl: - ~ build/ow12/makefile: - ~ build/ow13/makefile: - ~ build/ow14/makefile: - ~ build/ow15/makefile: - ~ build/ow16/makefile: - ~ build/ow17/makefile: - ~ build/vc10.x64/makefile: - ~ build/vc10/makefile: - ~ build/vc11.x64/makefile: - ~ build/vc11/makefile: - ~ build/vc12.x64/makefile: - ~ build/vc12/makefile: - ~ build/vc14.x64/makefile: - ~ build/vc14/makefile: - ~ build/vc42/makefile: - ~ build/vc5/makefile: - ~ build/vc6/makefile: - ~ build/vc7/makefile: - ~ build/vc71/makefile: - ~ build/vc8.x64/makefile: - ~ build/vc8/makefile: - ~ build/vc9.x64/makefile: - ~ build/vc9/makefile: - ~ fixing generated library names to match implicit-link - - ~ build/gcc81/makefile: - + added GCC 8.1 (MinGW) compatibility - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - -9th October 2019 - 1.11.4 -========================= - -Summary: --------- - - * fixing up setenv() / unsetenv() - * incorporating latest changes from GitHub repo - * fleshing out README.md for the GitHub site - -Details: --------- - -General: - - ~ include/unixem/setenv.h: - ~ setenv() => unixem_setenv() - ~ unsetenv() => unixem_unsetenv() - ~ tidying documentation - - ~ src/setenv.c: - ~ setenv() => unixem_setenv() - ~ unsetenv() => unixem_unsetenv() - ~ fixing defect when compiled in light of VC++ 10+'s so-called "safe string" library - -Distribution: - -Makefiles / Project-files: - - + test/scratch/test.scratch.setenv/vc10/test.scratch.setenv.vcxproj - + test/scratch/test.scratch.setenv/vc10/test.scratch.setenv.vcxproj.filters - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -2nd January 2017 - 1.11.2 -========================= - -Summary: --------- - - * fixed name of built library prefix from "unixem.core.1.*" to "unixem.1.core.*" - * moved build/vc6/unixem.dsp => projects/core/vc6/unixem.core.dsp - * added VC++10 project and props files - -Details: --------- - -General: - - ~ include/asm/atomic.h - ~ include/dirent.h - ~ include/dlfcn.h - ~ include/glob.h - ~ include/sys/mman.h - ~ include/sys/resource.h - ~ include/sys/time.h - ~ include/sys/uio.h - ~ include/unistd.h - ~ include/unixem/asm/atomic.h - ~ include/unixem/dirent.h - ~ include/unixem/dlfcn.h - ~ include/unixem/glob.h - ~ include/unixem/internal/safestr.h - ~ include/unixem/internal/util.h - ~ include/unixem/internal/winsock.h - ~ include/unixem/setenv.h - ~ include/unixem/sys/mman.h - ~ include/unixem/sys/resource.h - ~ include/unixem/sys/time.h - ~ include/unixem/sys/uio.h - ~ include/unixem/time.h - ~ include/unixem/unistd.h - ~ include/unixem/unixem.h - ~ documentation improvements - - ~ include/unixem/implicit_link.h - ~ fixed name of built library prefix from "unixem.core.1.*" to "unixem.1.core.*" - - ~ src/mktemp.c: - ~ limiting the number of access failures (to 100) - -Distribution: - -Makefiles / Project-files: - - ~ unixem.vc6.dsw: - - build/vc6/unixem.dsp: - + projects/core/vc6/unixem.core.dsp: - ~ build/vc6/unixem.dsp => projects/core/vc6/unixem.core.dsp - - + unixem.vc10.sln - + projects/core/vc10/unixem.core.vcxproj - + projects/core/vc10/unixem.core.vcxproj.filters - + projects/vcprops/unixem.common.props - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -7th October 2015 - 1.11.1 -========================= - -Summary: --------- - - * built library name prefix changes from "unixem" to "unixem.core" - * added mkdtemp() - * added mkstemp() - * added VC++14 support - -Details: --------- - -General: - - ~ include/unistd.h: - + added mkdtemp() (which is a function-like macro that calls unixem_mkdtemp()) - + added mkstemp() (which is a function-like macro that calls unixem_mkstemp()) - - ~ include/unixem/unistd.h: - ~ src/mktemp.c: - + added unixem_mkdtemp() - + added unixem_mkstemp() - - ~ include/unixem/implicit_link.h: - ~ built library name prefix changes from "unixem" to "unixem.core" - + support for VC++14 - -Distribution: - -Makefiles / Project-files: - - ~ build/gcc295/makefile: - ~ build/gcc32/makefile: - ~ build/gcc33/makefile: - ~ build/gcc34/makefile: - ~ build/ow15/makefile: - ~ build/ow16/makefile: - ~ build/ow17/makefile: - ~ build/vc10.x64/makefile: - ~ build/vc10/makefile: - ~ build/vc11.x64/makefile: - ~ build/vc11/makefile: - ~ build/vc12.x64/makefile: - ~ build/vc12/makefile: - ~ build/vc6/makefile: - ~ build/vc7/makefile: - ~ build/vc8.x64/makefile: - ~ build/vc9.x64/makefile: - ~ built library name prefix changes from "unixem" to "unixem.core" - + added mkdtemp() - + added mkstemp() - ~ canonicalising structure - - + build/vc14.x64/makefile: - + build/vc14/makefile: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -25th September 2015 - 1.10.2 -============================ - -Summary: --------- - - * minor fix to unixem_gettimeofday() - -Details: --------- - -General: - - ~ src/time.c: - ~ handling possible failure of SystemTimeToFileTime() within unixem_gettimeofday() - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -30th July 2015 - 1.10.1 -======================= - -Summary: --------- - - * added unixem_timegm() / timegm() - * added VC++11 and VC++12 support - -Details: --------- - -General: - - + include/unixem/time.h: - ~ src/time.c: - + added unixem_timegm() - + added timegm() - - ~ include/unixem/internal/time.h: - + added utility function unixem_internal_yearIsLeap() - -Distribution: - -Makefiles / Project-files: - - + build/vc11.x64/makefile: - + build/vc11/makefile: - + build/vc12.x64/makefile: - + build/vc12/makefile: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -16th June 2012 - 1.9.3 -====================== - -Summary: --------- - - * GLOB_ONLYFILE => GLOB_ONLYREG - * glob() now preserves dots directories when included in leaf-most pattern part - * fix to definition of WIN32 when using WinSock - -Details: --------- - -General: - - ~ include/glob.h: - ~ include/unixem/unixem.h: - ~ GLOB_ONLYFILE => GLOB_ONLYREG - - ~ include/unixem/internal/winsock.h: - ~ now undefines WIN32 if it was not previously defined and was defined by the inclusion of winsock.h - - - include/sys/mman.h: - - removed vestigial file - - ~ src/glob.c: - ~ now preserves dots directories, if either is the leaf-most pattern part - ~ UNIXEM_GLOB_ONLYFILE => UNIXEM_GLOB_ONLYREG - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -4th February 2011 - 1.9.2 -========================= - -Summary: --------- - - * removed include/sys/select.h (which was vestigial) - * various tidyings - * handling EZERO, ERROR_FILE_TOO_LARGE, ERROR_DISK_TOO_FRAGMENTED (in unixem_internal_errno_from_Win32()) - -Details: --------- - -General: - - ~ include/glob.h: - ~ include/sys/mman.h: - + include/unixem/unixem.h: - ~ various tidyings - - - include/sys/mman.h: - - removed vestigial file - - ~ src/internal/util.c: - ~ unixem_internal_errno_from_Win32() default (unmatched) return now -1, and handles EZERO, ERROR_FILE_TOO_LARGE, ERROR_DISK_TOO_FRAGMENTED - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -12th August 2010 - 1.9.1 -======================== - -Summary: --------- - - * reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - * 64-bit compatibility fixes - -Details: --------- - -General: - - ~ include/asm/atomic.h: - ~ include/dirent.h: - ~ include/dlfcn.h: - ~ include/glob.h: - ~ include/sys/mman.h: - ~ include/sys/resource.h: - ~ include/sys/uio.h: - ~ include/unistd.h: - ~ include/unixem/internal/util.h: - ~ include/sys/time.h: - ~ reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - - + include/unixem/asm/atomic.h: - + include/unixem/dirent.h: - + include/unixem/dlfcn.h: - + include/unixem/glob.h: - + include/unixem/setenv.h: - + include/unixem/sys/mman.h: - + include/unixem/sys/resource.h: - + include/unixem/sys/uio.h: - + include/unixem/unistd.h: - + include/unixem/sys/time.h: - ~ reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - - ~ src/atomic.c: - ~ src/dirent.c: - ~ src/dlfcn.c: - ~ src/glob.c: - ~ src/hostname.c: - ~ src/internal/util.c: - ~ src/mmap.c: - ~ src/resource.c: - ~ src/setenv.c: - ~ src/time.c: - ~ src/uio.c: - ~ reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - - ~ src/unistd.c: - ~ Win64-compatibility - ~ GCC compatibility - ~ reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - -Distribution: - -Makefiles / Project-files: - - ~ build/ar/makefile: - ~ build/bc55/makefile: - ~ build/bc551/makefile: - ~ build/bc56/makefile: - ~ build/bc564/makefile: - ~ build/bc582/makefile: - ~ build/bc59x/makefile: - ~ build/bc61x/makefile: - ~ build/como433/makefile: - ~ build/cw7/makefile: - ~ build/cw8/makefile: - ~ build/dm/makefile: - ~ build/gcc295/makefile: - ~ build/gcc32/makefile: - ~ build/gcc33/makefile: - ~ build/icl10/makefile: - ~ build/icl11/makefile: - ~ build/icl6/makefile: - ~ build/icl7/makefile: - ~ build/icl8/makefile: - ~ build/icl9/makefile: - ~ build/makefile.tools.xml: - ~ build/ow12/makefile: - ~ build/ow13/makefile: - ~ build/ow14/makefile: - ~ build/ow15/makefile: - ~ build/ow16/makefile: - ~ build/ow17/makefile: - ~ build/vc10.x64/makefile: - ~ build/vc10/makefile: - ~ build/vc42/makefile: - ~ build/vc5/makefile: - ~ build/vc6/makefile: - ~ build/vc7/makefile: - ~ build/vc71/makefile: - ~ build/vc8.x64/makefile: - ~ build/vc8/makefile: - ~ build/vc9.x64/makefile: - ~ build/vc9/makefile: - ~ reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -13th August 2010 - 1.8.5 -======================== - -Summary: --------- - - * gettimeofday() now returns int (instead of void) - * added VC++ 10 implicit-link support - -Details: --------- - -General: - - ~ include/sys/time.h: - ~ src/time.c: - ~ gettimeofday() now returns int (instead of void) - - ~ include/unixem/implicit_link.h: - + now supports VC++ 10 - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -4th April 2010 - 1.8.4 -====================== - -Summary: --------- - - * fixed erroneous library name in implicit link file - * added VC++ 10 support - -Details: --------- - -General: - - ~ include/unixem/implicit_link.h: - ~ fixed erroneous library name in implicit link file - -Distribution: - -Makefiles / Project-files: - - + build/vc10.x64/makefile: - + build/vc10/makefile: - + added VC++ 10 support - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -6th February 2010 - 1.8.3 -========================= - -Summary: --------- - - * refactored headers to resolve conflict(s) between unistd.h and winsock(2).h withouth using #define to prevent subsequent inclusion of winsock(2).h - * added empty (placeholder) files: arpa/inet.h, netinet/in.h, sys/socket.h - * fixed _M_X86 implicit link defect - * added implicit link support for Borland 5.9+, 6.1+ and Intel C/C++ 9, 10, 11 - * changed library name/implicit link directives for VC++ x64/IA64 targets - * added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - * various other minor changes - -Details: --------- - -General: - - ~ include/arpa/inet.h: - ~ include/netinet/in.h: - ~ include/sys/socket.h: - + added empty (placeholder) files - - ~ include/sys/time.h: - ~ now implemented in terms of unixem/internal/winsock.h - - ~ include/unistd.h: - ~ updated version - ~ now controls conflict between unistd.h and winsock(2).h without using #define to prevent subsequent inclusion of winsock(2).h - - ~ include/unixem/implicit_link.h: - + implicit link support for Borland 5.9+ and 6.1+ - + implicit link support for Intel C/C++ 9, 10, 11 - ~ implicit link to new name for VC++ x64/IA64 targets - ~ fixed _M_X86 blooper - - ~ include/unixem/internal/winsock.h: - + unixem/internal/winsock.h - - ~ src/hostname.c: - ~ changed calling convention of unixem_gethostname() - -Distribution: - -Makefiles / Project-files: - - ~ build/bc55/makefile: - ~ build/bc551/makefile: - ~ build/bc56/makefile: - ~ build/bc564/makefile: - ~ build/bc582/makefile: - ~ build/ow12/makefile: - ~ build/ow13/makefile: - ~ build/ow14/makefile: - ~ build/ow15/makefile: - ~ build/ow16/makefile: - ~ build/ow17/makefile: - + added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - ~ -+ librarian to + - - ~ build/bc59x/makefile: - ~ build/bc61x/makefile: - + added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - + added support for Borland 5.9 and 6.1 - - ~ build/icl10/makefile: - ~ build/icl11/makefile: - ~ build/icl9/makefile: - + added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - + added support for Intel 9, 10, 11 - - ~ build/ar/makefile: - ~ build/como433/makefile: - ~ build/cw7/makefile: - ~ build/cw8/makefile: - ~ build/dm/makefile: - ~ build/gcc295/makefile: - ~ build/gcc32/makefile: - ~ build/gcc33/makefile: - ~ build/gcc34/makefile: - ~ build/icl10/makefile: - ~ build/icl11/makefile: - ~ build/icl6/makefile: - ~ build/icl7/makefile: - ~ build/icl8/makefile: - ~ build/icl9/makefile: - ~ build/vc42/makefile: - ~ build/vc5/makefile: - ~ build/vc6/makefile: - ~ build/vc7/makefile: - ~ build/vc71/makefile: - ~ build/vc8/makefile: - ~ build/vc9/makefile: - + added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - - ~ build/vc8.x64/makefile: - ~ build/vc9.x64/makefile: - + added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - ~ new names for VC++ x64/IA64 targets - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -13th May 2008 - 1.8.2 -===================== - -Summary: --------- - - * Win64 compatibility - -Details: --------- - -General: - - - unlink is now left to the version provided with the VC++ RTL - ~ mman.h now 64-bit compatible - - + implicit link compatibility with vc8 and vc9 - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -22nd April 2008 - 1.8.1 -======================= - -Summary: --------- - - * added gethostname() - * added getpid() - * changed 2nd param of gettimeofday() to void* - * improved semantics for glob() when a pattern search in an - existing directory matches no entries - -Details: --------- - -General: - - + gethostname() (in unistd.h and src/hostname.c) - + added getpid() (in unistd.h and src/unistd.c) - ~ changed 2nd param of gettimeofday() to void* - ~ improved semantics for glob() when a pattern search in an - existing directory matches no entries - -Distribution: - -Makefiles / Project-files: - - + hostname.c - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -20th April 2008 - 1.7.5 -======================= - -Summary: --------- - - * the distribution is now rooted at unixem-1.7.5/ - * makefiles for VC++ 8 & 9 - * implicit linking for Borland C/C++ 5.82 - * implicit linking for VC++ 9 - * bundles shwild 0.9.13 - * bundles xTests 0.6.1 - -Details: --------- - -General: - - + implicit linking for Borland C/C++ 5.82 - + implicit linking for VC++ 9 - -Distribution: - - ~ the distribution is now rooted at unixem-1.7.5/ - -Makefiles / Project-files: - - + makefiles for VC++ 8 & 9 - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -24th February 2008 - 1.7.4 -========================== - -Summary: --------- - - * include/unixem/internal/safestr.h - * safe string library for src/glob.c - * improved handling of offsets and errors in src/mmap.c - * safe string library for src/setenv.c - * fixed bug in gettimeofday(), which was showing local time, rather - than the required system time - -Details: --------- - -General: - - + include/unixem/internal/safestr.h - - ~ safe string library for src/glob.c - ~ improved handling of offsets and errors in src/mmap.c - ~ safe string library for src/setenv.c - ~ fixed bug in gettimeofday(), which was showing local time, rather - than the required system time - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - - - -12th March 2007 - 1.7.3 -======================= - -Summary: --------- - - * fixed gettimeofday() - was returning local and not system time - * library now compatible with Secure Library string functions - -Details: --------- - -General: - - ~ fixed gettimeofday() - was returning local and not system time - ~ library now compatible with Secure Library string functions - -Distribution: - -Makefiles / Project-files: - -Examples: - -Test: - -Test.Unit: - -Test.Component: - -Test.Scratch: - -Depends on: - -=============================== end of file ================================ - diff --git a/CMakeLists.txt b/CMakeLists.txt index e8ed47c..243dada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,10 @@ - # ######################################################################## # # File: /CMakeLists.txt # # Purpose: Top-level CMake lists file for UNIXem # # Created: 10th July 2024 -# Updated: 7th September 2025 +# Updated: 4th August 2026 # # ######################################################################## # @@ -89,6 +88,7 @@ endif(MSVC) # ########################################################## # dependencies, includes, options + # ################################################ # includes - 1 @@ -101,25 +101,38 @@ include(TargetMacros) # dependencies and options option(BUILD_EXAMPLES "Build examples" ON) +option(BUILD_TESTING "Build tests" ON) + + +# ###################################### +# features + +# This library targets Windows only. +if(NOT WIN32) + + message(FATAL_ERROR "${PROJECT_NAME} targets Windows only") +endif() option(BUILD_TESTING "Build tests" ON) + # ###################################### # dependencies # # required: +# - (none for library use) # -# optional: -# - STLSoft - required unless NO_B64_CPP_API is specified, and by xTests -# (for testing); -# - shwild - for enhanced match constructs +# optional / testing: +# - STLSoft - required by xTests (for testing); +# - shwild - for enhanced match constructs (testing); # - xTests - required for testing # ############################ # STLSoft -if(BUILD_TESTING OR NOT NO_B64_CPP_API) +if(BUILD_TESTING) + if(NOT DEFINED STLSOFT AND NOT DEFINED ENV{STLSOFT}) set(STLSoft_REQUIRED_VERSION_ 1.11) @@ -145,10 +158,12 @@ if(BUILD_TESTING OR NOT NO_B64_CPP_API) endif() endif() + # ############################ # shwild (optional) if(NOT (CMAKE_NO_SHWILD)) + if(BUILD_TESTING) find_package(shwild QUIET) @@ -162,6 +177,7 @@ if(NOT (CMAKE_NO_SHWILD)) endif(BUILD_TESTING) endif() + # ############################ # xTests @@ -189,6 +205,7 @@ include(GNUInstallDirs) # ########################################################## # targets + # ################################################ # main library @@ -269,4 +286,3 @@ message(NOTICE "Generating CMake build scripts for ${PROJECT_NAME} ${PROJECT_VER # ############################## end of file ############################# # - diff --git a/FAQ.md b/FAQ.md index 95b2d46..530c377 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,13 +1,34 @@ # UNIXem - FAQ -## Table of Contents +The FAQ list is under (constant) development. If you post a question on the +[Issues](https://github.com/synesissoftware/UNIXem/issues) forum it will be +used to create one. +- [Q1: "How do I build UNIXem?"](#q1-how-do-i-build-unixem) +- [Q2: "Does UNIXem run on Linux or macOS?"](#q2-does-unixem-run-on-linux-or-macos) +- [Q3: "Does UNIXem have its own unit-tests?"](#q3-does-unixem-have-its-own-unit-tests) -## FAQ -T.B.C. +# FAQs: +## Q1: "How do I build UNIXem?" + +See instructions in [**INSTALL.md**](./INSTALL.md). + + +## Q2: "Does UNIXem run on Linux or macOS?" + +No. **UNIXem** emulates selected Unix APIs on **Windows**. On Unix hosts you +use the native APIs instead. - +## Q3: "Does UNIXem have its own unit-tests?" + +Yes. Component and unit tests live under **test/** and depend on +[**xTests**](https://github.com/synesissoftware/xTests) (and **STLSoft**; +**shwild** is optional). Build with testing enabled and run +**run_all_unit_tests.sh** (or **run_all_unit_tests.cmd** on Windows). + + + diff --git a/HISTORY.md b/HISTORY.md deleted file mode 100644 index 53c45bd..0000000 --- a/HISTORY.md +++ /dev/null @@ -1,204 +0,0 @@ -# UNIXem - History - - ----- - - -19th May 2025 - 0.12.8 ----------------------- - - * `glob()` now provides a pseudo-random order when `GLOB_NOSORT` flag is specified; - * Added **UNIXem.Util.FS** API, and applied in refactoring some API functions; - * Added **UNIXem.Util.Str** API, and applied in refactoring some API functions; - * Expanded **test.component.dirent**; - * Expanded **test.component.glob**; - * Miscellaneous consistency improvements; - * CMake optional dependency on **shwild**; - * Standard names of implementation files of unit/component tests; - - -1st May 2025 - 0.12.7 ---------------------------- - - * CMake support; - * MinGW support; - * `usleep()` now sleeps for (at least) 1ms when given sleep time in range 1-999 nanoseconds; - * Simplying `glob()` API; - * Simplified implementation of `unixem__setenv__putenv_()` (and avoided warnings w MinGW); - * Refactored discrimination of integer types; - * Refactored in terms of `unixem_internal_Windows_HANDLE_from_file_handle()` - * Added **test.component.unistd.usleep**; - * **test.component.unistd.mkdtemp** ensures created temporary directories and temporary files are removed; - * **test.scratch.getrusage** ensures created temporary files are removed; - * Visual C++ warnings; - * VS Code settings; - * Removed support for Comeau compiler; - * Miscellaneous tidying and consistency fixes; - * Added .gitattributes; - - -17th December 2020 - 0.12.6 ---------------------------- - - * compatibility with Visual Studio 2019 (16.8.2) - - -19th July 2020 - 0.12.5 ------------------------ - - * added support for Visual C++ 15 and 16 - - -19th July 2020 - 0.12.4 ------------------------ - - * refactored makefiles (in auto-generation) - - -14th October 2019 - 0.12.3 --------------------------- - - * added GCC 4.9 (MinGW) compatibility - - -14th October 2019 - 0.12.2 --------------------------- - - * fixing generated library names to match implicit-link - * fixed invalid value of 1.11.4's UNIXEM_VER by bumping minor version - * added GCC 8.1 (MinGW) compatibility - - -9th October 2019 - 1.11.4 -------------------------- - - * fixing up setenv() / unsetenv() - * incorporating latest changes from GitHub repo - - -2nd January 2017 - 1.11.2 -------------------------- - - * fixed name of built library prefix from "unixem.core.1.*" to "unixem.1.core.*" - * moved build/vc6/unixem.dsp => projects/core/vc6/unixem.core.dsp - * added VC++10 project and props files - - -7th October 2015 - 1.11.1 -------------------------- - - * built library name prefix changes from "unixem" to "unixem.core" - * added mkdtemp() - * added mkstemp() - * added VC++14 support - - -25th September 2015 - 1.10.2 ----------------------------- - - * minor fix to unixem_gettimeofday() - - -30th July 2015 - 1.10.1 ------------------------ - - * added unixem_timegm() / timegm() - * added VC++11 and VC++12 support - - -16th June 2012 - 1.9.3 ----------------------- - - * GLOB_ONLYFILE => GLOB_ONLYREG - * glob() now preserves dots directories when included in leaf-most pattern part - * fix to definition of WIN32 when using WinSock - - -4th February 2011 - 1.9.2 -------------------------- - - * removed include/sys/select.h (which was vestigial) - * various tidyings - * handling EZERO, ERROR_FILE_TOO_LARGE, ERROR_DISK_TOO_FRAGMENTED (in unixem_internal_errno_from_Win32()) - - -12th August 2010 - 1.9.1 ------------------------- - - * reworked the API such that all functions are prefixed with unixem_(), and defined to the UNIX functions via macros - * 64-bit compatibility fixes - - -13th August 2010 - 1.8.5 ------------------------- - - * gettimeofday() now returns int (instead of void) - * added VC++ 10 implicit-link support - - -4th April 2010 - 1.8.4 ----------------------- - - * fixed erroneous library name in implicit link file - * added VC++ 10 support - - -6th February 2010 - 1.8.3 -------------------------- - - * refactored headers to resolve conflict(s) between unistd.h and winsock(2).h withouth using #define to prevent subsequent inclusion of winsock(2).h - * added empty (placeholder) files: arpa/inet.h, netinet/in.h, sys/socket.h - * fixed _M_X86 implicit link defect - * added implicit link support for Borland 5.9+, 6.1+ and Intel C/C++ 9, 10, 11 - * changed library name/implicit link directives for VC++ x64/IA64 targets - * added Synesis-standard make targets: compile.libs.core, compile.libs, compile, build.libs.core, build.libs, build - * various other minor changes - - -13th May 2008 - 1.8.2 ---------------------- - - * Win64 compatibility - - -22nd April 2008 - 1.8.1 ------------------------ - - * added gethostname() - * added getpid() - * changed 2nd param of gettimeofday() to void* - * improved semantics for glob() when a pattern search in an - existing directory matches no entries - - -20th April 2008 - 1.7.5 ------------------------ - - * the distribution is now rooted at unixem-1.7.5/ - * makefiles for Visual C++ 8 & 9 - * implicit linking for Borland C/C++ 5.82 - * implicit linking for VC++ 9 - * bundles shwild 0.9.13 - * bundles xTests 0.6.1 - - -24th February 2008 - 1.7.4 --------------------------- - - * include/unixem/internal/safestr.h - * safe string library for src/glob.c - * improved handling of offsets and errors in src/mmap.c - * safe string library for src/setenv.c - * fixed bug in gettimeofday(), which was showing local time, rather - than the required system time - - -12th March 2007 - 1.7.3 ------------------------ - - * fixed gettimeofday() - was returning local and not system time - * library now compatible with Secure Library string functions - - - - diff --git a/INSTALL.md b/INSTALL.md index 1c60cec..16df6dc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,13 +1,103 @@ -# UNIXem - Install +# UNIXem - Installation and Use + +**UNIXem** is a classic-form C library for Windows, with implementation files +in its **src** directory and header files under **include/** (including +**include/unixem/**). Once installed, include the appropriate headers (e.g. +**unixem/unixem.h**, **unixem/unistd.h**, or the top-level compatibility +headers such as **unistd.h**) and link against the **UNIXem** library. + ## Table of Contents +- [Platform](#platform) +- [CMake](#cmake) -## Installing with CMake -T.B.C. +## Platform +**UNIXem** targets **Windows** only (MSVC and MinGW). Non-Windows hosts are +rejected by **CMake**. - +## CMake + +The primary choice for installation is by use of **CMake**. + +1. Obtain the latest distribution of **UNIXem**, from + https://github.com/synesissoftware/UNIXem/, e.g. + + ```bash + $ mkdir -p ~/open-source + $ cd ~/open-source + $ git clone https://github.com/synesissoftware/UNIXem/ + ``` + +2. Prepare the CMake configuration, via the **prepare_cmake.sh** script, as + in: + + ```bash + $ cd ~/open-source/UNIXem + $ ./prepare_cmake.sh -v + ``` + + **NOTE**: if you intend only to build the library then you can eschew + building of tests (via flag `-T`) and use the command: + + ```bash + $ ./prepare_cmake.sh -T + ``` + + In this case, you do not need to have installed **STLSoft**, **shwild**, + or **xTests**; otherwise, you will need those test-only dependencies to + be discoverable by **CMake**. + +3. Run a build of the generated **CMake**-derived build files via the + **build_cmake.sh** script, as in: + + ```bash + $ ./build_cmake.sh + ``` + + (**NOTE**: if you provide the flag `--run-make` (=== `-m`) in step 2 then + you do not need this step.) +4. As a check, execute the built test programs via **run_all_unit_tests.sh**, + as in: + + ```bash + $ ./run_all_unit_tests.sh + ``` + +5. Install the library on the host, via `cmake`, as in: + + ```bash + $ cmake --install ${SIS_CMAKE_BUILD_DIR:-./_build} --config Release + ``` + +6. Then to use the library: + + 1. A minimal consumer: + + ```c + // main.c + #include + #include + #include + + int main(void) + { + printf("using UNIXem\n"); + + return EXIT_SUCCESS; + } + ``` + + 2. Or via **CMake** `find_package`: + + ```cmake + find_package(unixem REQUIRED) + target_link_libraries(your_target PRIVATE UNIXem::UNIXem) + ``` + + + diff --git a/NEWS.md b/NEWS.md index a8403c2..b35f2a1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,49 +1,45 @@ -# UNIXem - News - - -| Date | News Item | -| --------------------- | ----------------------- | -| 7th Sep 2025 | Release of [UNIXem 1.13.0](https://github.com/synesissoftware/UNIXem/releases/tag/1.13.0) | -| 19th May 2025 | UNIXem 1.12.8 released | -| 1st May 2025 | UNIXem 1.12.7 released | -| 17th Dec 2020 | UNIXem 1.12.6 released | -| 19th Jul 2020 | UNIXem 1.12.5 released | -| 19th Jul 2020 | UNIXem 1.12.4 released | -| 14th Oct 2019 | UNIXem 1.12.3 released | -| 14th Oct 2019 | UNIXem 1.12.2 released | -| 9th Oct 2019 | UNIXem 1.11.4 released | -| 2nd Jan 2017 | UNIXem 1.11.2 released | -| 7th Oct 2015 | UNIXem 1.11.1 released | -| 25th Sep 2015 | UNIXem 1.10.2 released | -| 30th Jul 2015 | UNIXem 1.10.1 released | -| 16th Jun 2012 | UNIXem 1.9.3 released | -| 4th Feb 2011 | UNIXem 1.9.2 released | -| 13th Aug 2010 | UNIXem 1.9.1 released | -| 13th Aug 2010 | UNIXem 1.8.5 released | -| 4th Apr 2010 | UNIXem 1.8.4 released | -| 6th Feb 2010 | UNIXem 1.8.3 released | -| 13th May 2008 | UNIXem 1.8.2 released | -| 22nd Apr 2008 | UNIXem 1.8.1 released | -| 20th Apr 2008 | UNIXem 1.7.5 released | -| 24th Feb 2008 | UNIXem 1.7.4 released | -| 12th Mar 2007 | UNIXem 1.7.3 released | -| 12th Sep 2006 | UNIXem 1.7.2 released | -| 3rd Sep 2006 | UNIXem 1.7.1 released | -| 12th Aug 2006 | UNIXem 1.5.2 released | -| 21st Sep 2005 | UNIXem 1.5.1 released | -| 19th Jun 2005 | UNIXem 1.5.3 released | -| 23rd May 2005 | UNIXem 1.5.2 released | -| 17th Feb 2005 | UNIXem 1.5.1 released | -| 29th Jun 2004 | UNIXem 1.4 released | -| 16th Jun 2004 | UNIXem 1.3 released | -| 3rd Jan 2004 | UNIXem 1.2 released | -| 2nd Nov 2003 | UNIXem 1.1 released | -| 2nd Feb 2003 | UNIXem 1.0 released | +# UNIXem - News + + +| Date | News Item | +| ------------- | ---------------------- | +| 4th Aug 2026 | Release of [UNIXem 1.13.0-beta1](https://github.com/synesissoftware/UNIXem/releases/tag/1.13.0-beta1) | +| 7th Sep 2025 | Release of [UNIXem 1.13.0-alpha1](https://github.com/synesissoftware/UNIXem/releases/tag/1.13.0-alpha1) | +| 19th May 2025 | UNIXem 1.12.8 released | +| 1st May 2025 | UNIXem 1.12.7 released | +| 17th Dec 2020 | UNIXem 1.12.6 released | +| 19th Jul 2020 | UNIXem 1.12.5 released | +| 19th Jul 2020 | UNIXem 1.12.4 released | +| 14th Oct 2019 | UNIXem 1.12.3 released | +| 14th Oct 2019 | UNIXem 1.12.2 released | +| 9th Oct 2019 | UNIXem 1.11.4 released | +| 2nd Jan 2017 | UNIXem 1.11.2 released | +| 7th Oct 2015 | UNIXem 1.11.1 released | +| 25th Sep 2015 | UNIXem 1.10.2 released | +| 30th Jul 2015 | UNIXem 1.10.1 released | +| 16th Jun 2012 | UNIXem 1.9.3 released | +| 4th Feb 2011 | UNIXem 1.9.2 released | +| 13th Aug 2010 | UNIXem 1.9.1 released | +| 13th Aug 2010 | UNIXem 1.8.5 released | +| 4th Apr 2010 | UNIXem 1.8.4 released | +| 6th Feb 2010 | UNIXem 1.8.3 released | +| 13th May 2008 | UNIXem 1.8.2 released | +| 22nd Apr 2008 | UNIXem 1.8.1 released | +| 20th Apr 2008 | UNIXem 1.7.5 released | +| 24th Feb 2008 | UNIXem 1.7.4 released | +| 12th Mar 2007 | UNIXem 1.7.3 released | +| 12th Sep 2006 | UNIXem 1.7.2 released | +| 3rd Sep 2006 | UNIXem 1.7.1 released | +| 12th Aug 2006 | UNIXem 1.5.2 released | +| 21st Sep 2005 | UNIXem 1.5.1 released | +| 19th Jun 2005 | UNIXem 1.5.3 released | +| 23rd May 2005 | UNIXem 1.5.2 released | +| 17th Feb 2005 | UNIXem 1.5.1 released | +| 29th Jun 2004 | UNIXem 1.4 released | +| 16th Jun 2004 | UNIXem 1.3 released | +| 3rd Jan 2004 | UNIXem 1.2 released | +| 2nd Nov 2003 | UNIXem 1.1 released | +| 2nd Feb 2003 | UNIXem 1.0 released | - - - - - diff --git a/README.md b/README.md index c0f1500..3de1e6d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,24 @@ # UNIXem +**Unix**-**em**ulation, for Windows + + ![C](https://img.shields.io/badge/C-00599C?style=flat&logo=c&logoColor=white) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +[![GitHub release](https://img.shields.io/github/v/release/synesissoftware/UNIXem.svg)](https://github.com/synesissoftware/UNIXem/releases/latest) +[![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/UNIXem)](https://github.com/synesissoftware/UNIXem/commits/master) +[![CI](https://github.com/synesissoftware/UNIXem/actions/workflows/ci.yml/badge.svg)](https://github.com/synesissoftware/UNIXem/actions/workflows/ci.yml) -**Unix**-**em**ulation, for Windows ## Table of Contents - [Introduction](#introduction) - [Installation](#installation) - [Components](#components) + - [Unix API emulation](#unix-api-emulation) + - [Atomic operations](#atomic-operations) + - [Utility APIs](#utility-apis) + - [Compatibility placeholders](#compatibility-placeholders) - [Examples](#examples) - [Project Information](#project-information) - [Where to get help](#where-to-get-help) @@ -24,40 +33,65 @@ **UNIXem** is a small and simple library that provides emulation of several popular Unix API functions on the Windows platform. Its primary purpose is to assist Windows programmers who are porting to Unix or are writing multi-platform code. +**NOTE**: **UNIXem** is a Windows-only library. + ## Installation -As of **1.12.8**, **CMake** support is provided, and this is the recommended means of installation. Detailed instructions are provided in [INSTALL.md](./INSTALL.md). +As of **1.12.7**, **CMake** support is provided, and this is the recommended means of installation. Detailed instructions are provided in [**INSTALL.md**](./INSTALL.md). ## Components -API functions include: - -- ``opendir()``, ``readdir()``, ``rewinddir()``, ``closedir()``; -- ``glob()``, ``globfree()``; -- ``readv()``, ``writev()``; -- ``pathconf()``; -- ``realpath()``; -- ``mmap()``, ``munmap()``, ``msync()``; -- ``dlopen()``, ``dlclose()``, ``dlsym()``, ``dlerror()``; -- ``gettimeofday()``; -- ``getpagesize()``; -- ``mkdtemp()``, ``mkstemp()``; -- ``mkdir()``, ``rmdir()``; -- ``getcwd()``; -- ``getpid()``; -- ``gethostname()``; -- ``usleep()``; -- ``getrusage()``; -- ``setenv()``, ``unsetenv()``; -- ``link()``, ``unlink()``; -- ``timegm()``; +Top-level compatibility headers (e.g. [`dirent.h`](./include/dirent.h), [`unistd.h`](./include/unistd.h)) wrap the corresponding [`unixem/`](./include/unixem/) headers. + + +### Unix API emulation + +| API(s) | Header | Purpose | Restrictions | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------- | ------------------------ | +| `chdir()`, `getcwd()`, `mkdir()`, `rmdir()` | [`unixem/unistd.h`](./include/unixem/unistd.h) | Working directory; make/remove dirs | — | +| `close()`, `getpagesize()`, `link()`, `pathconf()`, `realpath()`, `unlink()` | [`unixem/unistd.h`](./include/unixem/unistd.h) | FD close; page size; links; paths | — | +| `dlopen()`, `dlclose()`, `dlsym()`, `dlerror()` | [`unixem/dlfcn.h`](./include/unixem/dlfcn.h) | Dynamic library load/lookup | — | +| `gethostname()`, `getpid()`, `usleep()` | [`unixem/unistd.h`](./include/unixem/unistd.h) | Host name; process id; sleep | — | +| `getrusage()` | [`unixem/sys/resource.h`](./include/unixem/sys/resource.h) | Process resource usage | Limited field coverage | +| `gettimeofday()` | [`unixem/sys/time.h`](./include/unixem/sys/time.h) | Wall-clock time of day | — | +| `glob()`, `globfree()` | [`unixem/glob.h`](./include/unixem/glob.h) | Pathname pattern expansion | Incomplete flag coverage | +| `mkdtemp()`, `mkstemp()` | [`unixem/unistd.h`](./include/unixem/unistd.h) | Temporary directory/file creation | — | +| `mmap()`, `munmap()`, `msync()` | [`unixem/sys/mman.h`](./include/unixem/sys/mman.h) | Memory-map files/regions | — | +| `opendir()`, `readdir()`, `rewinddir()`, `closedir()` (+ `w*` wide forms) | [`unixem/dirent.h`](./include/unixem/dirent.h) | Directory iteration | — | +| `readv()`, `writev()` | [`unixem/sys/uio.h`](./include/unixem/sys/uio.h) | Vectored file read/write | — | +| `setenv()`, `unsetenv()` | [`unixem/setenv.h`](./include/unixem/setenv.h) | Environment variable set/clear | — | +| `timegm()` | [`unixem/time.h`](./include/unixem/time.h) | UTC `struct tm` to `time_t` | — | + + +### Atomic operations + +| API(s) | Header | Purpose | Restrictions | +| ------------------------------------------------------- | ------------------------------------------------------ | --------------------------- | ------------ | +| `unixem_atomic_*` (inc/dec/add/sub/set/read/write/test) | [`unixem/asm/atomic.h`](./include/unixem/asm/atomic.h) | Linux-style atomic integers | — | + + +### Utility APIs + +| API(s) | Header | Purpose | Restrictions | +| ------------------------------------------------------------ | -------------------------------------------------- | ---------------------------------- | -------------------------- | +| `begins_with`, `ends_with` | [`unixem/util/str.h`](./include/unixem/util/str.h) | **UNIXem.Util.Str** string helpers | Helper API (also internal) | +| `char_is_path_sep`, `directory_exists`, `get_home_directory` | [`unixem/util/fs.h`](./include/unixem/util/fs.h) | **UNIXem.Util.FS** path/FS helpers | Helper API (also internal) | + + +### Compatibility placeholders + +| API(s) | Header | Purpose | Restrictions | +| ------ | ---------------------------------------- | -------------------------- | ----------------- | +| — | [`arpa/inet.h`](./include/arpa/inet.h) | Compatibility include stub | Empty placeholder | +| — | [`netinet/in.h`](./include/netinet/in.h) | Compatibility include stub | Empty placeholder | +| — | [`sys/socket.h`](./include/sys/socket.h) | Compatibility include stub | Empty placeholder | ## Examples -T.B.C. +Examples are not yet provided in this distribution. See the component and unit tests under **test/** for usage illustrations. ## Project Information @@ -65,7 +99,7 @@ T.B.C. ### Where to get help -[GitHub Page](https://github.com/synesissoftware/UNIXem "GitHub Page") +[GitHub Issues](https://github.com/synesissoftware/UNIXem/issues) ### Contribution guidelines @@ -75,30 +109,30 @@ Defect reports, feature requests, and pull requests are welcome on https://githu ### Dependencies -There are no dependencies for installation and use of **STLSoft**. +There are no dependencies for installation and use of **UNIXem**. + #### Test-only dependencies -The component-/unit-tests depend on the **xTests** project: +The component-/unit-tests depend on: - * [STLSoft](http://github.com/synesissoftware/STLSoft-1.11/); - * [shwild](http://github.com/synesissoftware/shwild/); - * [xTests](http://github.com/synesissoftware/xTests/); +* [**STLSoft**](https://github.com/synesissoftware/STLSoft); +* [**shwild**](https://github.com/synesissoftware/shwild) (optional); +* [**xTests**](https://github.com/synesissoftware/xTests); ### Related projects **UNIXem** is used by a number of C/C++ libraries for compilation/linking/testing on Windows, including: - * [**FastFormat**](https://github.com/synesissoftware/FastFormat/) - * [**Pantheios**](https://github.com/synesissoftware/Pantheios/) - * [**recls**](https://github.com/synesissoftware/recls/) +* [**FastFormat**](https://github.com/synesissoftware/FastFormat); +* [**Pantheios**](https://github.com/synesissoftware/Pantheios); +* [**recls**](https://github.com/synesissoftware/recls); ### License -**UNIXem** is released under the 3-clause BSD license. See LICENSE for details. +**UNIXem** is released under the 3-clause BSD license. See [**LICENSE**](./LICENSE) for details. - diff --git a/TODO.md b/TODO.md index ec2113f..f9c37f1 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,6 @@ # UNIXem - TODO - -## Table of Contents - -- [Functional improvements](#functional-improvements) -- [Performance improvements](#performance-improvements) -- [Packaging improvements](#packaging-improvements) +Updated: 4th August 2026 ## Functional improvements @@ -13,7 +8,7 @@ * [ ] Refactor file-system utilities into separate API functions; * [ ] Greater unit-testing coverage; * [ ] Ensure unit-tests (and scratch-tests) do memory checking; -* [ ] Component test(s) for link; +* [ ] Component test(s) for `link`; * [ ] `stpcpy()`, etc.; * [ ] `glob()` - expand functionality and flags coverage: * [ ] Proper handling of `errfunc` + `GLOB_ERR`; @@ -34,10 +29,21 @@ ## Packaging improvements -* [x] ~~~CMake~~~ - ✅; -* [x] ~~~Remove Visual Studio project/solution files~~~ - ✅; -* [ ] Standardise project boilerplate files (to .md); -* [ ] CMake optional dependencies all marked OFF in CMakeListst.txt; +* [x] ~~~Badges~~~; +* [x] ~~~CMake~~~; +* [x] ~~~Standardise project boilerplate files (to .md)~~~; +* [x] ~~~Remove Visual Studio project/solution/workspace files~~~; +* [ ] Remove custom makefiles under **build/** (retained for now); +* [ ] CMake optional dependencies all marked OFF in **CMakeLists.txt**; +* [ ] Add example programs under **examples/**; +* [ ] Add to Windows-capable package managers: + * [ ] Chocolatey; + * [ ] Conan; + * [ ] MSYS2; + * [ ] NuGet; + * [ ] Scoop; + * [ ] vcpkg; + * [ ] winget; diff --git a/build_cmake.sh b/build_cmake.sh index 2c6ab39..f39fca8 100755 --- a/build_cmake.sh +++ b/build_cmake.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") IgnoreRemainingFlagsAndOptions=0 Targets=() @@ -103,10 +105,10 @@ else if [ -z "$Targets" ]; then - echo "Executing build (via command \`$MakeCmd\`)" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`)" else - echo "Executing build (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")" fi $MakeCmd ${Targets[*]} diff --git a/clean_cmake.sh b/clean_cmake.sh index 0abbeed..5d14956 100755 --- a/clean_cmake.sh +++ b/clean_cmake.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") # ########################################################## @@ -69,7 +71,7 @@ else exit 1 else - echo "Cleaning build (via command \`$MakeCmd clean\`)" + echo "Cleaning build of ${ProjectName} (via command \`$MakeCmd clean\`)" $MakeCmd clean status=$? diff --git a/cmake/BuildType.cmake b/cmake/BuildType.cmake index 955d576..90eecf7 100644 --- a/cmake/BuildType.cmake +++ b/cmake/BuildType.cmake @@ -25,8 +25,10 @@ include(BuildType) if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(default_build_type "Debug") else() + set(default_build_type "Release") endif() @@ -44,5 +46,5 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ) endif() -# ############################## end of file ############################# # +# ############################## end of file ############################# # diff --git a/cmake/LanguageFullVersion.cmake b/cmake/LanguageFullVersion.cmake index c0882b4..f57ba36 100644 --- a/cmake/LanguageFullVersion.cmake +++ b/cmake/LanguageFullVersion.cmake @@ -1,10 +1,10 @@ - # ################################################ # X_CMAKE_C_FULLSTANDARD set(X_CMAKE_C_FULLSTANDARD 0) if(FALSE) + elseif(CMAKE_C_STANDARD EQUAL 99) set(X_CMAKE_C_FULLSTANDARD 1999) @@ -32,6 +32,7 @@ endif() set(X_CMAKE_CXX_FULLSTANDARD 0) if(FALSE) + elseif(CMAKE_CXX_STANDARD EQUAL 98) set(X_CMAKE_CXX_FULLSTANDARD 1998) @@ -60,4 +61,3 @@ endif() # ############################## end of file ############################# # - diff --git a/cmake/TargetMacros.cmake b/cmake/TargetMacros.cmake index 940ccb5..48d133b 100644 --- a/cmake/TargetMacros.cmake +++ b/cmake/TargetMacros.cmake @@ -17,6 +17,7 @@ function(define_automated_test_program program_name entry_point_source_name) set(X_GCC_CUSTOM_WARNINGS_ "") if(X_GCC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED) + foreach(warning ${X_GCC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED}) list(APPEND X_GCC_CUSTOM_WARNINGS_ "-Wno-${warning}") @@ -109,6 +110,4 @@ function(define_example_program program_name entry_point_source_name) endfunction(define_example_program) - # ############################## end of file ############################# # - diff --git a/cmake/unixem-config.cmake.in b/cmake/unixem-config.cmake.in index 8262071..479320d 100644 --- a/cmake/unixem-config.cmake.in +++ b/cmake/unixem-config.cmake.in @@ -1,3 +1,2 @@ @PACKAGE_INIT@ include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@-targets.cmake") - diff --git a/ctest_cmake.sh b/ctest_cmake.sh index 7784d57..517462e 100755 --- a/ctest_cmake.sh +++ b/ctest_cmake.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") CMakeVerbose= RunMake=1 @@ -74,7 +76,7 @@ status=0 if [ $RunMake -ne 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all component and unit test programs" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`) and then running all component and unit test programs" mkdir -p $CMakeDir || exit 1 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 5d65590..32eeb75 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -43,4 +43,3 @@ endforeach() # ############################## end of file ############################# # - diff --git a/include/unixem/unixem.h b/include/unixem/unixem.h index 55bf397..ec4968b 100644 --- a/include/unixem/unixem.h +++ b/include/unixem/unixem.h @@ -4,11 +4,11 @@ * Purpose: Version header for the UNIXem API. * * Created: 29th August 2005 - * Updated: 7th September 2025 + * Updated: 4th August 2026 * * Home: https://github.com/synesissoftware/UNIXem * - * Copyright (c) 2019-2025, Matthew Wilson and Synesis Information Systems + * Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems * Copyright (c) 2005-2019, Matthew Wilson and Synesis Software * All rights reserved. * @@ -55,8 +55,8 @@ #ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION # define UNIXEM_VER_UNIXEM_H_UNIXEM_MAJOR 1 # define UNIXEM_VER_UNIXEM_H_UNIXEM_MINOR 7 -# define UNIXEM_VER_UNIXEM_H_UNIXEM_REVISION 8 -# define UNIXEM_VER_UNIXEM_H_UNIXEM_EDIT 32 +# define UNIXEM_VER_UNIXEM_H_UNIXEM_REVISION 9 +# define UNIXEM_VER_UNIXEM_H_UNIXEM_EDIT 33 #endif /* !UNIXEM_DOCUMENTATION_SKIP_SECTION */ /** \def UNIXEM_VER_MAJOR @@ -78,7 +78,7 @@ #define UNIXEM_VER_MAJOR 1 #define UNIXEM_VER_MINOR 13 #define UNIXEM_VER_PATCH 0 -#define UNIXEM_VER_ALPHABETA 0x41 +#define UNIXEM_VER_ALPHABETA 0x81 #define UNIXEM_VER \ (0\ diff --git a/prepare_cmake.sh b/prepare_cmake.sh index 02c0586..514d48d 100755 --- a/prepare_cmake.sh +++ b/prepare_cmake.sh @@ -13,6 +13,8 @@ else DefaultMakeCmd=make fi MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") Configuration=Release @@ -151,7 +153,7 @@ mkdir -p $CMakeDir || exit 1 cd $CMakeDir -echo "Executing CMake (in ${CMakeDir})" +echo "Executing CMake for ${ProjectName} (in ${CMakeDir})" if [ $ExamplesDisabled -eq 0 ]; then CMakeBuildExamplesFlag="ON" ; else CMakeBuildExamplesFlag="OFF" ; fi if [ $MSVC_MT -eq 0 ]; then CMakeMsvcMtFlag="OFF" ; else CMakeMsvcMtFlag="ON" ; fi diff --git a/remove_cmake_artefacts.sh b/remove_cmake_artefacts.sh index 7416db9..e09e895 100755 --- a/remove_cmake_artefacts.sh +++ b/remove_cmake_artefacts.sh @@ -4,6 +4,8 @@ ScriptPath=$0 Dir=$(cd $(dirname "$ScriptPath"); pwd) Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") Directories=( CMakeFiles @@ -98,7 +100,7 @@ if [ ! -d "$CMakeDir" ]; then exit 0 else - echo "Removing all cmake artefacts in '$CMakeDir'" + echo "Removing all ${ProjectName} cmake artefacts in '$CMakeDir'" num_dirs_removed=0 num_files_removed=0 diff --git a/run_all_examples.sh b/run_all_examples.sh index 36154da..27ab112 100755 --- a/run_all_examples.sh +++ b/run_all_examples.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -76,7 +78,7 @@ if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all example programs" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`) and then running all example programs" mkdir -p $CMakeDir || exit 1 @@ -99,27 +101,30 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all example programs" + echo "Listing all ${ProjectName} example programs" else - echo "Running all example programs" + echo "Running all ${ProjectName} example programs" fi - for f in $(find $CMakeDir/examples -type f -exec test -x {} \; -print) - do + if [ -d "$CMakeDir/examples" ]; then - if [ $ListOnly -ne 0 ]; then + for f in $(find "$CMakeDir/examples" -type f -exec test -x {} \; -print | sort) + do - echo "would execute $f:" + if [ $ListOnly -ne 0 ]; then - continue - fi + echo "would execute $f:" - echo - echo "executing $f:" + continue + fi - $f - done + echo + echo "executing $f:" + + $f + done + fi fi exit $status diff --git a/run_all_scratch_tests.sh b/run_all_scratch_tests.sh index 1df2fcc..c976a35 100755 --- a/run_all_scratch_tests.sh +++ b/run_all_scratch_tests.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -85,7 +87,7 @@ if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all scratch (and performance) test programs" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`) and then running all scratch (and performance) test programs" mkdir -p $CMakeDir || exit 1 @@ -108,10 +110,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all scratch (and performance) test programs" + echo "Listing all ${ProjectName} scratch (and performance) test programs" else - echo "Running all scratch (and performance) test programs" + echo "Running all ${ProjectName} scratch (and performance) test programs" fi for f in $(find $CMakeDir -type f '(' -name 'test_scratch*' -o -name 'test.scratch.*' -o -name 'test_performance*' -o -name 'test.performance.*' ')' -exec test -x {} \; -print) diff --git a/run_all_unit_tests.cmd b/run_all_unit_tests.cmd index c124263..b68c97e 100644 --- a/run_all_unit_tests.cmd +++ b/run_all_unit_tests.cmd @@ -1,26 +1,32 @@ @echo off -SETLOCAL +SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION SET SCRIPT_DIRECTORY=%~dp0 SET SCRIPT_PATH_DOC=%~n0[%~x0] IF DEFINED SIS_CMAKE_BUILD_DIR ( - SET CMAKE_DIR=%SIS_CMAKE_BUILD_DIR% + SET "CMAKE_DIR=%SIS_CMAKE_BUILD_DIR%" ) ELSE ( - SET CMAKE_DIR=%SCRIPT_DIRECTORY%_build + SET "CMAKE_DIR=%SCRIPT_DIRECTORY%_build" ) +SET ListOnly=0 +SET Verbose=0 +SET UnitOnly=0 +SET ComponentOnly=0 +SET status=0 + FOR %%a IN (%*) DO ( IF /I {--help}=={%%a} ( IF EXIST "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" ( - type "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" + type "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" ) ECHO ^ -Runs all ^(matching^) component-test and unit-test programs ^ +Runs all ^(matching^) unit-test and/or component-test programs ^ ^ @@ -32,6 +38,42 @@ Flags/options: ^ behaviour: ^ +^ + + -l ^ + + --list-only ^ + + lists the target programs but does not execute them ^ + +^ + + -M ^ + + --no-make ^ + + accepted for parity with the .sh script ^(build is not invoked^) ^ + +^ + + --unit-only ^ + + runs only unit-test programs ^(test.unit.* / test_unit*^) ^ + +^ + + --component-only ^ + + runs only component-test programs ^(test.component.* / test_component*^) ^ + +^ + + -v ^ + + --verbose ^ + + lists each test program before executing it ^ + ^ standard flags: ^ @@ -44,25 +86,103 @@ Flags/options: ^ EXIT /B 0 + ) ELSE IF /I {-l}=={%%a} ( + SET ListOnly=1 + ) ELSE IF /I {--list-only}=={%%a} ( + SET ListOnly=1 + ) ELSE IF /I {-M}=={%%a} ( + REM no-op: this .cmd never invokes the build + ) ELSE IF /I {--no-make}=={%%a} ( + REM no-op: this .cmd never invokes the build + ) ELSE IF /I {--unit-only}=={%%a} ( + SET UnitOnly=1 + ) ELSE IF /I {--component-only}=={%%a} ( + SET ComponentOnly=1 + ) ELSE IF /I {-v}=={%%a} ( + SET Verbose=1 + ) ELSE IF /I {--verbose}=={%%a} ( + SET Verbose=1 ) ELSE ( - ECHO "%SCRIPT_DIRECTORY%: unrecognised argument '%%a'; use --help for usage" 1>&2 + ECHO %SCRIPT_PATH_DOC%: unrecognised argument '%%a'; use --help for usage 1>&2 EXIT /B 1 ) ) -if NOT EXIST "%CMAKE_DIR%" ( +IF !UnitOnly! EQU 1 IF !ComponentOnly! EQU 1 ( - ECHO "CMake build directory '%CMAKE_DIR%' does not exist" + ECHO %SCRIPT_PATH_DOC%: --unit-only and --component-only are mutually exclusive 1>&2 - EXIT /B 1 + EXIT /B 1 ) -FOR /F "usebackq" %%f IN (`DIR /A:-D /B /S %CMAKE_DIR% ^| FINDSTR /I test.*unit.*\.exe$`) DO ( - ECHO . - ECHO executing %%f - %%f +IF NOT EXIST "%CMAKE_DIR%" ( + + ECHO %SCRIPT_PATH_DOC%: CMake build directory '%CMAKE_DIR%' does not exist 1>&2 + + EXIT /B 1 ) -ENDLOCAL +SET "ProjectName=" +FOR /F "usebackq delims=" %%p IN ("%SCRIPT_DIRECTORY%.sis\project_name.txt") DO SET "ProjectName=%%p" + +IF NOT DEFINED ProjectName ( + + ECHO %SCRIPT_PATH_DOC%: could not read project name from .sis\project_name.txt 1>&2 + + EXIT /B 1 +) + +IF !UnitOnly! EQU 1 ( + + SET "TestKindDescription=unit test" +) ELSE IF !ComponentOnly! EQU 1 ( + + SET "TestKindDescription=component test" +) ELSE ( + + SET "TestKindDescription=component and unit test" +) + +IF !ListOnly! EQU 1 ( + + ECHO Listing all !ProjectName! !TestKindDescription! programs +) ELSE ( + + ECHO Running all !ProjectName! !TestKindDescription! programs +) + +IF !UnitOnly! EQU 1 ( + + SET "FindPattern=test\.unit\..*\.exe$" +) ELSE IF !ComponentOnly! EQU 1 ( + + SET "FindPattern=test\.component\..*\.exe$" +) ELSE ( + + SET "FindPattern=test\.unit\..*\.exe$ test\.component\..*\.exe$" +) + +FOR /F "usebackq delims=" %%f IN (`DIR /A:-D /B /S "%CMAKE_DIR%\*.exe" 2^>NUL ^| FINDSTR /I /R "!FindPattern!"`) DO ( + IF !ListOnly! EQU 1 ( + + ECHO would execute %%f: + ) ELSE ( + + IF !Verbose! EQU 1 ( + + ECHO executing %%f: + ) + + "%%f" + IF ERRORLEVEL 1 ( + + SET status=1 + + GOTO :done + ) + ) +) +:done +EXIT /B !status! diff --git a/run_all_unit_tests.sh b/run_all_unit_tests.sh index 12fe51a..bed7973 100755 --- a/run_all_unit_tests.sh +++ b/run_all_unit_tests.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -119,7 +121,7 @@ if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all ${TestKindDescription} programs" + echo "Executing build of ${ProjectName} (via command \`$MakeCmd\`) and then running all ${TestKindDescription} programs" mkdir -p $CMakeDir || exit 1 @@ -144,10 +146,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all ${TestKindDescription} programs" + echo "Listing all ${ProjectName} ${TestKindDescription} programs" else - echo "Running all ${TestKindDescription} programs" + echo "Running all ${ProjectName} ${TestKindDescription} programs" fi if [ $UnitOnly -ne 0 ]; then @@ -196,4 +198,3 @@ exit $status # ############################## end of file ############################# # - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6ef96f..bec462f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,6 +42,7 @@ set_target_properties(UNIXem.core PROPERTIES #]====] + # ######################################################################## # # File: /src/CMakeLists.txt # @@ -152,4 +153,3 @@ install( # ############################## end of file ############################# # - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index bf452e6..3dd3242 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -30,4 +30,3 @@ endforeach() # ############################## end of file ############################# # - diff --git a/test/component/CMakeLists.txt b/test/component/CMakeLists.txt index 7f5929e..bddd3d8 100644 --- a/test/component/CMakeLists.txt +++ b/test/component/CMakeLists.txt @@ -1,6 +1,6 @@ -# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten -add_subdirectory(test.component.dirent) -add_subdirectory(test.component.glob) -add_subdirectory(test.component.unistd.mkdtemp) -add_subdirectory(test.component.unistd.mkstemp) -add_subdirectory(test.component.unistd.usleep) +# SIS:AUTO_GENERATED: Remove this line if you edit the file, otherwise it will be overwritten +add_subdirectory(test.component.dirent) +add_subdirectory(test.component.glob) +add_subdirectory(test.component.unistd.mkdtemp) +add_subdirectory(test.component.unistd.mkstemp) +add_subdirectory(test.component.unistd.usleep) diff --git a/test/component/test.component.unistd.mkstemp/CMakeLists.txt b/test/component/test.component.unistd.mkstemp/CMakeLists.txt index 87de29e..1fc3eb3 100644 --- a/test/component/test.component.unistd.mkstemp/CMakeLists.txt +++ b/test/component/test.component.unistd.mkstemp/CMakeLists.txt @@ -1,3 +1,2 @@ list(APPEND X_MSVC_CUSTOM_WARNINGS_TO_BE_SUPPRESSED 4996) define_automated_test_program(test.component.unistd.mkstemp entry.c) - diff --git a/test/scratch/CMakeLists.txt b/test/scratch/CMakeLists.txt index 3c9e300..377d3a2 100644 --- a/test/scratch/CMakeLists.txt +++ b/test/scratch/CMakeLists.txt @@ -1,13 +1,13 @@ - -add_subdirectory(test.scratch.dlfcn) -#[====[ -add_subdirectory(test.scratch.fnmatch) -]====] -add_subdirectory(test.scratch.getrusage) -add_subdirectory(test.scratch.link) -#[====[ -add_subdirectory(test.scratch.mmap) -]====] -add_subdirectory(test.scratch.setenv) -add_subdirectory(test.scratch.syslog) -add_subdirectory(test.scratch.uio) + +add_subdirectory(test.scratch.dlfcn) +#[====[ +add_subdirectory(test.scratch.fnmatch) +]====] +add_subdirectory(test.scratch.getrusage) +add_subdirectory(test.scratch.link) +#[====[ +add_subdirectory(test.scratch.mmap) +]====] +add_subdirectory(test.scratch.setenv) +add_subdirectory(test.scratch.syslog) +add_subdirectory(test.scratch.uio) diff --git a/test/scratch/test.scratch.dlfcn/test.scratch.dlfcn.c b/test/scratch/test.scratch.dlfcn/test.scratch.dlfcn.c index dbdbf2a..2770d7c 100644 --- a/test/scratch/test.scratch.dlfcn/test.scratch.dlfcn.c +++ b/test/scratch/test.scratch.dlfcn/test.scratch.dlfcn.c @@ -4,7 +4,7 @@ * Purpose: Unit-test of `dlopen()`, `dlsym()`, `dlclose()`. * * Created: 1st January 2004 - * Updated: 16th October 2024 + * Updated: 4th August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -19,6 +19,16 @@ #include #include +#include + + +/* ///////////////////////////////////////////////////////////////////////// + * constants + */ + +/* Defaults so bare invocation (e.g. run_all_scratch_tests.sh) is a useful smoke. */ +#define TEST_SCRATCH_DLFCN_DEFAULT_MODULE "kernel32.dll" +#define TEST_SCRATCH_DLFCN_DEFAULT_SYMBOL "GetCurrentProcessId" /* ///////////////////////////////////////////////////////////////////////// @@ -28,12 +38,15 @@ int main(int argc, char *argv[]) { char const* const program_name = platformstl_C_get_executable_name_from_path(argv[0]).ptr; + char const* module_name; + char const* symbol_name; { int i; for (i = 1; i != argc; ++i) { if (0 == strcmp("--help", argv[i])) { - printf("USAGE: %s \n", program_name); + printf("USAGE: %s [ ]\n", program_name); + printf(" defaults: %s %s\n", TEST_SCRATCH_DLFCN_DEFAULT_MODULE, TEST_SCRATCH_DLFCN_DEFAULT_SYMBOL); return EXIT_SUCCESS; } @@ -42,14 +55,20 @@ int main(int argc, char *argv[]) switch (argc) { case 1: + + module_name = TEST_SCRATCH_DLFCN_DEFAULT_MODULE; + symbol_name = TEST_SCRATCH_DLFCN_DEFAULT_SYMBOL; + break; + case 3: + + module_name = argv[1]; + symbol_name = argv[2]; + break; case 2: fprintf(stderr, "%s: missing arguments; use --help for usage\n", program_name); return EXIT_FAILURE; - case 3: - - break; default: fprintf(stderr, "%s: too many arguments; use --help for usage\n", program_name); @@ -58,9 +77,6 @@ int main(int argc, char *argv[]) } { - char const* const module_name = argv[1]; - char const* const symbol_name = argv[2]; - void* const module = dlopen(module_name, RTLD_NOW); if (NULL == module) @@ -109,4 +125,3 @@ int main(int argc, char *argv[]) /* ///////////////////////////// end of file //////////////////////////// */ - diff --git a/test/scratch/test.scratch.link/test.scratch.link.c b/test/scratch/test.scratch.link/test.scratch.link.c index 7b0c37c..2dd76bf 100644 --- a/test/scratch/test.scratch.link/test.scratch.link.c +++ b/test/scratch/test.scratch.link/test.scratch.link.c @@ -4,7 +4,7 @@ * Purpose: Unit-test of `link()`. * * Created: 2nd September 2005 - * Updated: 28th November 2024 + * Updated: 4th August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -17,16 +17,12 @@ #include +#include #include #include #include -/* ///////////////////////////////////////////////////////////////////////// - * forward declarations - */ - - /* ///////////////////////////////////////////////////////////////////////// * main() */ @@ -34,14 +30,19 @@ int main(int argc, char *argv[]) { char const* const program_name = platformstl_C_get_executable_name_from_path(argv[0]).ptr; - char const* module_name; - char const* symbol_name; + char const* source_path; + char const* link_path; + char default_source[64]; + char default_link[64]; + int using_defaults = 0; + int r = EXIT_FAILURE; { int i; for (i = 1; i != argc; ++i) { if (0 == strcmp("--help", argv[i])) { - printf("USAGE: %s \n", program_name); + printf("USAGE: %s [ ]\n", program_name); + printf(" with no arguments, creates and links a pair of temporary files\n"); return EXIT_SUCCESS; } @@ -50,48 +51,79 @@ int main(int argc, char *argv[]) switch (argc) { case 1: - case 2: - fprintf(stderr, "%s: missing arguments; use --help for usage\n", program_name); + sprintf(default_source, "unixem-scratch-link-src-%d.tmp", (int)getpid()); + sprintf(default_link, "unixem-scratch-link-dst-%d.tmp", (int)getpid()); - return EXIT_FAILURE; + { + FILE* const f = fopen(default_source, "wb"); + + if (NULL == f) + { + fprintf(stderr, "%s: failed to create temporary source '%s': %s\n", program_name, default_source, strerror(errno)); + + return EXIT_FAILURE; + } + + if (1 != fwrite("x", 1, 1, f)) + { + fclose(f); + remove(default_source); + + fprintf(stderr, "%s: failed to write temporary source '%s'\n", program_name, default_source); + + return EXIT_FAILURE; + } + + fclose(f); + } + + source_path = default_source; + link_path = default_link; + using_defaults = 1; + break; case 3: - module_name = argv[1]; - symbol_name = argv[2]; + source_path = argv[1]; + link_path = argv[2]; break; - default: + case 2: - fprintf(stderr, "%s: too many arguments; use --help for usage\n", program_name); + fprintf(stderr, "%s: missing arguments; use --help for usage\n", program_name); return EXIT_FAILURE; - } + default: - if (argc < 3) - { - fprintf(stderr, "USAGE: test.scratch.link \n"); + fprintf(stderr, "%s: too many arguments; use --help for usage\n", program_name); return EXIT_FAILURE; } - else + { - int const res = link(module_name, symbol_name); + int const res = link(source_path, link_path); if (0 == res) { - fprintf(stdout, "\"%s\" => \"%s\"\n", module_name, symbol_name); + fprintf(stdout, "\"%s\" => \"%s\"\n", source_path, link_path); - return EXIT_SUCCESS; + r = EXIT_SUCCESS; } else { fprintf(stderr, "link() failed: %d (%s)\n", errno, strerror(errno)); - return EXIT_FAILURE; + r = EXIT_FAILURE; } } + + if (using_defaults) + { + remove(link_path); + remove(source_path); + } + + return r; } /* ///////////////////////////// end of file //////////////////////////// */ - diff --git a/test/scratch/test.scratch.uio/test.scratch.uio.c b/test/scratch/test.scratch.uio/test.scratch.uio.c index 7bd3671..0a871bd 100644 --- a/test/scratch/test.scratch.uio/test.scratch.uio.c +++ b/test/scratch/test.scratch.uio/test.scratch.uio.c @@ -4,7 +4,7 @@ * Purpose: Unit-test of `uio()`. * * Created: 19th September 2005 - * Updated: 29th November 2024 + * Updated: 4th August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -27,12 +28,14 @@ static int main_(int argc, char **argv) { char const* const program_name = platformstl_C_get_executable_name_from_path(argv[0]).ptr; + char const* fileName; { int i; for (i = 1; i != argc; ++i) { if (0 == strcmp("--help", argv[i])) { - printf("USAGE: %s \n", program_name); + printf("USAGE: %s [ ]\n", program_name); + printf(" with no arguments, reads from this executable image\n"); return EXIT_SUCCESS; } @@ -42,11 +45,12 @@ static int main_(int argc, char **argv) { case 1: - fprintf(stderr, "%s: missing argument; use --help for usage\n", program_name); - - return EXIT_FAILURE; + /* Bare invocation (e.g. run_all_scratch_tests.sh): smoke against self. */ + fileName = argv[0]; + break; case 2: + fileName = argv[1]; break; default: @@ -56,7 +60,6 @@ static int main_(int argc, char **argv) } { - char const* fileName = argv[1]; int fd = _open(fileName, _O_RDONLY); struct iovec vectors[3]; char sz1[10]; @@ -64,6 +67,13 @@ static int main_(int argc, char **argv) char sz3[21]; unixem_ssize_t n; + if (fd < 0) + { + fprintf(stderr, "%s: failed to open '%s'\n", program_name, fileName); + + return EXIT_FAILURE; + } + vectors[0].iov_base = &sz1[0]; vectors[0].iov_len = sizeof(sz1); vectors[1].iov_base = &sz2[0]; @@ -76,6 +86,10 @@ static int main_(int argc, char **argv) if (n < 0) { fprintf(stderr, "%s: failed to invoke `readv()` on '%s': %ld\n", program_name, fileName, (long)n); + + close(fd); + + return EXIT_FAILURE; } else { @@ -85,7 +99,7 @@ static int main_(int argc, char **argv) } } - return 0; + return EXIT_SUCCESS; } int main(int argc, char *argv[]) @@ -95,4 +109,3 @@ int main(int argc, char *argv[]) /* ///////////////////////////// end of file //////////////////////////// */ -