Added mbfile toberep function

This commit is contained in:
Michiel Broek
2001-11-25 16:38:06 +00:00
parent 58c598fc84
commit add976e618
10 changed files with 140 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c pack.c \
mbmsg.c newspost.c postemail.c scan.c toberep.c atoul.c filemgr.c \
hash.c mbaff.c mbseq.c notify.c postnetmail.c scannews.c tosspkt.c \
mbfkill.c mbfutil.c mbfindex.c mbfcheck.c mbfpack.c mbflist.c mbfadopt.c \
mbfimport.c virscan.c
mbfimport.c virscan.c mbftoberep.c
HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h pack.h \
postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \
lhash.h mbfido.h mkftnhdr.h paths.h ptic.h sendmail.h tracker.h \
@@ -23,7 +23,7 @@ HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h pack.h \
grlist.h maketags.h mbmsg.h newspost.h postecho.h rollover.h tic.h \
atoul.h filemgr.h hash.h mbaff.h mbseq.h notify.h postemail.h scan.h toberep.h \
mbfkill.h mbfutil.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfadopt.h \
mbfimport.h virscan.h
mbfimport.h virscan.h mbftoberep.h
MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o \
tracker.o makestat.o scannews.o lhash.o \
pack.o ulock.o tic.o ptic.o utic.o mover.o hash.o mkftnhdr.o \
@@ -36,7 +36,7 @@ MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o
MBINDEX_OBJS = mbindex.o
MBDIFF_OBJS = mbdiff.o
MBFILE_OBJS = mbfile.o mbfkill.o mbfutil.o mbfindex.o mbfcheck.o mbfpack.o mbflist.o mbfadopt.o \
mbfimport.o virscan.o
mbfimport.o virscan.o mbftoberep.o
MBMSG_OBJS = post.o mbmsg.o
MBFIDO_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
../lib/libdbase.a ../lib/libmbinet.a
@@ -154,7 +154,7 @@ aliasdb.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../li
cookie.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h cookie.h
fsort.o: ../lib/libs.h ../lib/clcomm.h fsort.h
magic.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbtic.h tic.h utic.h magic.h
mbfile.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbfutil.h mbfile.h
mbfile.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfutil.h mbfile.h
mover.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h
post.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h post.h
rnews.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h pack.h rfc2ftn.h mbfido.h paths.h rnews.h
@@ -196,4 +196,5 @@ mbflist.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../li
mbfadopt.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h virscan.h mbfutil.h mbflist.h
mbfimport.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h virscan.h mbfutil.h mbfimport.h
virscan.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h virscan.h
mbftoberep.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbftoberep.h
# End of generated dependencies

View File

@@ -447,6 +447,9 @@ int Announce()
}
}
FinishMsg(TRUE);
} else {
if (!do_quiet)
printf(" No matching groups\n");
}
fseek(fp, filepos, SEEK_SET);

View File

@@ -41,7 +41,7 @@
extern int do_quiet; /* Supress screen output */
extern int do_annon; /* Supress announce file */
void AdoptFile(int Area, char *File, char *Description)
@@ -160,6 +160,8 @@ void AdoptFile(int Area, char *File, char *Description)
memset(&fdb, 0, sizeof(fdb));
strcpy(fdb.Uploader, CFG.sysop_name);
fdb.UploadDate = time(NULL);
if (do_annon)
fdb.Announced = TRUE;
if (UnPacked) {
/*

View File

@@ -41,12 +41,14 @@
#include "mbfpack.h"
#include "mbflist.h"
#include "mbfimport.h"
#include "mbftoberep.h"
#include "mbfutil.h"
#include "mbfile.h"
extern int do_quiet; /* Supress screen output */
int do_annon = FALSE; /* Suppress announce on new files */
int do_adopt = FALSE; /* Adopt a file */
int do_pack = FALSE; /* Pack filebase */
int do_check = FALSE; /* Check filebase */
@@ -54,6 +56,7 @@ int do_kill = FALSE; /* Kill/move old files */
int do_index = FALSE; /* Create request index */
int do_import= FALSE; /* Import files in area */
int do_list = FALSE; /* List fileareas */
int do_tobe = FALSE; /* List toberep database */
extern int e_pid; /* Pid of external process */
extern int show_log; /* Show logging */
time_t t_start; /* Start time */
@@ -94,9 +97,9 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++) {
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, tl(argv[i]));
cmd = xstrcat(cmd, argv[i]);
if (!strncmp(argv[i], "a", 1)) {
if (!strncasecmp(argv[i], "a", 1)) {
do_adopt = TRUE;
i++;
Area = atoi(argv[i]);
@@ -108,14 +111,26 @@ int main(int argc, char **argv)
cmd = xstrcat(cmd, argv[i]);
if (argc > (i + 1)) {
i++;
Description = xstrcpy(argv[i]);
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, argv[i]);
if (!strncasecmp(argv[i], "-a", 2)) {
do_annon = TRUE;
} else {
Description = xstrcpy(argv[i]);
if (argc > (i + 1)) {
i++;
cmd = xstrcat(cmd, (char *)" ");
cmd = xstrcat(cmd, argv[i]);
if (!strncasecmp(argv[i], "-a", 2)) {
do_annon = TRUE;
}
}
}
}
}
if (!strncmp(argv[i], "in", 2))
if (!strncasecmp(argv[i], "in", 2))
do_index = TRUE;
if (!strncmp(argv[i], "im", 2)) {
if (!strncasecmp(argv[i], "im", 2)) {
if (argc > (i + 1)) {
do_import = TRUE;
i++;
@@ -124,7 +139,7 @@ int main(int argc, char **argv)
cmd = xstrcat(cmd, argv[i]);
}
}
if (!strncmp(argv[i], "l", 1)) {
if (!strncasecmp(argv[i], "l", 1)) {
do_list = TRUE;
if (argc > (i + 1)) {
i++;
@@ -133,17 +148,19 @@ int main(int argc, char **argv)
cmd = xstrcat(cmd, argv[i]);
}
}
if (!strncmp(argv[i], "p", 1))
if (!strncasecmp(argv[i], "p", 1))
do_pack = TRUE;
if (!strncmp(argv[i], "c", 1))
if (!strncasecmp(argv[i], "c", 1))
do_check = TRUE;
if (!strncmp(argv[i], "k", 1))
if (!strncasecmp(argv[i], "k", 1))
do_kill = TRUE;
if (!strncmp(argv[i], "-q", 2))
if (!strncasecmp(argv[i], "t", 1))
do_tobe = TRUE;
if (!strncasecmp(argv[i], "-q", 2))
do_quiet = TRUE;
}
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt))
if (!(do_pack || do_check || do_kill || do_index || do_import || do_list || do_adopt || do_tobe))
Help();
ProgName();
@@ -182,6 +199,8 @@ int main(int argc, char **argv)
if (do_list)
ListFileAreas(Area);
if (do_tobe)
ToBeRep();
die(0);
return 0;
}

View File

@@ -41,6 +41,7 @@
extern int do_quiet; /* Supress screen output */
extern int do_annon; /* Supress announce files */
void ImportFiles(int Area)
@@ -188,6 +189,8 @@ void ImportFiles(int Area)
token = strtok(String, " \t");
strcpy(fdb.Name, token);
strcpy(fdb.LName, tl(token));
if (do_annon)
fdb.Announced = TRUE;
Syslog('f', "File: %s (%s)", fdb.Name, fdb.LName);
if (!do_quiet) {

83
mbfido/mbftoberep.c Normal file
View File

@@ -0,0 +1,83 @@
/*****************************************************************************
*
* $Id$
* Purpose: File Database Maintenance - Show toberep database
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS 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, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "../lib/dbcfg.h"
#include "mbfutil.h"
#include "mbftoberep.h"
extern int do_quiet; /* Supress screen output */
/*
* Show the toberep database
*/
void ToBeRep(void)
{
char *temp;
FILE *fp;
struct _filerecord rep;
if (do_quiet)
return;
IsDoing("Toberep");
colour(CYAN, BLACK);
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) {
printf("No toberep database present\n");
} else {
// 12345678901234567890123456789012345678901234567890123456789012345678901234567890
printf(" File echo Group File name Kbyte Date Announce\n");
printf("-------------------- ------------ ------------ ----- ---------- --------\n");
colour(LIGHTGRAY, BLACK);
while (fread(&rep, sizeof(rep), 1, fp) == 1) {
printf("%-20s %-12s %-12s %5ld %s %s\n",
rep.Echo, rep.Group, rep.Name, rep.SizeKb, StrDateDMY(rep.Fdate), rep.Announce ? "Yes":"No ");
}
fclose(fp);
}
free(temp);
}

8
mbfido/mbftoberep.h Normal file
View File

@@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _MBFTOBEREP_H
#define _MBFTOBEREP_H
void ToBeRep(void); /* Show toberep database */
#endif

View File

@@ -123,9 +123,11 @@ void Help(void)
// printf(" m move <from> <to> <file> Move file from to area\n");
printf(" p pack Pack filebase\n");
// printf(" r rearc <area> [file] [arc] Rearc file(s) in area\n");
printf(" t toberep Show toberep database\n");
colour(LIGHTBLUE, BLACK);
printf("\n Options are:\n\n");
colour(CYAN, BLACK);
printf(" -a -announce Supress announce added files\n");
printf(" -q -quiet Quiet mode\n");
colour(LIGHTGRAY, BLACK);
printf("\n");