home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
VP2SRC.ZIP
/
SEAUTILS.C
< prev
next >
Wrap
Text File
|
1991-04-20
|
8KB
|
249 lines
/*
$Header: seautils.c 3.3 87/12/12 00:45:02 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: seautils.c $
* Revision 3.3 87/12/12 00:45:02 Bob
* Source code release
*
*/
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "fastecho.h"
#define DEBUG 0
char cur_dir[60];
char pkt_dir[60];
int seahome = 1;
extern char tmpjunk[], tmpjunk1[];
int get_sea_config (SEACONFIG_PTR cptr)
{
FILE *config_file;
char *s, *t, *q;
char config_dog[80];
/* First open up the CONFIG.DOG file */
config_dog[0] = 0;
s = getenv ("SEADOG");
if (s != NULL)
{
if (s[strlen(s)-1] == '\\')
s[strlen(s)-1] = '\0';
strcpy (config_dog, s);
strcpy (pkt_dir, s);
strcpy (cur_dir, s);
strcat (pkt_dir, "\\");
strcat (cur_dir, "\\");
strcat (config_dog, "\\CONFIG.DOG");
}
else
{
strcpy (config_dog, "CONFIG.DOG");
}
if ((config_file = fopen (config_dog, "r")) == NULL)
{
#if DEBUG
printf ("Can't open file\n");
#endif
/* Can't open it, return -1 */
return (-1);
}
/* Tell the world we have no addresses yet */
cptr->num_addrs = 0;
/* Now just loop and read every line until EOF */
while (fgets (tmpjunk, 255, config_file) != NULL)
{
/* If we start with a ; just get the next line */
if ((tmpjunk[0] == ';') || (tmpjunk[0] == '\n') || (tmpjunk[0] == '\r'))
{
#if DEBUG
printf ("Got comment or blank line\n");
#endif
continue;
}
/* Now extract the first word */
s = tmpjunk;
/* Skip leading spaces */
while (isspace (*s))
{
++s;
}
t = tmpjunk1;
*t = '\0';
while (*s != '\0')
{
*t++ = (char) toupper (*s);
++s;
if (isspace (*s))
break;
}
/* Null terminate the string */
*t = '\0';
#if DEBUG
printf ("Working with '%s'\n", tmpjunk1);
#endif
/* We have now extracted the tmpjunk1, try to match it */
if (strcmp (tmpjunk1, "NET") == 0)
{
cptr->net[0] = atoi (s);
#if DEBUG
printf ("Got NET #%d\n", cptr->net[0]);
#endif
}
else if ( (strcmp (tmpjunk1, "NODE") == 0)
|| (strcmp (tmpjunk1, "AKA") == 0) )
{
while (*s)
{
/* Get to the digits */
while ((*s) && (!(isdigit(*s))))
++s;
if (*s == '\0')
break;
#if DEBUG
printf ("Working with '%s'\n", s);
#endif
if ( (sscanf (s, "%d/%d", &(cptr->net[cptr->num_addrs+1]),
&(cptr->node[cptr->num_addrs+1])) == 2)
||(sscanf (s, "%d:%d/%d", &(cptr->zone[cptr->num_addrs+1]),
&(cptr->net[cptr->num_addrs+1]),
&(cptr->node[cptr->num_addrs+1])) == 3))
{
++cptr->num_addrs;
#if DEBUG
printf ("Got NODE or AKA = %d/%d\n", cptr->net[cptr->num_addrs], cptr->node[cptr->num_addrs]);
#endif
}
else
{
if (sscanf (s, "%d", &(cptr->node[cptr->num_addrs+1])) == 1)
{
cptr->net[cptr->num_addrs+1] = cptr->net[0];
cptr->zone[cptr->num_addrs+1] = 1;
++cptr->num_addrs;
#if DEBUG
printf ("Got NODE or AKA = %d/%d\n", cptr->net[cptr->num_addrs], cptr->node[cptr->num_addrs]);
#endif
}
}
while ((*s) && (!(isspace (*s))))
++s;
while ((*s) && (isspace(*s)))
++s;
}
}
else if (strcmp (tmpjunk1, "MAIL") == 0)
{
sscanf (s, "%s", cptr->mailpath);
if (cptr->mailpath[strlen(cptr->mailpath)-1] == '\\')
cptr->mailpath[strlen(cptr->mailpath)-1] = '\0';
q = cptr->mailpath;
while (*q)
{
*q = (char) toupper (*q);
++q;
}
#if DEBUG
printf ("Got MAIL='%s'\n", cptr->mailpath);
#endif
}
else if (strcmp (tmpjunk1, "FILES") == 0)
{
sscanf (s, "%s", cptr->filepath);
q = cptr->filepath;
if (cptr->filepath[strlen(cptr->filepath)-1] == '\\')
cptr->filepath[strlen(cptr->filepath)-1] = '\0';
while (*q)
{
*q = (char) toupper (*q);
++q;
}
#if DEBUG
printf ("Got FILES='%s'\n", cptr->filepath);
#endif
}
else if (strcmp (tmpjunk1, "BAUD") == 0)
{
#if DEBUG
printf ("Got BAUD\n");
#endif
}
else if (strcmp (tmpjunk1, "COM") == 0)
{
#if DEBUG
printf ("Got COM\n");
#endif
}
else if (strcmp (tmpjunk1, "MODEM") == 0)
{
#if DEBUG
printf ("Got MODEM\n");
#endif
}
}
fclose (config_file);
return (0);
}