home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
VP2SRC.ZIP
/
MAIN.C
< prev
next >
Wrap
Text File
|
1991-04-24
|
11KB
|
435 lines
/*
$Header: main.c 3.31 87/12/31 14:53:42 Bob Exp $
The Conference Mail System
This module was originally written by Bob Hartman
Sysop of FidoNet node 1:132/101
Spark Software, 427-3 Amherst St, CS 2032, Suite 232, Nashua, NH 03061
The Conference Mail System is a complete Echomail processing package. It
is a superset of the original Echomail utilities created by Jeff Rush, and
also contains ideas gleaned from the ARCmail, Renum, oMMM, MGM, and Opus
programs that were created by various software authors.
This program source code is being released with the following provisions:
1. You are free to make changes to this source code for use on your own
machine, however, altered source files may not be distributed without the
consent of Spark Software.
2. You may distribute "patches" or "diff" files for any changes that you
have made, provided that the "patch" or "diff" files are also sent to Spark
Software for inclusion in future releases of the entire package. A "diff"
file for the source archives may also contain a compiled version, provided
it is clearly marked as not being created from the original source code.
No other executable versions may be distributed without the consent of
Spark Software.
3. You are free to include portions of this source code in any program you
develop, providing: a) Credit is given to Spark Software for any code that
may is used, and b) The resulting program is free to anyone wanting to use
it, including commercial and government users.
4. There is NO technical support available for dealing with this source
code, or the accompanying executable files. This source code is provided
as is, with no warranty expressed or implied (I hate legalease). In other
words, if you don't know what to do with it, don't use it, and if you are
brave enough to use it, you're on your own.
Spark Software may be contacted by modem at (603) 888-8179 (node 1:132/101)
on the public FidoNet network, or at the address given above.
To use this code you will need Microsoft C version 4.0, and also Microsoft
Macro Assembler version 4.0.
*/
/*
$Log: main.c $
* Revision 4.09c 91/04/24 20:04:42 Bill
* Update to fix import 0/0 when packets in multiple areas
*
* Revision 4.09b 91/04/20 10:04:42 Bill
* Update to fix export bad seen-by Trap 000D
*
* Revision 4.09a 91/04/09 23:34:42 Bill
* Update to only zap sent archive names, get zone into atch msg
*
* Revision 4.09 91/01/09 23:34:42 Bill
* Update to insure scan only exact match area names in -File
*
* Revision 4.08 90/10/18 03:15:42 Bill
* Update to fix DOS 1.MSG tearline, convert to MSC 6.0
*
* Revision 4.07 90/09/05 22:18:42 Bill
* Update to fix some message header overlays
*
* Revision 4.06 90/08/05 23:10:42 Bill
* Update to fix some more bugs
*
* Revision 4.05 90/06/17 07:30:00 Bill
* Update to fix date bug
*
* Revision 4.04 90/06/08 23:34:42 Bill
* Update to fix some bugs
*
* Revision 3.31 87/12/31 14:53:42 Bob
* Update to fix some bugs
*
* Revision 3.3 87/12/12 00:43:30 Bob
* Source code release
*
*/
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <io.h>
#include <time.h>
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <process.h>
#include "fastecho.h"
#define DEBUG 0
/* Remember to change the message below */
char *REV="$Revision: 4.09c $";
extern SEACONFIG config;
extern AREAS_PTR areas[];
extern char board_name[], sysop_name[];
extern int tot_areas;
extern char bbsfile[];
extern char *arc_cmd[];
extern int nread;
extern int arc_args;
extern int last_msg;
extern int high_one;
extern int convert;
extern struct tm *t2;
extern struct _stamp cur_stamp;
extern int *msg_nums;
extern char *holder1;
extern int mail_low, mail_high;
extern int seen_byl;
extern int to_netmail;
extern PACKED p_msg;
extern PKTHDR pkt_hdr;
extern char cur_dir[];
extern char pkt_dir[];
extern char *arc_cmd[];
extern unsigned int def_attr;
extern int seahome;
extern int priv_net;
extern int boss_net, boss_node;
extern int opus_1;
extern int cminternal;
extern int msgs_done;
extern char *NAME;
extern int tossed_some;
extern int to_file;
extern int check_nodes;
extern int no_matrix;
extern int seadog;
extern int quiet;
extern int backup;
extern int killnull;
extern int killbad;
extern int bad_pkt;
extern int bad_pw;
extern int num_zone;
extern int pass_thru;
extern int route_thru;
extern int do_pickup;
extern int num_pw;
extern int num_arc;
extern int bad_msgs;
extern int mail_dir;
extern int arc_compat;
char originline[256];
char seen_byline[512];
int max_msgs = 32000;
char abbsfile[64];
int nokill = 0;
int ctrla = 0;
int seen_aka = 0;
int only_arc = 0;
int noprivate = 0;
int noforward = 0;
int tiny_seen = 0;
int notquiet = 1;
int send_pvt = 0;
int f_file = 0;
int do_path = 1;
int kill_null;
int killed_some = 0;
char chkvar = 0xc7;
KILLPTR killer;
extern int msg_dups;
extern int hwptr;
int security_check()
{
int i;
char c;
if (strncmp (NAME, "\r\n--- VPurge", 12) != 0)
return (1);
c = 0;
for (i = 0; i < 12; i++)
c += NAME[i];
if (( c & (unsigned char) 0xff) == chkvar)
return (0);
else
return (0);
}
void make_args (
int *argc1,
char **argv1,
char *input_line,
int argc2,
char **argv2)
{
char *p;
int t, a;
p = input_line;
/* Get to first argument */
while (*p)
{
if (isspace (*p) || (*p == 26))
{
++p;
}
else
{
break;
}
}
/* Now peel off arguments one at a time */
*argc1 = 0;
t = 1;
while (*p)
{
if (isspace (*p) || (*p == 26))
{
t = 1;
*p = '\0';
}
else
{
if (t)
{
if ((*p == '%') && (isdigit (*(p+1))))
{
a = *(p+1) - '0' + 1;
if (a < argc2)
{
argv1[*argc1] = argv2[a];
++(*argc1);
t = 0;
++p;
continue;
}
else
{
printf ("Warning - argument %%%c is not present!\n", *(p+1));
}
}
argv1[*argc1] = p;
++(*argc1);
t = 0;
}
*p = (char) toupper (*p);
}
++p;
}
}
void fe_usage()
{
#ifdef OS2
printf ("Usage: VP2 'function' 'arguments'\n\n");
#else
printf ("Usage: VP 'function' 'arguments'\n\n");
#endif
printf (" 'function' is one of the following:\n\n");
printf (" EXPORT, SCAN, FASTSCAN - send messages from VPurge System\n");
printf (" IMPORT, TOSS, FASTTOSS - bring messages into VPurge System\n");
printf ("\nPlease consult the Conference Mail documentation to determine\n");
printf ("which arguments to use for each of the possible functions.\n");
exit (4);
}
void main (int argc,char *argv[])
{
int argc1;
char **argv1;
int done;
FILE *in1;
char *p;
char buff1[20], buff2[20];
char input_line[128];
--argc;
++argv;
sscanf (REV, "$%s %s", buff1, buff2);
printf ("Conference Mail - %s %s by Bob Hartman, FidoNet Node 132/101\n", buff1, buff2);
printf ("(C) Copyright 1986, 1987 by Spark Software Inc. All rights reserved.\n\n");
#ifdef OS2
printf ("Modified for OS/2 with VPurge by Bill Andrus, Superfluous Software.\n\n");
#else
printf ("Modified for DOS with VPurge by Bill Andrus, Superfluous Software.\n\n");
#endif
if (security_check())
{
printf ("It appears that you are running a copy of Conference Mail that\n");
printf ("has been altered! Please contact Bob Hartman at Spark Software\n");
printf ("(FidoNet Node 132/101) so that the situation can be corrected!\n");
exit (2);
}
p = argv[0];
if (p != NULL)
{
while (*p)
*p++ = (char) toupper (*p);
}
else
{
fe_usage();
}
argv1 = argv;
argc1 = argc;
f_file = 0;
done = 0;
if (strcmp (argv[0], "FILE") == 0)
{
f_file = 1;
if ((in1 = fopen (argv[1], "r")) == NULL)
{
printf ("Cannot open input file '%s' - aborting\n", argv[1]);
exit (3);
}
if (fgets (input_line, 128, in1) == NULL)
{
printf ("Input file '%s' is empty - aborting\n", argv[1]);
fclose (in1);
exit (0);
}
argv1 = (char **) malloc (sizeof (char *) * 50);
make_args(&argc1, argv1, input_line, argc, argv);
}
while (!done)
{
msg_dups = 0;
max_msgs = 32000;
ctrla = 0;
seen_aka = 0;
only_arc = 0;
noprivate = 0;
noforward = 0;;
tiny_seen = 0;
notquiet = 1;
send_pvt = 0;
tossed_some = 0;
to_file = 0;
do_path = 1;
check_nodes = 0;
no_matrix = 0;
killed_some = 0;
nokill = 0;
arc_compat = 1;
seadog = 0;
quiet = 0;
backup = 1;
killnull = 0;
killbad = 0;
tot_areas = 0;
arc_args = 0;
last_msg = -1;
high_one = -1;
mail_high = 0;
mail_dir = -1;
convert = 0;
seahome = 1;
bad_pkt = 0;
bad_pw = 0;
bad_msgs = -1;
msgs_done = 0;
priv_net = 0;
boss_net = 0;
boss_node = 0;
num_zone = 0;
pass_thru = -1;
route_thru = -1;
do_pickup = 0;
num_pw = 0;
kill_null = 0;
#ifndef NO_FS
to_netmail = 1;
opus_1 = 0;
cminternal = 0;
def_attr = 0;
num_arc = -1;
hwptr = 0;
#endif
if ( strcmp (argv1[0], "FASTTOSS") == 0 ||
strcmp (argv1[0], "TOSS") == 0 ||
strcmp (argv1[0], "IMPORT") == 0 )
{
fasttoss (argc1, argv1);
}
else if (strcmp (argv1[0], "FASTSCAN") == 0 ||
strcmp (argv1[0], "SCAN") == 0 ||
strcmp (argv1[0], "EXPORT") == 0 )
{
fastscan (argc1, argv1);
}
else
{
fe_usage();
}
if (!f_file)
{
done = 1;
}
else
{
if (fgets (input_line, 128, in1) == NULL)
{
fclose (in1);
exit (0);
}
make_args(&argc1, argv1, input_line, argc, argv);
printf ("\n");
if (argc1 == 0)
done = 1;
}
}
}