home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
VP2SRC.ZIP
/
LOOK_UP.C
< prev
next >
Wrap
Text File
|
1991-04-20
|
6KB
|
204 lines
/*
$Header: look_up.c 3.3 87/12/12 00:43:14 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: look_up.c $
* Revision 3.3 87/12/12 00:43:14 Bob
* Source code release
*
*/
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <io.h>
#include <string.h>
#include <time.h>
#include "fastecho.h"
#define DEBUG 0
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 char seen_byline[];
extern char originline[];
extern char tearline[];
extern int max_msgs;
extern int ctrla;
extern int *msg_nums;
extern char *holder1;
extern int mail_low;
extern int mail_high;
extern char *seen_by;
extern char *origin;
extern char *tear;
extern char *holder;
extern int tearl;
extern int originl;
extern int seen_byl;
extern int msgl;
extern int seen_nets[];
extern int seen_nodes[];
extern int not_seen[];
extern int tot_seen;
extern char arealine[];
extern int areal;
extern MSG_PTR h;
extern int msgs_done;
void find_seen(int totread)
{
char *sb, *sb1;
char *realend;
int endline;
sb = origin + originl;
seen_by = origin;
seen_byl = 0;
realend = (char *) (holder1+totread-10);
while (sb != NULL)
{
/* First find an 'S' */
endline = (int) (realend - sb);
if (endline <= 0)
break;
sb = match_byte (sb, 'S', endline);
/* If we are past the end of the message, then get out */
if (sb == NULL)
break;
if (strncmp (sb, "SEEN-BY:", 8) != 0)
{
++sb;
continue;
}
/* Back up to the EOL chars */
sb1 = sb-1;
while ((((*sb1 & 0x7f) == '\n') || ((*sb1 & 0x7f) == 1))
&& (sb1 >= origin))
--sb1;
if ((*sb1 & 0x7f) == '\r')
{
/* We found it! */
seen_by = sb1 + 1;
seen_byl = strlen (seen_by);
/* If there was no origin line then we have to alter the length
of the message to take into account the seen-by's */
if (originl == 0)
msgl = seen_by - holder;
/* We found it, so get out */
break;
}
else
{
/* Jump past the SEEN-BY: */
sb += 10;
}
}
}
void find_orig(int totread)
{
char *sb;
char *sb1;
int endline;
char *realend;
extern char *match_byte();
origin = holder;
originl = 0;
sb = sb1 = origin;
realend = holder1+totread-10;
while (sb != NULL)
{
endline = (int) (realend - sb);
if (endline <= 0)
break;
sb1 = match_byte (sb, '*', endline);
if (sb1 == NULL)
break;
sb = sb1 + 1;
if (strncmp (sb, " Origin:", 8) != 0)
continue;
if ((*(sb-2) != ' ') || ((*(sb-3) != '\r') && (*(sb-3) != '\n')))
continue;
msgl = sb - 2 - holder;
origin = sb-2;
while ((*sb != '\r') && (sb < (realend + 9)))
++sb;
originl = sb - origin + 1;
break;
}
}