From adec33d6a5a53577d5580533307082350bad5d90a3e838ecfed6d9b72e42bf4b Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 20 May 2026 02:31:05 -0400 Subject: [PATCH] Initial basic work. Next to import Alepha and other stuff. --- Makefile | 8 ++++++++ cudir.cc | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Makefile create mode 100644 cudir.cc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a5a5025 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +CXXFLAGS+= -std=c++23 -O3 + +CPPFLAGS+= -I /usr/local/include +CPPFLAGS+= -I. + +LDFLAGS+= -Wl,-rpath,'$$ORIGIN/' + +all: cudir diff --git a/cudir.cc b/cudir.cc new file mode 100644 index 0000000..09e2605 --- /dev/null +++ b/cudir.cc @@ -0,0 +1,35 @@ +#include +#include + +std::string +drwx( const std::filesystem::perms p ) +{ + std::ostringstream oss; + using std::filesystem::perms; + auto show = [&](const char op, const perms perm) + { + oss << (perms::none == (perm bitand p) ? '-' : op); + }; + show('r', perms::owner_read); + show('w', perms::owner_write); + show('x', perms::owner_exec); + show('r', perms::group_read); + show('w', perms::group_write); + show('x', perms::group_exec); + show('r', perms::others_read); + show('w', perms::others_write); + show('x', perms::others_exec); + + return std::move( oss ).str(); +} + +int +main() +{ + std::filesystem::path where="./"; + + for( const auto &entry: std::filesystem::directory_iterator{ where } ) + { + std::cout << entry.path().string() << " " << drwx( status( entry.path() ).permissions() ) << std::endl; + } +}