Compare commits
11 Commits
c239e59a83
...
Main
| Author | SHA1 | Date | |
|---|---|---|---|
| f1f0599267 | |||
| ae2fb89d82 | |||
| 527bd60f52 | |||
| d1c17c48a8 | |||
| e6a5b479a0 | |||
| f502d332bc | |||
| 97b0739ecb | |||
| d2cc71f3fc | |||
| 30cfdcc841 | |||
| 40e83a521f | |||
| 080561e845 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -21,3 +21,5 @@ VisualStudio/filesync/x64/*
|
|||||||
*.VC.opendb
|
*.VC.opendb
|
||||||
tests/*
|
tests/*
|
||||||
.vs
|
.vs
|
||||||
|
|
||||||
|
/.issues/
|
||||||
|
|||||||
67
.vscode/c_cpp_properties.json
vendored
67
.vscode/c_cpp_properties.json
vendored
@@ -4,18 +4,9 @@
|
|||||||
"name": "Mac",
|
"name": "Mac",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"/usr/include",
|
"/usr/include",
|
||||||
"${workspaceRoot}",
|
"${workspaceFolder}",
|
||||||
"${workspaceRoot}/src/"
|
"${workspaceFolder}/src/"
|
||||||
],
|
],
|
||||||
"browse": {
|
|
||||||
"limitSymbolsToIncludedHeaders": true,
|
|
||||||
"databaseFilename": "",
|
|
||||||
"path": [
|
|
||||||
"/usr/include",
|
|
||||||
"${workspaceRoot}",
|
|
||||||
"${workspaceRoot}/src/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"intelliSenseMode": "clang-x64",
|
"intelliSenseMode": "clang-x64",
|
||||||
"macFrameworkPath": [
|
"macFrameworkPath": [
|
||||||
"/System/Library/Frameworks",
|
"/System/Library/Frameworks",
|
||||||
@@ -26,48 +17,34 @@
|
|||||||
"name": "Linux",
|
"name": "Linux",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"/usr/include",
|
"/usr/include",
|
||||||
"${workspaceRoot}",
|
"${workspaceFolder}",
|
||||||
"${workspaceRoot}/src/"
|
"${workspaceFolder}/src/"
|
||||||
],
|
],
|
||||||
"browse": {
|
"intelliSenseMode": "linux-gcc-x64",
|
||||||
"limitSymbolsToIncludedHeaders": true,
|
"compilerPath": "/usr/bin/gcc",
|
||||||
"databaseFilename": "",
|
"cStandard": "c17",
|
||||||
"path": [
|
|
||||||
"/usr/include",
|
|
||||||
"${workspaceRoot}",
|
|
||||||
"${workspaceRoot}/src/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"intelliSenseMode": "clang-x64",
|
|
||||||
"compilerPath": "/usr/bin/clang",
|
|
||||||
"cStandard": "c11",
|
|
||||||
"cppStandard": "c++17"
|
"cppStandard": "c++17"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"C:\\msys64\\mingw64\\include",
|
"C:/msys64/mingw64/include",
|
||||||
"C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include",
|
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||||
"${workspaceRoot}",
|
"${workspaceFolder}",
|
||||||
"${workspaceRoot}/src/"
|
"${workspaceFolder}/src/"
|
||||||
],
|
],
|
||||||
"browse": {
|
"defines": [
|
||||||
"limitSymbolsToIncludedHeaders": true,
|
"WIN32",
|
||||||
"databaseFilename": "",
|
"_DEBUG",
|
||||||
"path": [
|
"UNICODE",
|
||||||
"C:\\msys64\\mingw64\\include",
|
"_UNICODE"
|
||||||
"C:\\msys64\\mingw64\\x86_64-w64-mingw32\\include",
|
],
|
||||||
"${workspaceRoot}",
|
"windowsSdkVersion": "10.0.18362.0",
|
||||||
"${workspaceRoot}/src/"
|
"compilerPath": "C:/msys64/mingw64/bin/g++.exe",
|
||||||
]
|
"cStandard": "c17",
|
||||||
},
|
|
||||||
"intelliSenseMode": "msvc-x64",
|
|
||||||
"cStandard": "c11",
|
|
||||||
"cppStandard": "c++17",
|
"cppStandard": "c++17",
|
||||||
"defines": [
|
"intelliSenseMode": "windows-gcc-x64"
|
||||||
"WIN32"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 3
|
"version": 4
|
||||||
}
|
}
|
||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"*.h": "c"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2015 Valeriano Alfonso Rodriguez
|
Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -1,12 +1,13 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
IsMinGW := $(findstring MSYS,$(shell uname -s))$(findstring MINGW,$(shell uname -s))
|
IsMinGW := $(findstring MSYS,$(shell uname -s))$(findstring MINGW,$(shell uname -s))
|
||||||
ifneq (,$(IsMinGW))
|
ifneq (,$(IsMinGW))
|
||||||
RES_APP := filesync.exe
|
RES_APP := filesync.exe
|
||||||
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut --delimiter=' ' --fields=2)
|
BUILDDIR := build-$(shell gcc -dumpmachine)
|
||||||
else
|
else
|
||||||
RES_APP := filesync
|
RES_APP := filesync
|
||||||
BUILDDIR := build-$(shell gcc -v 2>&1 | grep "Target:" | cut --delimiter=' ' --fields=2)
|
BUILDDIR := build-$(shell gcc -dumpmachine)
|
||||||
endif
|
endif
|
||||||
VERBOSE_BUILD=false
|
VERBOSE_BUILD=false
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 2012
|
|
||||||
Project("{2857B73E-F847-4B02-9238-064979017E93}") = "FileSync", "FileSync\FileSync.cproj", "{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(MonoDevelopProperties) = preSolution
|
|
||||||
StartupItem = FileSync\FileSync.cproj
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<Properties>
|
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
|
||||||
<MonoDevelop.Ide.Workbench />
|
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
|
||||||
<BreakpointStore />
|
|
||||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
|
||||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
|
||||||
</Properties>
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{1926D52A-66BE-4D25-B6A3-1E691CDD8B18}</ProjectGuid>
|
|
||||||
<Compiler>
|
|
||||||
<Compiler ctype="GccCompiler" />
|
|
||||||
</Compiler>
|
|
||||||
<Language>C</Language>
|
|
||||||
<Target>Bin</Target>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
|
||||||
<OutputName>FileSync</OutputName>
|
|
||||||
<CompileTarget>Bin</CompileTarget>
|
|
||||||
<DefineSymbols>DEBUG MONODEVELOP</DefineSymbols>
|
|
||||||
<SourceDirectory>.</SourceDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<OutputPath>bin\Release</OutputPath>
|
|
||||||
<OutputName>FileSync</OutputName>
|
|
||||||
<CompileTarget>Bin</CompileTarget>
|
|
||||||
<OptimizationLevel>3</OptimizationLevel>
|
|
||||||
<DefineSymbols>MONODEVELOP</DefineSymbols>
|
|
||||||
<SourceDirectory>.</SourceDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="src\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="..\..\src\crc.c">
|
|
||||||
<Link>src\crc.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\filenode.c">
|
|
||||||
<Link>src\filenode.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\actionfilenode.c">
|
|
||||||
<Link>src\actionfilenode.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\actionfilenodesync.c">
|
|
||||||
<Link>src\actionfilenodesync.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\actionfilenodecopy.c">
|
|
||||||
<Link>src\actionfilenodecopy.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\fileutil.c">
|
|
||||||
<Link>src\fileutil.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\main.c">
|
|
||||||
<Link>src\main.c</Link>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="..\..\src\util.c">
|
|
||||||
<Link>src\util.c</Link>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\src\crc.h">
|
|
||||||
<Link>src\crc.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\filenode.h">
|
|
||||||
<Link>src\filenode.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\actionfilenode.h">
|
|
||||||
<Link>src\actionfilenode.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\actionfilenodesync.h">
|
|
||||||
<Link>src\actionfilenodesync.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\actionfilenodecopy.h">
|
|
||||||
<Link>src\actionfilenodecopy.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\fileutil.h">
|
|
||||||
<Link>src\fileutil.h</Link>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\src\util.h">
|
|
||||||
<Link>src\util.h</Link>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -37,8 +37,6 @@ There is a GNU Make compatible Makefile usable on Linux and MingGW.
|
|||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
A Visual Studio 2015 solution is also provided under `VisualStudio` subdirectory.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
1. Fork it!
|
1. Fork it!
|
||||||
2. Create your feature branch: `git checkout -b my-new-feature`
|
2. Create your feature branch: `git checkout -b my-new-feature`
|
||||||
@@ -53,7 +51,7 @@ A Visual Studio 2015 solution is also provided under `VisualStudio` subdirectory
|
|||||||
|
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2015 Valeriano Alfonso Rodriguez
|
Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 14
|
|
||||||
VisualStudioVersion = 14.0.23107.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filesync", "filesync\filesync.vcxproj", "{D10AC12A-263E-479F-A478-FD8F4067F6F3}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{D10AC12A-263E-479F-A478-FD8F4067F6F3}.Release|x86.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{D10AC12A-263E-479F-A478-FD8F4067F6F3}</ProjectGuid>
|
|
||||||
<RootNamespace>filesync</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup />
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
|
||||||
</Link>
|
|
||||||
<PostBuildEvent>
|
|
||||||
<Command>copy $(TargetPath) $(ProjectDir)..\..\$(TargetFileName)</Command>
|
|
||||||
</PostBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>_MBCS;WIN32;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>_MBCS;%(PreprocessorDefinitions);WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
<PostBuildEvent>
|
|
||||||
<Command>copy $(TargetPath) $(ProjectDir)..\..\$(TargetFileName)</Command>
|
|
||||||
</PostBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\..\src\actionfilenode.c" />
|
|
||||||
<ClCompile Include="..\..\src\actionfilenodecopy.c" />
|
|
||||||
<ClCompile Include="..\..\src\actionfilenodesync.c" />
|
|
||||||
<ClCompile Include="..\..\src\crc.c" />
|
|
||||||
<ClCompile Include="..\..\src\filenode.c" />
|
|
||||||
<ClCompile Include="..\..\src\fileutil.c" />
|
|
||||||
<ClCompile Include="..\..\src\main.c" />
|
|
||||||
<ClCompile Include="..\..\src\parameteroperation.c" />
|
|
||||||
<ClCompile Include="..\..\src\util.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\src\actionfilenode.h" />
|
|
||||||
<ClInclude Include="..\..\src\actionfilenodecopy.h" />
|
|
||||||
<ClInclude Include="..\..\src\actionfilenodesync.h" />
|
|
||||||
<ClInclude Include="..\..\src\crc.h" />
|
|
||||||
<ClInclude Include="..\..\src\filenode.h" />
|
|
||||||
<ClInclude Include="..\..\src\fileutil.h" />
|
|
||||||
<ClInclude Include="..\..\src\parameteroperation.h" />
|
|
||||||
<ClInclude Include="..\..\src\util.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\README.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Text Include="..\..\LICENSE.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Archivos de código fuente">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Archivos de encabezado">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Archivos de recursos">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\..\src\crc.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\filenode.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\fileutil.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\main.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\util.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\actionfilenode.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\actionfilenodecopy.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\actionfilenodesync.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\parameteroperation.c">
|
|
||||||
<Filter>Archivos de código fuente</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\src\crc.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\filenode.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\fileutil.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\util.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\actionfilenode.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\actionfilenodecopy.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\actionfilenodesync.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\parameteroperation.h">
|
|
||||||
<Filter>Archivos de encabezado</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\README.md" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Text Include="..\..\LICENSE.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#ifndef _ACTIONFILENODE_H_
|
#ifndef _ACTIONFILENODE_H_
|
||||||
#define _ACTIONFILENODE_H_
|
#define _ACTIONFILENODE_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#ifndef _ACTIONFILENODECOPY_H_
|
#ifndef _ACTIONFILENODECOPY_H_
|
||||||
#define _ACTIONFILENODECOPY_H_
|
#define _ACTIONFILENODECOPY_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#ifndef _ACTIONFILENODESYNC_H_
|
#ifndef _ACTIONFILENODESYNC_H_
|
||||||
#define _ACTIONFILENODESYNC_H_
|
#define _ACTIONFILENODESYNC_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#include <stdio.h>
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
unsigned long _crcTable[256];
|
unsigned long _crcTable[256];
|
||||||
int _crcTableInitialized = 0;
|
int _crcTableInitialized = 0;
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#ifndef _CRC_
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#ifndef _CRC_
|
||||||
#define _CRC_
|
#define _CRC_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#include <stdio.h>
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -87,8 +90,8 @@ void FileNode_Delete(FileNode fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FileNode_AddChild(FileNode fileNode, FileNode fileNodeChild) {
|
void FileNode_AddChild(FileNode fileNode, FileNode fileNodeChild) {
|
||||||
if (!fileNodeChild || !fileNode)
|
if (fileNodeChild == NULL || fileNode == NULL) { return; }
|
||||||
return;
|
|
||||||
fileNodeChild->next = fileNode->child;
|
fileNodeChild->next = fileNode->child;
|
||||||
fileNode->child = fileNodeChild;
|
fileNode->child = fileNodeChild;
|
||||||
fileNode->childCount++;
|
fileNode->childCount++;
|
||||||
@@ -106,6 +109,8 @@ FileNode FileNode_GetRoot(FileNode fileNode) {
|
|||||||
void FileNode_SetStatusRec(FileNode fileNode, FileStatus status) {
|
void FileNode_SetStatusRec(FileNode fileNode, FileStatus status) {
|
||||||
FileNode fileNodeChild;
|
FileNode fileNodeChild;
|
||||||
|
|
||||||
|
if (fileNode == NULL) { return; }
|
||||||
|
|
||||||
fileNode->status = status;
|
fileNode->status = status;
|
||||||
fileNodeChild = fileNode->child;
|
fileNodeChild = fileNode->child;
|
||||||
while (fileNodeChild) {
|
while (fileNodeChild) {
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#ifndef _FILENODE_H_
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#ifndef _FILENODE_H_
|
||||||
#define _FILENODE_H_
|
#define _FILENODE_H_
|
||||||
|
|
||||||
#include "fileutil.h"
|
#include "fileutil.h"
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define _WIN32_WINNT 0x0501
|
#define _WIN32_WINNT 0x0501
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#ifndef _FILEUTIL_
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#ifndef _FILEUTIL_
|
||||||
#define _FILEUTIL_
|
#define _FILEUTIL_
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
|||||||
37
src/main.c
37
src/main.c
@@ -1,4 +1,7 @@
|
|||||||
#include <stdio.h>
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -109,6 +112,8 @@ int Sync(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
PrintElapsedTime(tBuild);
|
PrintElapsedTime(tBuild);
|
||||||
Print("\n");
|
Print("\n");
|
||||||
|
|
||||||
|
int postCheckDir = 0;
|
||||||
|
long long tRun = Time_GetTime();
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
// Show action list
|
// Show action list
|
||||||
ActionFileNode_Print(actionFileNode);
|
ActionFileNode_Print(actionFileNode);
|
||||||
@@ -117,10 +122,18 @@ int Sync(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
// Run action list
|
// Run action list
|
||||||
if (ActionFileNode_RunList(actionFileNode, pathLeft, pathRight)) {
|
if (ActionFileNode_RunList(actionFileNode, pathLeft, pathRight)) {
|
||||||
PrintStatistics(actionFileNode, ActionFileNodeResult_Ok);
|
PrintStatistics(actionFileNode, ActionFileNodeResult_Ok);
|
||||||
CheckDir(pathLeft, reCheck);
|
postCheckDir = 1;
|
||||||
CheckDir(pathRight, reCheck);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tRun = Time_GetTime() - tRun;
|
||||||
|
Print("\ttRun:");
|
||||||
|
PrintElapsedTime(tRun);
|
||||||
|
Print("\n");
|
||||||
|
|
||||||
|
if (postCheckDir) {
|
||||||
|
CheckDir(pathLeft, reCheck);
|
||||||
|
CheckDir(pathRight, reCheck);
|
||||||
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -157,6 +170,8 @@ int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
PrintElapsedTime(tBuild);
|
PrintElapsedTime(tBuild);
|
||||||
Print("\n");
|
Print("\n");
|
||||||
|
|
||||||
|
int postCheckDir = 0;
|
||||||
|
long long tRun = Time_GetTime();
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
// Show action list
|
// Show action list
|
||||||
ActionFileNode_Print(actionFileNode);
|
ActionFileNode_Print(actionFileNode);
|
||||||
@@ -165,10 +180,18 @@ int Copy(char *pathLeft, char *pathRight, int reCheck, int dryRun) {
|
|||||||
// Run action list
|
// Run action list
|
||||||
if (ActionFileNode_RunList(actionFileNode, pathLeft, pathRight)) {
|
if (ActionFileNode_RunList(actionFileNode, pathLeft, pathRight)) {
|
||||||
PrintStatistics(actionFileNode, ActionFileNodeResult_Ok);
|
PrintStatistics(actionFileNode, ActionFileNodeResult_Ok);
|
||||||
CheckDir(pathLeft, reCheck);
|
postCheckDir = 1;
|
||||||
CheckDir(pathRight, reCheck);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tRun = Time_GetTime() - tRun;
|
||||||
|
Print("\ttRun:");
|
||||||
|
PrintElapsedTime(tRun);
|
||||||
|
Print("\n");
|
||||||
|
|
||||||
|
if (postCheckDir) {
|
||||||
|
CheckDir(pathLeft, reCheck);
|
||||||
|
CheckDir(pathRight, reCheck);
|
||||||
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -306,7 +329,7 @@ TParameterOperation _parameterOperations[] = {
|
|||||||
{"sync", 0, "Synchronize between two directories", SetParam_Sync},
|
{"sync", 0, "Synchronize between two directories", SetParam_Sync},
|
||||||
{"log", 1, "Log actions to file", SetParam_Log},
|
{"log", 1, "Log actions to file", SetParam_Log},
|
||||||
|
|
||||||
{"scan", 2, "Scan directory and save to filenode file", Func_Rescan},
|
{"scan", 2, "Scan directory and save to filenode file", Func_Scan},
|
||||||
{"rescan", 2, "Rescan directory and save to filenode file", Func_Rescan},
|
{"rescan", 2, "Rescan directory and save to filenode file", Func_Rescan},
|
||||||
{"read", 1, "Read filenode file", Func_Read},
|
{"read", 1, "Read filenode file", Func_Read},
|
||||||
{"check", 1, "Check changes on a directory", Func_Check},
|
{"check", 1, "Check changes on a directory", Func_Check},
|
||||||
@@ -317,6 +340,8 @@ TParameterOperation _parameterOperations[] = {
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
TApplicationConfiguration config = defaultConfig;
|
TApplicationConfiguration config = defaultConfig;
|
||||||
|
|
||||||
|
Exceptions_Init();
|
||||||
|
|
||||||
int parameterParsingResult =
|
int parameterParsingResult =
|
||||||
ParameterOperation_Parse(argc, argv, _parameterOperations, &config);
|
ParameterOperation_Parse(argc, argv, _parameterOperations, &config);
|
||||||
if (parameterParsingResult <= 0) {
|
if (parameterParsingResult <= 0) {
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#include "parameteroperation.h"
|
#include "parameteroperation.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
#ifndef _PARAMETEROPERATION_
|
#ifndef _PARAMETEROPERATION_
|
||||||
#define _PARAMETEROPERATION_
|
#define _PARAMETEROPERATION_
|
||||||
|
|
||||||
|
|||||||
144
src/util.c
144
src/util.c
@@ -1,10 +1,14 @@
|
|||||||
#include <ctype.h>
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@@ -78,6 +82,7 @@ void Time_Pause(int pausa) {
|
|||||||
} while (tend >= t);
|
} while (tend >= t);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#include <sys/time.h>
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Time_GetTime
|
// Time_GetTime
|
||||||
//
|
//
|
||||||
@@ -211,3 +216,140 @@ char *GetError() {
|
|||||||
strcpy(_errorMessage, "");
|
strcpy(_errorMessage, "");
|
||||||
return _errorMessageTemp;
|
return _errorMessageTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Exceptions_Init
|
||||||
|
//
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
LONG WINAPI Win32UnhandledExceptionFilter(
|
||||||
|
struct _EXCEPTION_POINTERS *lpTopLevelExceptionFilter) {
|
||||||
|
char cadena[255];
|
||||||
|
|
||||||
|
sprintf(
|
||||||
|
cadena, "!!! Crash: Unrecoverable exception at 0x%p",
|
||||||
|
(void *)lpTopLevelExceptionFilter->ExceptionRecord->ExceptionAddress);
|
||||||
|
printf(cadena);
|
||||||
|
printf("\n");
|
||||||
|
FatalAppExit(0, cadena);
|
||||||
|
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Exceptions_Init() {
|
||||||
|
SetUnhandledExceptionFilter(Win32UnhandledExceptionFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifdef EMSCRIPTEN
|
||||||
|
|
||||||
|
void Exceptions_Init() {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void Exception_Signal(int senhal, siginfo_t *info, void *ptr) {
|
||||||
|
int kill_self = 0;
|
||||||
|
|
||||||
|
printf("!!! Crash: ");
|
||||||
|
switch (senhal) {
|
||||||
|
case SIGHUP:
|
||||||
|
printf("SIGUP");
|
||||||
|
break;
|
||||||
|
case SIGINT:
|
||||||
|
printf("SIGINT");
|
||||||
|
break;
|
||||||
|
case SIGQUIT:
|
||||||
|
printf("SIGQUIT");
|
||||||
|
break;
|
||||||
|
case SIGILL:
|
||||||
|
printf("SIGILL");
|
||||||
|
break;
|
||||||
|
case SIGTRAP:
|
||||||
|
printf("SIGTRAP");
|
||||||
|
break;
|
||||||
|
case SIGFPE:
|
||||||
|
printf("SIGFPE ");
|
||||||
|
if (info->si_code == FPE_INTDIV) {
|
||||||
|
printf("entero div zero");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_INTOVF) {
|
||||||
|
printf("entero desbordado");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTDIV) {
|
||||||
|
printf("float div zero");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTOVF) {
|
||||||
|
printf("float desbordado");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTUND) {
|
||||||
|
printf("float desbordado por defecto");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTRES) {
|
||||||
|
printf("float inexacto");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTINV) {
|
||||||
|
printf("operacion float invalida");
|
||||||
|
}
|
||||||
|
if (info->si_code == FPE_FLTSUB) {
|
||||||
|
printf("subscript fuera de rango");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SIGSEGV:
|
||||||
|
printf("SIGSEGV");
|
||||||
|
kill_self = 1;
|
||||||
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
printf("SIGTERM");
|
||||||
|
break;
|
||||||
|
case SIGABRT:
|
||||||
|
printf("SIGABRT");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("%d", senhal);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
if (kill_self) {
|
||||||
|
pid_t parent_pid;
|
||||||
|
char cadena[256];
|
||||||
|
parent_pid = getpid();
|
||||||
|
sprintf(cadena, "kill -9 %d", parent_pid);
|
||||||
|
system(cadena);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Salir
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
#include <fenv.h>
|
||||||
|
int feenableexcept();
|
||||||
|
|
||||||
|
void Exceptions_Init() {
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
|
memset(&action, 0, sizeof(action));
|
||||||
|
action.sa_sigaction = Exception_Signal;
|
||||||
|
action.sa_flags = SA_SIGINFO;
|
||||||
|
|
||||||
|
sigaction(SIGHUP, &action, 0);
|
||||||
|
sigaction(SIGINT, &action, 0);
|
||||||
|
sigaction(SIGQUIT, &action, 0);
|
||||||
|
sigaction(SIGILL, &action, 0);
|
||||||
|
sigaction(SIGTRAP, &action, 0);
|
||||||
|
sigaction(SIGFPE, &action, 0);
|
||||||
|
sigaction(SIGSEGV, &action, 0);
|
||||||
|
sigaction(SIGTERM, &action, 0);
|
||||||
|
sigaction(SIGABRT, &action, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
10
src/util.h
10
src/util.h
@@ -1,4 +1,7 @@
|
|||||||
#ifndef _UTIL_
|
// SPDX-License-Identifier: MIT
|
||||||
|
// Copyright (c) 2014-2021 Valeriano Alfonso Rodriguez
|
||||||
|
|
||||||
|
#ifndef _UTIL_
|
||||||
#define _UTIL_
|
#define _UTIL_
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -70,4 +73,9 @@ int Print(char *fmt, ...);
|
|||||||
void SetError(char *msg);
|
void SetError(char *msg);
|
||||||
char *GetError();
|
char *GetError();
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Exceptions_Init
|
||||||
|
//
|
||||||
|
void Exceptions_Init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user