Sorry folks, I left route.c out of the archive. Will be fixed for the next
release...
/* route - routing functions */
/* Originally written by Paul Edwards */
/* Released to the Public Domain */
#include
#include
#include "route.h"
#include "unused.h"
#include "estdio.h"
#include "patmat.h"
#include "strinl.h"
#include "stritr.h"
#include "faddr.h"
void routeDefaults(ROUTE *route)
{
unused(route);
return;
}
void routeInit(ROUTE *route, char *filename)
{
efileOpen(&route->fp, filename, "r");
return;
}
int routeMap(ROUTE *route, fidoAddress *in, fidoAddress *out)
{
char buf[200];
char inFull[50];
int found = 0;
sprintf(inFull, "%d:%d/%d.%d", in->zone, in->net,
in->node, in->point);
efileRewind(&route->fp);
while (efileGets(&route->fp, buf, sizeof buf) != NULL)
{
strinl(buf);
stritr(buf);
if (strncmp(buf, "Send Hold ", 10) == 0)
{
if (patmat(inFull, buf + 10))
{
*out = *in;
found = 1;
break;
}
}
else if (strncmp(buf, "Route Hold ", 11) == 0)
{
char *p;
p = strchr(buf + 11, ' ');
if (p != NULL)
{
if (patmat(inFull, p + 1))
{
FADDR fa;
faddrOnePassCreate(&fa, buf + 11, out);
found = 1;
break;
}
}
}
}
return (found);
}
void routeTerm(ROUTE *route)
{
efileClose(&route->fp);
return;
}
@EOT:
---
* Origin: X (3:711/934.9)
|