Commits (1)
/* $Id: dstsedit.c,v 1.9 2020/08/17 00:48:28 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include "str_util.h"
#include "dirwrap.h"
#include "nopen.h"
#include "scfgdefs.h"
#include "conwrap.h"
#include "date_str.h"
int
main(int argc, char **argv)
{
char ch, str[MAX_PATH+1], path[MAX_PATH + 1]
,*lst = "%c) %-25s: %13lu\n"
,*nv = "\nNew value: ";
int file;
stats_t stats;
time32_t t;
scfg_t cfg;
memset(&cfg, 0, sizeof(cfg));
if (argc > 1) {
SAFECOPY(path, argv[1]);
} else {
SAFECOPY(path, get_ctrl_dir(/* warn: */TRUE));
}
backslash(path);
SAFEPRINTF(str, "%sdsts.dab", path);
if ((file = nopen(str, O_RDONLY)) == -1) {
printf("Can't open %s\r\n", str);
exit(1);
}
read(file, &t, 4L);
if (read(file, &stats, sizeof(stats_t)) != sizeof(stats_t)) {
close(file);
printf("Error reading %" XP_PRIsize_t "u bytes from %s\r\n", sizeof(stats_t), str);
exit(1);
}
close(file);
while (1) {
printf("Synchronet Daily Statistics Editor v1.02\r\n\r\n");
printf("S) %-25s: %13s\n", "Date Stamp (MM/DD/YY)", unixtodstr(&cfg, t, str));
printf(lst, 'L', "Total Logons", stats.logons);
printf(lst, 'O', "Logons Today", stats.ltoday);
printf(lst, 'T', "Total Time on", stats.timeon);
printf(lst, 'I', "Time on Today", stats.ttoday);
printf(lst, 'U', "Uploaded Files Today", stats.uls);
printf(lst, 'B', "Uploaded Bytes Today", stats.ulb);
printf(lst, 'D', "Downloaded Files Today", stats.dls);
printf(lst, 'W', "Downloaded Bytes Today", stats.dlb);
printf(lst, 'P', "Posts Today", stats.ptoday);
printf(lst, 'E', "E-Mails Today", stats.etoday);
printf(lst, 'F', "Feedback Today", stats.ftoday);
printf("%c) %-25s: %13u\r\n", 'N', "New Users Today", stats.nusers);
printf("Q) Quit and save changes\r\n");
printf("X) Quit and don't save changes\r\n");
printf("\r\nWhich: ");
ch = toupper(getch());
printf("%c\r\n", ch);
switch (ch) {
case 'S':
printf("Date stamp (MM/DD/YY): ");
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
t = dstrtounix(&cfg, str);
break;
case 'L':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.logons = atol(str);
break;
case 'O':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.ltoday = atol(str);
break;
case 'T':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.timeon = atol(str);
break;
case 'I':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.ttoday = atol(str);
break;
case 'U':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.uls = atol(str);
break;
case 'B':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.ulb = atol(str);
break;
case 'D':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.dls = atol(str);
break;
case 'W':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.dlb = atol(str);
break;
case 'P':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.ptoday = atol(str);
break;
case 'E':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.etoday = atol(str);
break;
case 'F':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.ftoday = atol(str);
break;
case 'N':
fputs(nv,stdout);
fgets(str, sizeof(str), stdin);
if (isdigit(str[0]))
stats.nusers = atoi(str);
break;
case 'Q':
SAFEPRINTF(str, "%sdsts.dab", path);
if ((file = nopen(str, O_WRONLY)) == -1) {
printf("Error opening %s\r\n", str);
exit(1);
}
write(file, &t, 4L);
write(file, &stats, sizeof(stats_t));
close(file);
// fall-through
case 'X':
exit(0);
default:
putchar(7);
break;
}
}
}
<?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>{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}</ProjectGuid>
</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="..\xpdev\xpdev.props" />
<Import Project="..\smblib\smblib.props" />
<Import Project="..\build\undeprecate.props" />
<Import Project="..\build\target_ia32.props" />
<Import Project="..\hash\hash.props" />
<Import Project="..\encode\encode.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="..\xpdev\xpdev.props" />
<Import Project="..\smblib\smblib.props" />
<Import Project="..\build\undeprecate.props" />
<Import Project="..\build\target_ia32.props" />
<Import Project="..\hash\hash.props" />
<Import Project="..\encode\encode.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\dstsedit\</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\dstsedit\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Midl>
<TypeLibraryName>.\msvc.win32.exe.release/dstsedit.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_CONSOLE;NO_SOCKET_SUPPORT;SBBS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeaderOutputFile>.\msvc.win32.release\dstsedit/dstsedit.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\msvc.win32.release\dstsedit/</AssemblerListingLocation>
<ObjectFileName>.\msvc.win32.release\dstsedit/</ObjectFileName>
<ProgramDataBaseFileName>.\msvc.win32.release\dstsedit/</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Culture>0x0409</Culture>
</ResourceCompile>
<Link>
<OutputFile>.\msvc.win32.exe.release/dstsedit.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ProgramDatabaseFile>.\msvc.win32.exe.release/dstsedit.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\msvc.win32.exe.release/dstsedit.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
<TypeLibraryName>.\msvc.win32.exe.debug/dstsedit.tlb</TypeLibraryName>
<HeaderFileName>
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;WIN32;_CONSOLE;NO_SOCKET_SUPPORT;SBBS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeaderOutputFile>.\msvc.win32.debug\dstsedit/dstsedit.pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>.\msvc.win32.debug\dstsedit/</AssemblerListingLocation>
<ObjectFileName>.\msvc.win32.debug\dstsedit/</ObjectFileName>
<ProgramDataBaseFileName>.\msvc.win32.debug\dstsedit/</ProgramDataBaseFileName>
<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/dstsedit.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\msvc.win32.exe.debug/dstsedit.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\msvc.win32.exe.debug/dstsedit.bsc</OutputFile>
</Bscmake>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\encode\utf8.c" />
<ClCompile Include="date_str.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>
<ClCompile Include="dstsedit.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>
<ClCompile Include="nopen.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>
<ClCompile Include="str_util.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\xpdev\xpdev.vcxproj">
<Project>{7428a1e8-56b7-4868-9c0e-29d031689feb}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
......@@ -285,12 +285,6 @@ DUPEFIND_OBJS = $(LOAD_CFG_OBJS) \
SMBACTIV_OBJS = $(LOAD_CFG_OBJS) \
$(OBJODIR)/smbactiv$(OFILE)
DSTSEDIT_OBJS = \
$(OBJODIR)/dstsedit$(OFILE)\
$(OBJODIR)/date_str$(OFILE) \
$(OBJODIR)/str_util$(OFILE) \
$(OBJODIR)/nopen$(OFILE)
READSAUCE_OBJS = \
$(OBJODIR)/readsauce$(OFILE)
......
......@@ -19,8 +19,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "conio", "..\conio\conio.vcx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "delfiles", "delfiles.vcxproj", "{0A90BF07-F107-49FB-B0D3-E7E12528F3BA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dstsedit", "dstsedit.vcxproj", "{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dupefind", "dupefind.vcxproj", "{D80E94E4-09D7-4A2A-B850-67C5ABB5ABDA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "echocfg", "echocfg.vcxproj", "{91A5D0BE-90BC-4795-8833-CE5C4D484B4A}"
......@@ -126,10 +124,6 @@ Global
{0A90BF07-F107-49FB-B0D3-E7E12528F3BA}.Debug|Win32.Build.0 = Debug|Win32
{0A90BF07-F107-49FB-B0D3-E7E12528F3BA}.Release|Win32.ActiveCfg = Release|Win32
{0A90BF07-F107-49FB-B0D3-E7E12528F3BA}.Release|Win32.Build.0 = Release|Win32
{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}.Debug|Win32.ActiveCfg = Debug|Win32
{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}.Debug|Win32.Build.0 = Debug|Win32
{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}.Release|Win32.ActiveCfg = Release|Win32
{A7059A57-CDFF-4917-AA98-AE1DA8DF617D}.Release|Win32.Build.0 = Release|Win32
{D80E94E4-09D7-4A2A-B850-67C5ABB5ABDA}.Debug|Win32.ActiveCfg = Debug|Win32
{D80E94E4-09D7-4A2A-B850-67C5ABB5ABDA}.Debug|Win32.Build.0 = Debug|Win32
{D80E94E4-09D7-4A2A-B850-67C5ABB5ABDA}.Release|Win32.ActiveCfg = Release|Win32
......
......@@ -33,7 +33,6 @@ ALLUSERS = $(EXEODIR)/allusers$(EXEFILE)
DELFILES = $(EXEODIR)/delfiles$(EXEFILE)
DUPEFIND = $(EXEODIR)/dupefind$(EXEFILE)
SMBACTIV = $(EXEODIR)/smbactiv$(EXEFILE)
DSTSEDIT = $(EXEODIR)/dstsedit$(EXEFILE)
READSAUCE = $(EXEODIR)/readsauce$(EXEFILE)
SHOWSTAT = $(EXEODIR)/showstat$(EXEFILE)
PKTDUMP = $(EXEODIR)/pktdump$(EXEFILE)
......