Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
patricus
6a706392a6 fixes #5 2025-07-05 19:38:18 +02:00
patricus
9d18fc60b2 added nuke util, C++ 20 build 2025-07-05 18:57:54 +02:00
patricus
ab4fb231e5 added C++ based nuke tool to nuke dirs/files 2025-06-30 17:21:55 +02:00
patricus
887fa8cdaf fix a mistake 2025-06-29 19:52:04 +02:00
6 changed files with 40 additions and 15 deletions

4
cat.c
View file

@ -5,17 +5,15 @@
#include <stdlib.h> #include <stdlib.h>
#include<sys/stat.h> #include<sys/stat.h>
#include<string.h> #include<string.h>
#include<windows.h>
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
if(argc==1) { if(argc==1) {
read_from_stdin(); read_from_stdin();
return 0; return 0;
} }
if(strcmp(argv[1],"-v")==0) if(strcmp(argv[1],"-v")==0)
{ {
printf("patricus utils, version %s",version); printf("patricus utils, version %s",VERSION);
return 0; return 0;
} }
for(int meowing=1;meowing<argc;meowing++){ for(int meowing=1;meowing<argc;meowing++){

View file

@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
else if(strcmp("-v", argv[1]) == 0) { else if(strcmp("-v", argv[1]) == 0) {
printf("patricus utils, version %s", version); printf("patricus utils, version %s", VERSION);
return 0; return 0;
} }
else if(argc == 2) { else if(argc == 2) {

View file

@ -1,14 +1,15 @@
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 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() 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) full_version = '@0@(@1@)'.format(meson.project_version(), git_hash)
endif
# Generate header
conf = configuration_data() conf = configuration_data()
conf.set('version', '"@0@"'.format(full_version)) conf.set('VERSION', '"@0@"'.format(full_version))
configure_file( configure_file(
output: 'version.h', output: 'version.h',
@ -16,4 +17,5 @@ configure_file(
) )
executable('cat', ['cat.c', 'stdin.c'], include_directories: '.') 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: '.')

27
nuke.cpp Normal file
View file

@ -0,0 +1,27 @@
#include<version.h>
#include<string>
#include<filesystem>
#include<iostream>
using namespace std;
int main(int argc, char* argv[])
{
for(int i=1;i<argc;i++){
if (string(argv[i]) == "-v")
{
cout<<"patricus utils, version "+string(VERSION);
return 0;
}
if(!filesystem::exists(argv[i]))
{
cerr<<"error, no such file or directory";
return 1;
}
try
{
filesystem::remove_all(argv[i]);
}
catch(std::filesystem::filesystem_error){
cout<<"error: permission denied";
}
}
}

View file

@ -1 +0,0 @@
0.1

View file

@ -1 +0,0 @@
0.1 meow.c