From 752f85de56dd2215de65626140a4de89bb215375 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 2 Dec 2001 19:17:14 +0000 Subject: [PATCH] Added files for mbfile move command --- mbfido/Makefile | 9 ++++---- mbfido/mbfile.c | 52 +++++++++++++++++++++++++++++++++++++++-------- mbfido/mbfmove.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ mbfido/mbfmove.h | 8 ++++++++ mbfido/mbfutil.c | 2 +- 5 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 mbfido/mbfmove.c create mode 100644 mbfido/mbfmove.h diff --git a/mbfido/Makefile b/mbfido/Makefile index e7b0bc27..e8f49fea 100644 --- a/mbfido/Makefile +++ b/mbfido/Makefile @@ -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 mbftoberep.c + mbfimport.c virscan.c mbftoberep.c mbfmove.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 mbftoberep.h + mbfimport.h virscan.h mbftoberep.h mbfmove.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 mbftoberep.o + mbfimport.o virscan.o mbftoberep.o mbfmove.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 mbftoberep.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 mbfmove.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 @@ -197,4 +197,5 @@ mbfadopt.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../l 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 +mbfmove.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfmove.h # End of generated dependencies diff --git a/mbfido/mbfile.c b/mbfido/mbfile.c index 8b242b82..980d33bc 100644 --- a/mbfido/mbfile.c +++ b/mbfido/mbfile.c @@ -42,6 +42,7 @@ #include "mbflist.h" #include "mbfimport.h" #include "mbftoberep.h" +#include "mbfmove.h" #include "mbfutil.h" #include "mbfile.h" @@ -57,6 +58,7 @@ 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 */ +int do_move = FALSE; /* Move a file */ extern int e_pid; /* Pid of external process */ extern int show_log; /* Show logging */ time_t t_start; /* Start time */ @@ -66,7 +68,7 @@ time_t t_end; /* End time */ int main(int argc, char **argv) { - int i, Area = 0; + int i, Area = 0, ToArea = 0; char *cmd, *FileName = NULL, *Description = NULL; struct passwd *pw; @@ -148,6 +150,27 @@ int main(int argc, char **argv) cmd = xstrcat(cmd, argv[i]); } } + if (!strncasecmp(argv[i], "m", 1)) { + if (argc > (i + 1)) { + i++; + Area = atoi(argv[i]); + cmd = xstrcat(cmd, (char *)" "); + cmd = xstrcat(cmd, argv[i]); + if (argc > (i + 1)) { + i++; + ToArea = atoi(argv[i]); + cmd = xstrcat(cmd, (char *)" "); + cmd = xstrcat(cmd, argv[i]); + if (argc > (i + 1)) { + i++; + FileName = xstrcpy(argv[i]); + cmd = xstrcat(cmd, (char *)" "); + cmd = xstrcat(cmd, argv[i]); + do_move = TRUE; + } + } + } + } if (!strncasecmp(argv[i], "p", 1)) do_pack = TRUE; if (!strncasecmp(argv[i], "c", 1)) @@ -173,16 +196,20 @@ int main(int argc, char **argv) free(cmd); if (!do_quiet) - printf("\n"); + printf("\n"); if (!diskfree(CFG.freespace)) - die(101); + die(101); - if (do_adopt) - AdoptFile(Area, FileName, Description); + if (do_adopt) { + AdoptFile(Area, FileName, Description); + die(0); + } - if (do_import) - ImportFiles(Area); + if (do_import) { + ImportFiles(Area); + die(0); + } if (do_kill) Kill(); @@ -196,8 +223,15 @@ int main(int argc, char **argv) if (do_index) Index(); - if (do_list) - ListFileAreas(Area); + if (do_move) { + Move(Area, ToArea, FileName); + die(0); + } + + if (do_list) { + ListFileAreas(Area); + die(0); + } if (do_tobe) ToBeRep(); diff --git a/mbfido/mbfmove.c b/mbfido/mbfmove.c new file mode 100644 index 00000000..dee58e2a --- /dev/null +++ b/mbfido/mbfmove.c @@ -0,0 +1,53 @@ +/***************************************************************************** + * + * $Id$ + * Purpose: File Database Maintenance - Move a file + * + ***************************************************************************** + * 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 "mbfmove.h" + + + +extern int do_quiet; /* Supress screen output */ + + + +/* + * Move a file + */ +void Move(int From, int To, char *File) +{ +} + + diff --git a/mbfido/mbfmove.h b/mbfido/mbfmove.h new file mode 100644 index 00000000..084c33bc --- /dev/null +++ b/mbfido/mbfmove.h @@ -0,0 +1,8 @@ +/* $Id$ */ + +#ifndef _MBFMOVE_H +#define _MBFMOVE_H + +void Move(int, int, char *); + +#endif diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index 6bd429ff..66767ee2 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -120,7 +120,7 @@ void Help(void) printf(" in index Create filerequest index\n"); printf(" k kill Kill/move old files\n"); printf(" l list [area] List file areas or one area\n"); -// printf(" m move Move file from to area\n"); + printf(" m move Move file from to area\n"); printf(" p pack Pack filebase\n"); // printf(" r rearc [file] [arc] Rearc file(s) in area\n"); printf(" t toberep Show toberep database\n");