From 7428365f064f0f56384c72d5173d7576c494e1b2 Mon Sep 17 00:00:00 2001 From: patricus Date: Sun, 29 Jun 2025 19:50:22 +0200 Subject: [PATCH 1/5] fix a mistake that I put a broken version into stable tree, I added a line that shouldn't be there --- cat.c | 2 -- meson.build | 13 +++++++------ version.h | 1 - version.hcode | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 version.h delete mode 100644 version.hcode diff --git a/cat.c b/cat.c index e3562cb..5accecd 100644 --- a/cat.c +++ b/cat.c @@ -5,10 +5,8 @@ #include #include #include -#include int main(int argc,char *argv[]) { - if(argc==1) { read_from_stdin(); return 0; diff --git a/meson.build b/meson.build index c52b376..52e47be 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,11 @@ project('patricus utils', 'c', version: '3.4') - -# Get the short git commit hash -git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip() - -# Combine version and hash -full_version = '@0@(@1@)'.format(meson.project_version(), git_hash) +branch_name = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: true).stdout().strip() +if branch_name.startswith('stable/') + full_version = meson.project_version() +else + git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip() + full_version = '@0@(@1@)'.format(meson.project_version(), git_hash) +endif # Generate header conf = configuration_data() diff --git a/version.h b/version.h deleted file mode 100644 index 49d5957..0000000 --- a/version.h +++ /dev/null @@ -1 +0,0 @@ -0.1 diff --git a/version.hcode b/version.hcode deleted file mode 100644 index 9e45084..0000000 --- a/version.hcode +++ /dev/null @@ -1 +0,0 @@ -0.1 meow.c From 887fa8cdaf5d33fd7ac954a5bb81a540ab728005 Mon Sep 17 00:00:00 2001 From: patricus Date: Sun, 29 Jun 2025 19:52:04 +0200 Subject: [PATCH 2/5] fix a mistake --- cat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/cat.c b/cat.c index e3562cb..db013fe 100644 --- a/cat.c +++ b/cat.c @@ -5,7 +5,6 @@ #include #include #include -#include int main(int argc,char *argv[]) { From ab4fb231e5bb295b887f47c82a9a9df2ba64873c Mon Sep 17 00:00:00 2001 From: patricus Date: Mon, 30 Jun 2025 17:21:55 +0200 Subject: [PATCH 3/5] added C++ based nuke tool to nuke dirs/files --- cat.c | 1 - meson.build | 18 ++++++++++-------- nuke.cpp | 14 ++++++++++++++ version.h | 1 - version.hcode | 1 - 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 nuke.cpp delete mode 100644 version.h delete mode 100644 version.hcode diff --git a/cat.c b/cat.c index db013fe..5accecd 100644 --- a/cat.c +++ b/cat.c @@ -7,7 +7,6 @@ #include int main(int argc,char *argv[]) { - if(argc==1) { read_from_stdin(); return 0; diff --git a/meson.build b/meson.build index c52b376..d6a4b4a 100644 --- a/meson.build +++ b/meson.build @@ -1,12 +1,13 @@ -project('patricus utils', 'c', version: '3.4') +project('patricus utils', 'c', 'cpp', version: '4.0', default_options: ['cpp_std=c++20']) -# Get the short git commit hash -git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip() +branch_name = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: true).stdout().strip() +if branch_name.startswith('stable/') + full_version = meson.project_version() +else + git_hash = run_command('git', 'rev-parse', 'HEAD', check: true).stdout().strip() + full_version = '@0@(@1@)'.format(meson.project_version(), git_hash) +endif -# Combine version and hash -full_version = '@0@(@1@)'.format(meson.project_version(), git_hash) - -# Generate header conf = configuration_data() conf.set('version', '"@0@"'.format(full_version)) @@ -16,4 +17,5 @@ configure_file( ) executable('cat', ['cat.c', 'stdin.c'], include_directories: '.') -executable('cmpsize', ['cmpsize.c', 'bytes.c'], include_directories: '.') +executable('cmpsize', ['cmpsize.c', 'bytes.c']) +executable('nuke', ['nuke.cpp'], include_directories: '.') diff --git a/nuke.cpp b/nuke.cpp new file mode 100644 index 0000000..36ffa44 --- /dev/null +++ b/nuke.cpp @@ -0,0 +1,14 @@ +#include +#include +using namespace std; +int main(int argc, char* argv[]) +{ +for(int i=1;i Date: Sat, 5 Jul 2025 18:57:54 +0200 Subject: [PATCH 4/5] added nuke util, C++ 20 build --- cat.c | 2 +- cmpsize.c | 2 +- meson.build | 2 +- nuke.cpp | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cat.c b/cat.c index 5accecd..784b32c 100644 --- a/cat.c +++ b/cat.c @@ -13,7 +13,7 @@ return 0; } if(strcmp(argv[1],"-v")==0) { - printf("patricus utils, version %s",version); + printf("patricus utils, version %s",VERSION); return 0; } for(int meowing=1;meowing +#include #include #include using namespace std; int main(int argc, char* argv[]) { for(int i=1;i Date: Sat, 5 Jul 2025 19:38:18 +0200 Subject: [PATCH 5/5] fixes #5 --- nuke.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nuke.cpp b/nuke.cpp index 147bcd2..e9567a7 100644 --- a/nuke.cpp +++ b/nuke.cpp @@ -9,12 +9,19 @@ for(int i=1;i