Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
694744fb
Commit
694744fb
authored
5 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Ported to Windows
Beautified the output a bit.
parent
05f819a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/trashman.c
+20
-10
20 additions, 10 deletions
src/sbbs3/trashman.c
src/sbbs3/trashman.vcxproj
+169
-0
169 additions, 0 deletions
src/sbbs3/trashman.vcxproj
with
189 additions
and
10 deletions
src/sbbs3/trashman.c
+
20
−
10
View file @
694744fb
...
...
@@ -22,6 +22,8 @@
#include
"trash.h"
#include
"findstr.h"
#include
"nopen.h"
#include
"git_branch.h"
#include
"git_hash.h"
bool
test
=
false
;
int
verbosity
=
0
;
...
...
@@ -36,7 +38,11 @@ int maint(const char* fname)
perror
(
fname
);
return
-
1
;
}
FILE
*
fp
=
fnopen
(
NULL
,
test
?
_PATH_DEVNULL
:
fname
,
O_WRONLY
|
O_TRUNC
);
FILE
*
fp
;
if
(
test
)
fp
=
fopen
(
_PATH_DEVNULL
,
"w"
);
else
fp
=
fnopen
(
NULL
,
fname
,
O_WRONLY
|
O_TRUNC
);
if
(
fp
==
NULL
)
{
perror
(
test
?
_PATH_DEVNULL
:
fname
);
return
-
2
;
...
...
@@ -52,19 +58,19 @@ int maint(const char* fname)
}
if
(
verbosity
>
1
)
{
char
details
[
256
];
printf
(
"%s %s
\n
"
,
item
,
trash_details
(
&
trash
,
details
,
sizeof
details
));
printf
(
"%s
: %s
%s
\n
"
,
fname
,
item
,
trash_details
(
&
trash
,
details
,
sizeof
details
));
}
if
(
trash
.
expires
&&
trash
.
expires
<
now
)
{
if
(
verbosity
>
0
)
printf
(
"%s expired %s"
,
item
,
ctime
(
&
trash
.
expires
));
printf
(
"%s
: %s
expired %s"
,
fname
,
item
,
ctime
(
&
trash
.
expires
));
++
removed
;
continue
;
}
if
(
max_age
)
{
int
age
=
now
-
trash
.
added
;
if
(
max_age
!=
0
&&
trash
.
added
!=
0
)
{
int
age
=
(
int
)(
now
-
trash
.
added
)
;
if
(
age
>
0
&&
(
age
/=
(
24
*
60
*
60
))
>
max_age
)
{
if
(
verbosity
>
0
)
printf
(
"%s is %d days old
"
,
item
,
age
);
printf
(
"%s
: %s
is %d days old
\n
"
,
fname
,
item
,
age
);
++
removed
;
continue
;
}
...
...
@@ -74,8 +80,8 @@ int maint(const char* fname)
fclose
(
fp
);
strListFree
(
&
list
);
if
(
removed
||
verbosity
>
0
)
printf
(
"%d items %sremoved
from %s
\n
"
,
removed
,
test
?
"would have been "
:
""
,
fname
);
printf
(
"
%s:
%d items %sremoved
\n
"
,
fname
,
removed
,
test
?
"would have been "
:
""
);
return
removed
;
}
...
...
@@ -93,7 +99,8 @@ int usage(const char* prog)
int
main
(
int
argc
,
const
char
**
argv
)
{
printf
(
"
\n
Synchronet trash/filter file manager v1.0
\n
"
);
printf
(
"
\n
Synchronet Trash Can (Filter File) Manager v1.0 %s/%s
\n
"
,
GIT_BRANCH
,
GIT_HASH
);
if
(
argc
<
2
)
return
usage
(
argv
[
0
]);
...
...
@@ -122,6 +129,7 @@ int main(int argc, const char** argv)
}
}
int
total
=
0
;
int
files
=
0
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
const
char
*
arg
=
argv
[
i
];
if
(
*
arg
==
'-'
)
...
...
@@ -130,7 +138,9 @@ int main(int argc, const char** argv)
if
(
removed
<
0
)
return
EXIT_FAILURE
;
total
+=
removed
;
++
files
;
}
printf
(
"%d total items %sremoved
\n
"
,
total
,
test
?
"would have been "
:
""
);
if
(
files
>
1
)
printf
(
"%d total items %sremoved from %d files
\n
"
,
total
,
test
?
"would have been "
:
""
,
files
);
return
EXIT_SUCCESS
;
}
This diff is collapsed.
Click to expand it.
src/sbbs3/trashman.vcxproj
0 → 100644
+
169
−
0
View file @
694744fb
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
ToolsVersion=
"12.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>
</ItemGroup>
<PropertyGroup
Label=
"Globals"
>
<ProjectGuid>
{2BE1C8F2-50CE-44B0-A341-92B24E2D3DB4}
</ProjectGuid>
<RootNamespace>
trashman
</RootNamespace>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseOfMfc>
false
</UseOfMfc>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v141_xp
</PlatformToolset>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
Application
</ConfigurationType>
<UseOfMfc>
false
</UseOfMfc>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v141_xp
</PlatformToolset>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.props"
/>
<ImportGroup
Label=
"ExtensionSettings"
>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props"
/>
<Import
Project=
"..\build\target_ia32.props"
/>
<Import
Project=
"..\smblib\smblib.props"
/>
<Import
Project=
"..\xpdev\xpdev.props"
/>
<Import
Project=
"..\hash\hash.props"
/>
<Import
Project=
"..\build\undeprecate.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props"
/>
<Import
Project=
"..\build\target_ia32.props"
/>
<Import
Project=
"..\smblib\smblib.props"
/>
<Import
Project=
"..\xpdev\xpdev.props"
/>
<Import
Project=
"..\hash\hash.props"
/>
<Import
Project=
"..\build\undeprecate.props"
/>
</ImportGroup>
<PropertyGroup
Label=
"UserMacros"
/>
<PropertyGroup>
<_ProjectFileVersion>
10.0.30319.1
</_ProjectFileVersion>
<OutDir
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
.\msvc.win32.exe.release\
</OutDir>
<IntDir
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
.\msvc.win32.release\trashman\
</IntDir>
<LinkIncremental
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
false
</LinkIncremental>
<OutDir
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
.\msvc.win32.exe.debug\
</OutDir>
<IntDir
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
.\msvc.win32.debug\trashman\
</IntDir>
<LinkIncremental
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<Midl>
<TypeLibraryName>
.\msvc.win32.exe.release/trashman.tlb
</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>
MaxSpeed
</Optimization>
<InlineFunctionExpansion>
OnlyExplicitInline
</InlineFunctionExpansion>
<AdditionalIncludeDirectories>
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
NDEBUG;WRAPPER_EXPORTS;WIN32;_CONSOLE;SBBS_EXPORTS;NO_SOCKET_SUPPORT;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<StringPooling>
true
</StringPooling>
<RuntimeLibrary>
MultiThreadedDLL
</RuntimeLibrary>
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<PrecompiledHeaderOutputFile>
.\msvc.win32.release\trashman/trashman.pch
</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>
.\msvc.win32.release\trashman/
</AssemblerListingLocation>
<ObjectFileName>
.\msvc.win32.release\trashman/
</ObjectFileName>
<ProgramDataBaseFileName>
.\msvc.win32.release\trashman/
</ProgramDataBaseFileName>
<WarningLevel>
Level3
</WarningLevel>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>
NDEBUG;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<Culture>
0x0409
</Culture>
</ResourceCompile>
<Link>
<OutputFile>
.\msvc.win32.exe.release/trashman.exe
</OutputFile>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
<ProgramDatabaseFile>
.\msvc.win32.exe.release/trashman.pdb
</ProgramDatabaseFile>
<GenerateMapFile>
true
</GenerateMapFile>
<MapFileName>
.\msvc.win32.release\trashman/trashman.map
</MapFileName>
<SubSystem>
Console
</SubSystem>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX86
</TargetMachine>
<IgnoreSpecificDefaultLibraries>
libcd.lib;%(IgnoreSpecificDefaultLibraries)
</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>
false
</ImageHasSafeExceptionHandlers>
<AdditionalDependencies>
netapi32.lib;wsock32.lib;setargv.obj;%(AdditionalDependencies)
</AdditionalDependencies>
</Link>
<Bscmake>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
<OutputFile>
.\msvc.win32.exe.release/trashman.bsc
</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<Midl>
<TypeLibraryName>
.\msvc.win32.exe.debug/trashman.tlb
</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>
Disabled
</Optimization>
<AdditionalIncludeDirectories>
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>
_DEBUG;WRAPPER_EXPORTS;WIN32;_CONSOLE;SBBS_EXPORTS;NO_SOCKET_SUPPORT;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<BasicRuntimeChecks>
EnableFastChecks
</BasicRuntimeChecks>
<RuntimeLibrary>
MultiThreadedDebug
</RuntimeLibrary>
<PrecompiledHeaderOutputFile>
.\msvc.win32.debug\trashman/trashman.pch
</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>
.\msvc.win32.debug\trashman/
</AssemblerListingLocation>
<ObjectFileName>
.\msvc.win32.debug\trashman/
</ObjectFileName>
<ProgramDataBaseFileName>
.\msvc.win32.debug\trashman/
</ProgramDataBaseFileName>
<BrowseInformation>
true
</BrowseInformation>
<WarningLevel>
Level3
</WarningLevel>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
<DebugInformationFormat>
ProgramDatabase
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>
_DEBUG;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<Culture>
0x0409
</Culture>
</ResourceCompile>
<Link>
<OutputFile>
.\msvc.win32.exe.debug/trashman.exe
</OutputFile>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<ProgramDatabaseFile>
.\msvc.win32.exe.debug/trashman.pdb
</ProgramDatabaseFile>
<SubSystem>
Console
</SubSystem>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX86
</TargetMachine>
<IgnoreSpecificDefaultLibraries>
libcd.lib;%(IgnoreSpecificDefaultLibraries)
</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>
false
</ImageHasSafeExceptionHandlers>
<AdditionalDependencies>
netapi32.lib;wsock32.lib;setargv.obj;%(AdditionalDependencies)
</AdditionalDependencies>
</Link>
<Bscmake>
<SuppressStartupBanner>
true
</SuppressStartupBanner>
<OutputFile>
.\msvc.win32.exe.debug/trashman.bsc
</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"findstr.c"
/>
<ClCompile
Include=
"nopen.c"
/>
<ClCompile
Include=
"trash.c"
/>
<ClCompile
Include=
"trashman.c"
>
<AdditionalIncludeDirectories
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\xpdev\xpdev.vcxproj"
>
<Project>
{7428a1e8-56b7-4868-9c0e-29d031689feb}
</Project>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment