Skip to content
Snippets Groups Projects
Commit 2d7ced5a authored by deuce's avatar deuce
Browse files

Add dstsedit utility from sbbs2 direction (via indent(1)).

parent 871498fa
No related branches found
No related tags found
No related merge requests found
......@@ -295,3 +295,8 @@ $(DUPEFIND): $(DUPEFIND_OBJS)
$(SMBACTIV): $(SMBACTIV_OBJS)
@echo Linking $@
$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(SMBACTIV_OBJS) $(SMBLIB_LIBS) $(XPDEV_LIBS)
# DSTSEDIT
$(DSTSEDIT): $(DSTSEDIT_OBJS)
@echo Linking $@
$(QUIET)$(CC) $(UTIL_LDFLAGS) -o $@ $(DSTSEDIT_OBJS) $(XPDEV_LIBS)
/* DSTSEDIT.C */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include "dirwrap.h"
#include "sbbs.h"
#include "nopen.h"
#include "sbbsdefs.h"
int
main(int argc, char **argv)
{
char ch, str[PATH_MAX+1], path[PATH_MAX + 1]
,*lst = "%c) %-25s: %13lu\n"
,*nv = "\nNew value: ", *p;
int file;
stats_t stats;
time32_t t;
scfg_t cfg;
cfg.sys_misc = 0;
if (argc > 1)
strcpy(path, argv[1]);
else {
p=getenv("SBBSCTRL");
if(p)
SAFECOPY(path, p);
else
getcwd(path, sizeof(path));
}
backslash(path);
sprintf(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 %u bytes from %s\r\n", sizeof(stats_t), str);
exit(1);
}
close(file);
while (1) {
printf("Synchronet Daily Statistics Editor v1.01\r\n\r\n");
printf("S) %-25s: %13s\n", "Date Stamp", 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): ");
gets(str);
if (str[0])
t = dstrtounix(&cfg, str);
break;
case 'L':
printf(nv);
gets(str);
if (str[0])
stats.logons = atol(str);
break;
case 'O':
printf(nv);
gets(str);
if (str[0])
stats.ltoday = atol(str);
break;
case 'T':
printf(nv);
gets(str);
if (str[0])
stats.timeon = atol(str);
break;
case 'I':
printf(nv);
gets(str);
if (str[0])
stats.ttoday = atol(str);
break;
case 'U':
printf(nv);
gets(str);
if (str[0])
stats.uls = atol(str);
break;
case 'B':
printf(nv);
gets(str);
if (str[0])
stats.ulb = atol(str);
break;
case 'D':
printf(nv);
gets(str);
if (str[0])
stats.dls = atol(str);
break;
case 'W':
printf(nv);
gets(str);
if (str[0])
stats.dlb = atol(str);
break;
case 'P':
printf(nv);
gets(str);
if (str[0])
stats.ptoday = atol(str);
break;
case 'E':
printf(nv);
gets(str);
if (str[0])
stats.etoday = atol(str);
break;
case 'F':
printf(nv);
gets(str);
if (str[0])
stats.ftoday = atol(str);
break;
case 'N':
printf(nv);
gets(str);
if (str[0])
stats.nusers = atoi(str);
break;
case 'Q':
sprintf(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);
case 'X':
exit(0);
default:
putchar(7);
break;
}
}
}
......@@ -287,3 +287,9 @@ SMBACTIV_OBJS = \
$(OBJODIR)$(DIRSEP)str_util$(OFILE) \
$(OBJODIR)$(DIRSEP)ars$(OFILE) \
$(OBJODIR)$(DIRSEP)nopen$(OFILE)
DSTSEDIT_OBJS = \
$(OBJODIR)$(DIRSEP)dstsedit$(OFILE)\
$(OBJODIR)$(DIRSEP)date_str$(OFILE) \
$(OBJODIR)$(DIRSEP)nopen$(OFILE)
......@@ -34,6 +34,7 @@ ALLUSERS = $(EXEODIR)$(DIRSEP)allusers$(EXEFILE)
DELFILES = $(EXEODIR)$(DIRSEP)delfiles$(EXEFILE)
DUPEFIND = $(EXEODIR)$(DIRSEP)dupefind$(EXEFILE)
SMBACTIV = $(EXEODIR)$(DIRSEP)smbactiv$(EXEFILE)
DSTSEDIT = $(EXEODIR)$(DIRSEP)dstsedit$(EXEFILE)
UTILS = $(FIXSMB) $(CHKSMB) \
$(SMBUTIL) $(BAJA) $(NODE) \
......@@ -42,7 +43,7 @@ UTILS = $(FIXSMB) $(CHKSMB) \
$(ANS2ASC) $(ASC2ANS) $(UNBAJA) \
$(QWKNODES) $(SLOG) $(ALLUSERS) \
$(DELFILES) $(DUPEFIND) $(SMBACTIV) \
$(SEXYZ)
$(SEXYZ) $(DSTSEDIT)
all: dlls utils console mono
......@@ -93,3 +94,4 @@ $(ALLUSERS): $(XPDEV_LIB)
$(DELFILES): $(XPDEV_LIB)
$(DUPEFIND): $(XPDEV_LIB) $(SMBLIB)
$(SMBACTIV): $(XPDEV_LIB) $(SMBLIB)
$(DSTSEDIT): $(XPDEV_LIB)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment