Compare commits
4 commits
stable/3.4
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6a706392a6 | ||
![]() |
9d18fc60b2 | ||
![]() |
ab4fb231e5 | ||
![]() |
887fa8cdaf |
6 changed files with 40 additions and 15 deletions
4
cat.c
4
cat.c
|
@ -5,17 +5,15 @@
|
|||
#include <stdlib.h>
|
||||
#include<sys/stat.h>
|
||||
#include<string.h>
|
||||
#include<windows.h>
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
|
||||
if(argc==1) {
|
||||
read_from_stdin();
|
||||
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<argc;meowing++){
|
||||
|
|
|
@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
else if(strcmp("-v", argv[1]) == 0) {
|
||||
printf("patricus utils, version %s", version);
|
||||
printf("patricus utils, version %s", VERSION);
|
||||
return 0;
|
||||
}
|
||||
else if(argc == 2) {
|
||||
|
|
20
meson.build
20
meson.build
|
@ -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
|
||||
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))
|
||||
conf.set('VERSION', '"@0@"'.format(full_version))
|
||||
|
||||
configure_file(
|
||||
output: 'version.h',
|
||||
|
@ -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: '.')
|
||||
|
|
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";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
0.1
|
|
@ -1 +0,0 @@
|
|||
0.1 meow.c
|
Loading…
Add table
Add a link
Reference in a new issue