Add an initial Novell-style NDIR implementation for the DOS utilities. The new tool supports basic DOS namespace directory listings using _dos_findfirst/_dos_findnext, including wildcard paths, current-directory listing, files-only and directories-only modes, recursive /SUB listings, continuous output and Novell-style help text. NDIR separates file and directory output into Novell-like sections, prints long NetWare-style attribute brackets, and reports both file bytes and allocated bytes in blocks using a simple per-file 4 KiB block approximation for the initial implementation. Add initial /RIGHTS support. The rights format displays rights columns for files and directories, obtains effective rights through Client32 NCP87, and falls back to the older directory-handle effective-rights path when needed. For now the inherited-rights column uses the effective rights value until a separate inherited-rights mask is available. Add initial /DATES support with a Novell-style date column layout showing Last Updated, Last Archived, Accessed and Created/Copied fields. The initial implementation uses the DOS findfirst update timestamp for the available date values and placeholder archive/access values until full NetWare namespace date fields are exposed. Add /SHORT and /BRIEF as compact output modes for recursive listings and manual testing. These modes keep the useful values while suppressing the large Novell-style section headers and empty recursive sections. Wire NDIR into the multicall dispatcher, CMake build and install list, and document the supported command forms in the README. Owner display, true inherited-right masks, full namespace date fields, sorting and restrictions remain future work.
219 lines
6.8 KiB
CMake
219 lines
6.8 KiB
CMake
# DOS utilities for mars-nwe.
|
|
#
|
|
# Default install mode uses a split:
|
|
# - legacy command names are installed from netold.exe
|
|
# - new command names that netold.exe does not contain are installed from net.exe
|
|
#
|
|
# Maintainer mode can rebuild the new net.exe with Open Watcom. The freshly
|
|
# built binary is only installed when MARS_NWE_INSTALL_NEW_DOSUTILS is ON, or
|
|
# for the new-only command names in the default split install.
|
|
|
|
set(MARS_DOSUTILS_LEGACY_NET_EXE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/netold.exe"
|
|
CACHE FILEPATH "Legacy/pre-Client32 DOS net.exe used by default for legacy command names"
|
|
)
|
|
|
|
set(MARS_DOSUTILS_NEW_NET_EXE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/net.exe"
|
|
CACHE FILEPATH "New/experimental DOS net.exe used for new-only tools or when MARS_NWE_INSTALL_NEW_DOSUTILS is ON"
|
|
)
|
|
|
|
set(MARS_DOSUTILS_LEGACY_TOOLS
|
|
net
|
|
login
|
|
profile
|
|
spawn
|
|
passwd
|
|
path
|
|
pathins
|
|
pathdel
|
|
map
|
|
mapdel
|
|
logout
|
|
capture
|
|
endcap
|
|
)
|
|
|
|
# Tools not present in netold.exe. These are installed from the new binary
|
|
# even in the default split mode.
|
|
set(MARS_DOSUTILS_NEW_ONLY_TOOLS
|
|
slist
|
|
flag
|
|
flagdir
|
|
rights
|
|
grant
|
|
revoke
|
|
remove
|
|
ndir
|
|
)
|
|
|
|
if(MARS_NWE_BUILD_DOSUTILS)
|
|
find_package(OpenWatcom REQUIRED)
|
|
|
|
set(DOSUTILS_C_SOURCES
|
|
net.c
|
|
tools.c
|
|
netcall.c
|
|
ncpcall.c
|
|
login.c
|
|
map.c
|
|
slist.c
|
|
ndir.c
|
|
flag.c
|
|
flagdir.c
|
|
rights.c
|
|
grant.c
|
|
revoke.c
|
|
remove.c
|
|
trustee.c
|
|
c32ncp.c
|
|
nwcrypt.c
|
|
nwdebug.c
|
|
nwtests.c
|
|
capture.c
|
|
)
|
|
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/kern.obj"
|
|
COMMAND "${CMAKE_COMMAND}" -E env ${OPENWATCOM_ENV}
|
|
"${OPENWATCOM_WASM}"
|
|
-q
|
|
-zq
|
|
-fo="${CMAKE_CURRENT_BINARY_DIR}/kern.obj"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/kern_wasm.asm"
|
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/kern_wasm.asm"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
|
VERBATIM
|
|
)
|
|
|
|
set(DOSUTILS_OBJECTS)
|
|
foreach(src IN LISTS DOSUTILS_C_SOURCES)
|
|
get_filename_component(obj_name "${src}" NAME_WE)
|
|
set(obj "${CMAKE_CURRENT_BINARY_DIR}/${obj_name}.obj")
|
|
list(APPEND DOSUTILS_OBJECTS "${obj}")
|
|
|
|
add_custom_command(
|
|
OUTPUT "${obj}"
|
|
COMMAND "${CMAKE_COMMAND}" -E env ${OPENWATCOM_ENV}
|
|
"${OPENWATCOM_WCL}"
|
|
-q
|
|
-zq
|
|
-bt=dos
|
|
-ml
|
|
-0
|
|
-c
|
|
-fo="${obj}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${src}"
|
|
DEPENDS
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/${src}"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/net.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/kern.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/c32ncp.h"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/nwcrypt.h"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
|
VERBATIM
|
|
)
|
|
endforeach()
|
|
|
|
add_custom_command(
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/net.exe"
|
|
COMMAND "${CMAKE_COMMAND}" -E env ${OPENWATCOM_ENV}
|
|
"${OPENWATCOM_WCL}"
|
|
-q
|
|
-zq
|
|
-bt=dos
|
|
-ml
|
|
-0
|
|
-k32768
|
|
-fe="${CMAKE_CURRENT_BINARY_DIR}/net.exe"
|
|
${DOSUTILS_OBJECTS}
|
|
"${CMAKE_CURRENT_BINARY_DIR}/kern.obj"
|
|
DEPENDS
|
|
${DOSUTILS_OBJECTS}
|
|
"${CMAKE_CURRENT_BINARY_DIR}/kern.obj"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(dosutils_net ALL
|
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/net.exe"
|
|
)
|
|
|
|
set(MARS_DOSUTILS_BUILT_NET_EXE "${CMAKE_CURRENT_BINARY_DIR}/net.exe")
|
|
else()
|
|
set(MARS_DOSUTILS_BUILT_NET_EXE "")
|
|
endif()
|
|
|
|
if(MARS_NWE_BUILD_DOSUTILS)
|
|
set(MARS_DOSUTILS_SELECTED_NEW_EXE "${MARS_DOSUTILS_BUILT_NET_EXE}")
|
|
else()
|
|
set(MARS_DOSUTILS_SELECTED_NEW_EXE "${MARS_DOSUTILS_NEW_NET_EXE}")
|
|
endif()
|
|
|
|
if(MARS_NWE_INSTALL_NEW_DOSUTILS)
|
|
set(MARS_DOSUTILS_SELECTED_LEGACY_EXE "${MARS_DOSUTILS_SELECTED_NEW_EXE}")
|
|
else()
|
|
set(MARS_DOSUTILS_SELECTED_LEGACY_EXE "${MARS_DOSUTILS_LEGACY_NET_EXE}")
|
|
endif()
|
|
|
|
set(MARS_DOSUTILS_SELECTED_LEGACY_IS_BUILT FALSE)
|
|
set(MARS_DOSUTILS_SELECTED_NEW_IS_BUILT FALSE)
|
|
if(MARS_NWE_BUILD_DOSUTILS)
|
|
if(MARS_DOSUTILS_SELECTED_LEGACY_EXE STREQUAL MARS_DOSUTILS_BUILT_NET_EXE)
|
|
set(MARS_DOSUTILS_SELECTED_LEGACY_IS_BUILT TRUE)
|
|
endif()
|
|
if(MARS_DOSUTILS_SELECTED_NEW_EXE STREQUAL MARS_DOSUTILS_BUILT_NET_EXE)
|
|
set(MARS_DOSUTILS_SELECTED_NEW_IS_BUILT TRUE)
|
|
endif()
|
|
endif()
|
|
|
|
if(MARS_NWE_INSTALL_DOSUTILS)
|
|
if(NOT MARS_DOSUTILS_SELECTED_LEGACY_IS_BUILT AND NOT EXISTS "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}")
|
|
message(FATAL_ERROR
|
|
"Selected legacy/default DOS utility missing: ${MARS_DOSUTILS_SELECTED_LEGACY_EXE}. "
|
|
"Commit dosutils/netold.exe, enable MARS_NWE_INSTALL_NEW_DOSUTILS, "
|
|
"or enable MARS_NWE_BUILD_DOSUTILS."
|
|
)
|
|
endif()
|
|
|
|
if(NOT MARS_DOSUTILS_SELECTED_NEW_IS_BUILT AND NOT EXISTS "${MARS_DOSUTILS_SELECTED_NEW_EXE}")
|
|
message(FATAL_ERROR
|
|
"Selected new DOS utility missing: ${MARS_DOSUTILS_SELECTED_NEW_EXE}. "
|
|
"Commit dosutils/net.exe or enable MARS_NWE_BUILD_DOSUTILS."
|
|
)
|
|
endif()
|
|
|
|
message(STATUS "DOS legacy/default utility binary: ${MARS_DOSUTILS_SELECTED_LEGACY_EXE}")
|
|
message(STATUS "DOS new-only utility binary: ${MARS_DOSUTILS_SELECTED_NEW_EXE}")
|
|
|
|
foreach(tool IN LISTS MARS_DOSUTILS_LEGACY_TOOLS)
|
|
if(tool STREQUAL "net")
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/public"
|
|
RENAME net.exe)
|
|
else()
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/public"
|
|
RENAME "${tool}.exe")
|
|
endif()
|
|
endforeach()
|
|
|
|
foreach(tool IN LISTS MARS_DOSUTILS_NEW_ONLY_TOOLS)
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_NEW_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/public"
|
|
RENAME "${tool}.exe")
|
|
endforeach()
|
|
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
|
|
RENAME login.exe)
|
|
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
|
|
RENAME map.exe)
|
|
|
|
install(FILES "${MARS_DOSUTILS_SELECTED_LEGACY_EXE}"
|
|
DESTINATION "${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/login"
|
|
RENAME slist.exe)
|
|
endif()
|