Compare commits
4 commits
stable/3.4
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6a706392a6 | ||
![]() |
9d18fc60b2 | ||
![]() |
ab4fb231e5 | ||
![]() |
887fa8cdaf |
4 changed files with 34 additions and 6 deletions
2
cat.c
2
cat.c
|
@ -13,7 +13,7 @@ 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++){
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
project('patricus utils', 'c', version: '3.4')
|
project('patricus utils', 'c', 'cpp', version: '4.0', default_options: ['cpp_std=c++20'])
|
||||||
|
|
||||||
branch_name = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: true).stdout().strip()
|
branch_name = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: true).stdout().strip()
|
||||||
if branch_name.startswith('stable/')
|
if branch_name.startswith('stable/')
|
||||||
full_version = meson.project_version()
|
full_version = meson.project_version()
|
||||||
|
@ -7,9 +8,8 @@ else
|
||||||
full_version = '@0@(@1@)'.format(meson.project_version(), git_hash)
|
full_version = '@0@(@1@)'.format(meson.project_version(), git_hash)
|
||||||
endif
|
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',
|
||||||
|
@ -17,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
27
nuke.cpp
Normal 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue