Added template processing for newfiles
This commit is contained in:
parent
faea9ec83a
commit
deff3bc1d6
10
ChangeLog
10
ChangeLog
@ -4692,11 +4692,18 @@ v0.33.20 10-Feb-2002
|
|||||||
The mbfido news functions doesn't abort anymore when a
|
The mbfido news functions doesn't abort anymore when a
|
||||||
newsgroup didn't exist.
|
newsgroup didn't exist.
|
||||||
For points in echomail no seen-by entry is added.
|
For points in echomail no seen-by entry is added.
|
||||||
|
The AreaMgr and FileMgr responses and notify messages now use
|
||||||
|
the diesel macro language with fallback to hardcoded replies.
|
||||||
|
|
||||||
mball:
|
mball:
|
||||||
Will not crash anymore when it needs more then 10 minutes to
|
Will not crash anymore when it needs more then 10 minutes to
|
||||||
create the allfiles and newfiles lists.
|
create the allfiles and newfiles lists.
|
||||||
|
|
||||||
|
mbaff:
|
||||||
|
The High-ascii table to translate to lowercase has now the
|
||||||
|
right values to translate the ansi graphics.
|
||||||
|
Now uses the template newfiles to create the reports.
|
||||||
|
|
||||||
mbtask:
|
mbtask:
|
||||||
Removed some debug logging.
|
Removed some debug logging.
|
||||||
Creates the semafore is_inet when the internet connections is
|
Creates the semafore is_inet when the internet connections is
|
||||||
@ -4767,4 +4774,7 @@ v0.33.20 10-Feb-2002
|
|||||||
The Makefile now selects the right little or big endian menu
|
The Makefile now selects the right little or big endian menu
|
||||||
files to install.
|
files to install.
|
||||||
Rebuild the menus and txtfiles for the new external editor.
|
Rebuild the menus and txtfiles for the new external editor.
|
||||||
|
Added templates.tar. For the time of development they will be
|
||||||
|
installed destructive, ie. all private changes will be lost
|
||||||
|
with every install. Later this will be a normal install.
|
||||||
|
|
||||||
|
@ -17,3 +17,39 @@ mbsebbs-0_33_18_final 02-Nov-2001 Version 0.33.18 released.
|
|||||||
mbsebbs-0_33_19_current 02-Nov-2001 Start 0.33.19 current development.
|
mbsebbs-0_33_19_current 02-Nov-2001 Start 0.33.19 current development.
|
||||||
mbsebbs-0_33_19_final 10-Feb-2002 Version 0.33.19 released.
|
mbsebbs-0_33_19_final 10-Feb-2002 Version 0.33.19 released.
|
||||||
mbsebbs-0_33_20_current 10-Feb-2002 Start 0.33.20 current development.
|
mbsebbs-0_33_20_current 10-Feb-2002 Start 0.33.20 current development.
|
||||||
|
|
||||||
|
|
||||||
|
CVS usage.
|
||||||
|
|
||||||
|
This will only work for registered MBSE developers. Replace username with your
|
||||||
|
sourceforge's username. To initialize your account on the sourceforge cvs
|
||||||
|
server do:
|
||||||
|
|
||||||
|
ssh username@cvs.sourceforge.net
|
||||||
|
|
||||||
|
This command will fail but creates your homedirectory on the sourceforge cvs
|
||||||
|
server.
|
||||||
|
|
||||||
|
Set the following two variables (and add them to .profile):
|
||||||
|
|
||||||
|
export CVS_RSH=ssh
|
||||||
|
export CVSROOT=username@cvs.mbse.sourceforge.net:/cvsroot/mbse
|
||||||
|
|
||||||
|
Install the sources with the followin command:
|
||||||
|
|
||||||
|
cvs co mbsebbs
|
||||||
|
|
||||||
|
That will create the directory mbsebbs with all subdirectories. When you made
|
||||||
|
some changes you can commit these from within the directory mbsebbs with:
|
||||||
|
|
||||||
|
cvs ci -m "Description of your changes"
|
||||||
|
|
||||||
|
To get a fresh source with changes of other developers do:
|
||||||
|
|
||||||
|
cd mbsebbs
|
||||||
|
cvs update
|
||||||
|
|
||||||
|
|
||||||
|
Michiel.
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
include ../Makefile.global
|
include ../Makefile.global
|
||||||
|
|
||||||
OTHER = Makefile header.txt footer.txt menus-le.tar menus-be.tar txtfiles.tar
|
OTHER = Makefile header.txt footer.txt menus-le.tar menus-be.tar txtfiles.tar templates.tar
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
|
||||||
@ -29,6 +29,7 @@ install:
|
|||||||
tar xfC txtfiles.tar ${PREFIX}/english/txtfiles ; \
|
tar xfC txtfiles.tar ${PREFIX}/english/txtfiles ; \
|
||||||
echo "Installing default english txtfiles" ; \
|
echo "Installing default english txtfiles" ; \
|
||||||
fi
|
fi
|
||||||
|
tar xfC templates.tar ${PREFIX}/english/macro
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f filelist Makefile.bak
|
rm -f filelist Makefile.bak
|
||||||
|
@ -7,7 +7,7 @@ This is a modified version of diesel language. Diesel is a interpreted
|
|||||||
macro language, used in AutoCAD and released to public domain by AutoDesk.
|
macro language, used in AutoCAD and released to public domain by AutoDesk.
|
||||||
|
|
||||||
Modified version by Redy Rodriguez, for use in mbsebbs. Original diesel
|
Modified version by Redy Rodriguez, for use in mbsebbs. Original diesel
|
||||||
language can be found at http://www.fournilab.ch/diesel.
|
language can be found at http://www.fourmilab.ch/diesel.
|
||||||
|
|
||||||
This "Dumb Interpretively Executed String Expression Language" is the
|
This "Dumb Interpretively Executed String Expression Language" is the
|
||||||
kernel of a macro language you can customise by adding C code and
|
kernel of a macro language you can customise by adding C code and
|
||||||
|
@ -27,7 +27,7 @@ MSGBASE_HDRS = jam.h jammsg.h jamsys.h msg.h msgtext.h
|
|||||||
MBINET_SRCS = nntp.c pop3.c smtp.c
|
MBINET_SRCS = nntp.c pop3.c smtp.c
|
||||||
MBINET_OBJS = nntp.o pop3.o smtp.o
|
MBINET_OBJS = nntp.o pop3.o smtp.o
|
||||||
MBINET_HDRS = mbinet.h
|
MBINET_HDRS = mbinet.h
|
||||||
DIESEL_SRSC = diesel.c mbdiesel.c
|
DIESEL_SRCS = diesel.c mbdiesel.c
|
||||||
DIESEL_HDRS = diesel.h
|
DIESEL_HDRS = diesel.h
|
||||||
DIESEL_OBJS = diesel.o mbdiesel.o
|
DIESEL_OBJS = diesel.o mbdiesel.o
|
||||||
MEMWATCH_SRCS = memwatch.c
|
MEMWATCH_SRCS = memwatch.c
|
||||||
@ -168,6 +168,8 @@ msgtext.o: libs.h msgtext.h msg.h
|
|||||||
nntp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
nntp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
||||||
pop3.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
pop3.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
||||||
smtp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
smtp.o: libs.h structs.h users.h records.h clcomm.h mbinet.h
|
||||||
|
diesel.o: libs.h diesel.h
|
||||||
|
mbdiesel.o: libs.h structs.h users.h records.h clcomm.h diesel.h
|
||||||
memwatch.o: ../config.h ../config.h libs.h memwatch.h
|
memwatch.o: ../config.h ../config.h libs.h memwatch.h
|
||||||
ftscprod.o: libs.h structs.h common.h
|
ftscprod.o: libs.h structs.h common.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
334
lib/diesel.c
334
lib/diesel.c
@ -764,16 +764,16 @@ Mfunc(f_edtime)
|
|||||||
} pictab[] = {
|
} pictab[] = {
|
||||||
/* Careful! These must be sorted by descending order of
|
/* Careful! These must be sorted by descending order of
|
||||||
picture string length. */
|
picture string length. */
|
||||||
{"YYYY", "%02d", &year},
|
{(char *)"YYYY", (char *)"%02d", &year},
|
||||||
{"DD", "%02d", &mday},
|
{(char *)"DD", (char *)"%02d", &mday},
|
||||||
{"HH", "%02d", &heure},
|
{(char *)"HH", (char *)"%02d", &heure},
|
||||||
{"MM", "%02d", &min},
|
{(char *)"MM", (char *)"%02d", &min},
|
||||||
{"MO", "%02d", &tmon},
|
{(char *)"MO", (char *)"%02d", &tmon},
|
||||||
{"SS", "%02d", &sec},
|
{(char *)"SS", (char *)"%02d", &sec},
|
||||||
{"YY", "%02d", &yearmod100},
|
{(char *)"YY", (char *)"%02d", &yearmod100},
|
||||||
{"D", "%d", &mday},
|
{(char *)"D", (char *)"%d", &mday},
|
||||||
{"H", "%d", &heure},
|
{(char *)"H", (char *)"%d", &heure},
|
||||||
{"M", "%d", &tmon}
|
{(char *)"M", (char *)"%d", &tmon}
|
||||||
};
|
};
|
||||||
|
|
||||||
ArgCount(2, 2);
|
ArgCount(2, 2);
|
||||||
@ -833,59 +833,59 @@ Mfunc(f_edtime)
|
|||||||
|
|
||||||
if (strncasecmp(pp, lComp(month)) == 0) {
|
if (strncasecmp(pp, lComp(month)) == 0) {
|
||||||
static char *mois[] = {
|
static char *mois[] = {
|
||||||
"January",
|
(char *)"January",
|
||||||
"February",
|
(char *)"February",
|
||||||
"March",
|
(char *)"March",
|
||||||
"April",
|
(char *)"April",
|
||||||
"May",
|
(char *)"May",
|
||||||
"June",
|
(char *)"June",
|
||||||
"July",
|
(char *)"July",
|
||||||
"August",
|
(char *)"August",
|
||||||
"September",
|
(char *)"September",
|
||||||
"October",
|
(char *)"October",
|
||||||
"November",
|
(char *)"November",
|
||||||
"December"
|
(char *)"December"
|
||||||
};
|
};
|
||||||
V strcat(output, mois[jd->tm_mon]);
|
V strcat(output, mois[jd->tm_mon]);
|
||||||
pp += lcompl;
|
pp += lcompl;
|
||||||
} else if (strncasecmp(pp, lComp(mon)) == 0) {
|
} else if (strncasecmp(pp, lComp(mon)) == 0) {
|
||||||
static char *mois[] = {
|
static char *mois[] = {
|
||||||
"Jan",
|
(char *)"Jan",
|
||||||
"Feb",
|
(char *)"Feb",
|
||||||
"Mar",
|
(char *)"Mar",
|
||||||
"Apr",
|
(char *)"Apr",
|
||||||
"May",
|
(char *)"May",
|
||||||
"Jun",
|
(char *)"Jun",
|
||||||
"Jul",
|
(char *)"Jul",
|
||||||
"Aug",
|
(char *)"Aug",
|
||||||
"Sep",
|
(char *)"Sep",
|
||||||
"Oct",
|
(char *)"Oct",
|
||||||
"Nov",
|
(char *)"Nov",
|
||||||
"Dec"
|
(char *)"Dec"
|
||||||
};
|
};
|
||||||
V strcat(output, mois[jd->tm_mon]);
|
V strcat(output, mois[jd->tm_mon]);
|
||||||
pp += lcompl;
|
pp += lcompl;
|
||||||
} else if (strncasecmp(pp, lComp(dddd)) == 0) {
|
} else if (strncasecmp(pp, lComp(dddd)) == 0) {
|
||||||
static char *jour[] = {
|
static char *jour[] = {
|
||||||
"Sunday",
|
(char *)"Sunday",
|
||||||
"Monday",
|
(char *)"Monday",
|
||||||
"Tuesday",
|
(char *)"Tuesday",
|
||||||
"Wednesday",
|
(char *)"Wednesday",
|
||||||
"Thursday",
|
(char *)"Thursday",
|
||||||
"Friday",
|
(char *)"Friday",
|
||||||
"Saturday"
|
(char *)"Saturday"
|
||||||
};
|
};
|
||||||
V strcat(output, jour[jd->tm_wday]);
|
V strcat(output, jour[jd->tm_wday]);
|
||||||
pp += lcompl;
|
pp += lcompl;
|
||||||
} else if (strncasecmp(pp, lComp(ddd)) == 0) {
|
} else if (strncasecmp(pp, lComp(ddd)) == 0) {
|
||||||
static char *jour[] = {
|
static char *jour[] = {
|
||||||
"Sun",
|
(char *)"Sun",
|
||||||
"Mon",
|
(char *)"Mon",
|
||||||
"Tue",
|
(char *)"Tue",
|
||||||
"Wed",
|
(char *)"Wed",
|
||||||
"Thu",
|
(char *)"Thu",
|
||||||
"Fri",
|
(char *)"Fri",
|
||||||
"Sat"
|
(char *)"Sat"
|
||||||
};
|
};
|
||||||
V strcat(output, jour[jd->tm_wday]);
|
V strcat(output, jour[jd->tm_wday]);
|
||||||
pp += lcompl;
|
pp += lcompl;
|
||||||
@ -1363,43 +1363,43 @@ Mfunc(f_xor)
|
|||||||
/* Macro name/function table. */
|
/* Macro name/function table. */
|
||||||
|
|
||||||
static struct mfent mftab[] = {
|
static struct mfent mftab[] = {
|
||||||
{"+", f_plus},
|
{(char *)"+", f_plus},
|
||||||
{"-", f_minus},
|
{(char *)"-", f_minus},
|
||||||
{"*", f_times},
|
{(char *)"*", f_times},
|
||||||
{"/", f_divide},
|
{(char *)"/", f_divide},
|
||||||
{"=", f_numeq},
|
{(char *)"=", f_numeq},
|
||||||
{"<", f_numlt},
|
{(char *)"<", f_numlt},
|
||||||
{">", f_numgt},
|
{(char *)">", f_numgt},
|
||||||
{"!=", f_numne},
|
{(char *)"!=", f_numne},
|
||||||
{"<=", f_numle},
|
{(char *)"<=", f_numle},
|
||||||
{">=", f_numge},
|
{(char *)">=", f_numge},
|
||||||
{"AND", f_and},
|
{(char *)"AND", f_and},
|
||||||
{"EQ", f_equal},
|
{(char *)"EQ", f_equal},
|
||||||
{"EVAL", f_eval},
|
{(char *)"EVAL", f_eval},
|
||||||
{"FIX", f_fix},
|
{(char *)"FIX", f_fix},
|
||||||
{"IF", f_if},
|
{(char *)"IF", f_if},
|
||||||
{"INDEX", f_index},
|
{(char *)"INDEX", f_index},
|
||||||
{"LOWER", f_lower},
|
{(char *)"LOWER", f_lower},
|
||||||
{"NTH", f_nth},
|
{(char *)"NTH", f_nth},
|
||||||
{"OR", f_or},
|
{(char *)"OR", f_or},
|
||||||
{"STRCMP", f_strcmp},
|
{(char *)"STRCMP", f_strcmp},
|
||||||
{"STRFILL", f_strfill},
|
{(char *)"STRFILL", f_strfill},
|
||||||
{"STRLEN", f_strlen},
|
{(char *)"STRLEN", f_strlen},
|
||||||
{"STRSTR", f_strstr},
|
{(char *)"STRSTR", f_strstr},
|
||||||
{"SUBSTR", f_substr},
|
{(char *)"SUBSTR", f_substr},
|
||||||
{"UPPER", f_upper},
|
{(char *)"UPPER", f_upper},
|
||||||
{"XOR", f_xor},
|
{(char *)"XOR", f_xor},
|
||||||
|
|
||||||
#ifdef UNIXTENSIONS
|
#ifdef UNIXTENSIONS
|
||||||
{"EDTIME", f_edtime},
|
{(char *)"EDTIME", f_edtime},
|
||||||
{"GETENV", f_getenv},
|
{(char *)"GETENV", f_getenv},
|
||||||
{"TIME", f_time},
|
{(char *)"TIME", f_time},
|
||||||
#endif /* UNIXTENSIONS */
|
#endif /* UNIXTENSIONS */
|
||||||
|
|
||||||
#ifdef VARIABLES
|
#ifdef VARIABLES
|
||||||
{"CLEAR", f_clear},
|
{(char *)"CLEAR", f_clear},
|
||||||
{"GETVAR", f_getvar},
|
{(char *)"GETVAR", f_getvar},
|
||||||
{"SETVAR", f_setvar},
|
{(char *)"SETVAR", f_setvar},
|
||||||
#endif /* VARIABLES */
|
#endif /* VARIABLES */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1595,7 +1595,7 @@ static int macrovalue(int nargs, char *args, char *output)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAXARGS; i++) {
|
for (i = 0; i < MAXARGS; i++) {
|
||||||
argv[i] = "";
|
argv[i] = (char *)"";
|
||||||
}
|
}
|
||||||
for (i = 0; i < nargs; i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
argv[i] = args;
|
argv[i] = args;
|
||||||
@ -1664,18 +1664,18 @@ static int macroeval(char **in, char **out)
|
|||||||
char *ip = *in, *op = *out;
|
char *ip = *in, *op = *out;
|
||||||
char margs[MAXSTR], mvalue[MAXSTR];
|
char margs[MAXSTR], mvalue[MAXSTR];
|
||||||
char *ma = margs;
|
char *ma = margs;
|
||||||
int stat, nargs;
|
int mstat, nargs;
|
||||||
|
|
||||||
nargs = stat = macromode(&ip, &ma);
|
nargs = mstat = macromode(&ip, &ma);
|
||||||
|
|
||||||
if (stat > 0) {
|
if (mstat > 0) {
|
||||||
#ifdef ECHOMAC
|
#ifdef ECHOMAC
|
||||||
*op++ = ' ';
|
*op++ = ' ';
|
||||||
*op++ = '<';
|
*op++ = '<';
|
||||||
V sprintf(op, "(%d)", stat);
|
V sprintf(op, "(%d)", mstat);
|
||||||
op += strlen(op);
|
op += strlen(op);
|
||||||
ma = margs;
|
ma = margs;
|
||||||
while (stat-- > 0) {
|
while (mstat-- > 0) {
|
||||||
int l = strlen(ma);
|
int l = strlen(ma);
|
||||||
|
|
||||||
V strcpy(op, ma);
|
V strcpy(op, ma);
|
||||||
@ -1689,25 +1689,25 @@ static int macroeval(char **in, char **out)
|
|||||||
|
|
||||||
/* Evaluate the macro. */
|
/* Evaluate the macro. */
|
||||||
|
|
||||||
stat = macrovalue(nargs, margs, mvalue);
|
mstat = macrovalue(nargs, margs, mvalue);
|
||||||
V strcpy(op, mvalue);
|
V strcpy(op, mvalue);
|
||||||
op += strlen(mvalue);
|
op += strlen(mvalue);
|
||||||
#ifdef ECHOMAC
|
#ifdef ECHOMAC
|
||||||
if (stat == FALSE || stat == DIAGNOSTIC) {
|
if (mstat == FALSE || mstat == DIAGNOSTIC) {
|
||||||
V strcpy(op, "*ERR*");
|
V strcpy(op, "*ERR*");
|
||||||
op += 5;
|
op += 5;
|
||||||
}
|
}
|
||||||
*op++ = ' ';
|
*op++ = ' ';
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
stat = FALSE;
|
mstat = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*op++ = EOS;
|
*op++ = EOS;
|
||||||
*out = op;
|
*out = op;
|
||||||
*in = ip;
|
*in = ip;
|
||||||
|
|
||||||
return stat;
|
return mstat;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DIESEL -- Evaluate a string IN and return the value in OUT.
|
/* DIESEL -- Evaluate a string IN and return the value in OUT.
|
||||||
@ -1715,19 +1715,19 @@ static int macroeval(char **in, char **out)
|
|||||||
error was detected, returns the column at which the
|
error was detected, returns the column at which the
|
||||||
error was found. */
|
error was found. */
|
||||||
|
|
||||||
int diesel(const char *in, char *out)
|
int diesel(char *in, char *out)
|
||||||
{
|
{
|
||||||
int stat;
|
int dstat;
|
||||||
char *inp = in, *outp = out;
|
char *inp = in, *outp = out;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
stat = copymode(&inp, &outp);
|
dstat = copymode(&inp, &outp);
|
||||||
if (stat == 1) {
|
if (dstat == 1) {
|
||||||
char margs[MAXSTR];
|
char margs[MAXSTR];
|
||||||
char *ma = margs;
|
char *ma = margs;
|
||||||
|
|
||||||
stat = macroeval(&inp, &ma);
|
dstat = macroeval(&inp, &ma);
|
||||||
if (stat > 0) {
|
if (dstat > 0) {
|
||||||
|
|
||||||
/* If we're about to overflow the output string, bail
|
/* If we're about to overflow the output string, bail
|
||||||
out of the evaluation and append the overflow
|
out of the evaluation and append the overflow
|
||||||
@ -1749,7 +1749,7 @@ int diesel(const char *in, char *out)
|
|||||||
/* Error detected in macro evaluation which placed a
|
/* Error detected in macro evaluation which placed a
|
||||||
diagnostic string in the output. */
|
diagnostic string in the output. */
|
||||||
|
|
||||||
if (stat == DIAGNOSTIC) {
|
if (dstat == DIAGNOSTIC) {
|
||||||
return inp - in;
|
return inp - in;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1758,147 +1758,9 @@ int diesel(const char *in, char *out)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stat;
|
return dstat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroVars( const char *codes, const char *fmt, ...)
|
|
||||||
{
|
|
||||||
char *tmp1, *tmp2;
|
|
||||||
va_list ap;
|
|
||||||
int j;
|
|
||||||
int dieselrc;
|
|
||||||
char *vs;
|
|
||||||
int vd;
|
|
||||||
char vc;
|
|
||||||
double vf;
|
|
||||||
|
|
||||||
tmp1=calloc(256,sizeof(char));
|
|
||||||
tmp2=calloc(256,sizeof(char));
|
|
||||||
|
|
||||||
va_start(ap,fmt);
|
|
||||||
for ( j=0; (codes[j] != '\0') && (fmt[j] != '\0') ; j++ ){
|
|
||||||
tmp1[0]='\0';
|
|
||||||
switch(fmt[j]) {
|
|
||||||
case 's': /* string */
|
|
||||||
vs = va_arg(ap, char *);
|
|
||||||
sprintf(tmp1,"@(setvar,%c,%s)",codes[j],vs);
|
|
||||||
break;
|
|
||||||
case 'd': /* int */
|
|
||||||
vd = va_arg(ap, int);
|
|
||||||
sprintf(tmp1,"@(setvar,%c,%d)",codes[j],vd);
|
|
||||||
break;
|
|
||||||
case 'c': /* char */
|
|
||||||
vc = va_arg(ap, char);
|
|
||||||
sprintf(tmp1,"@(setvar,%c,%c)",codes[j],vc);
|
|
||||||
break;
|
|
||||||
case 'f': /* char */
|
|
||||||
vf = va_arg(ap, double);
|
|
||||||
sprintf(tmp1,"@(setvar,%c,%f)",codes[j],vf);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dieselrc=diesel(tmp1,tmp2);
|
|
||||||
}
|
|
||||||
va_end(ap);
|
|
||||||
free(tmp1);
|
|
||||||
free(tmp2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MacroClear(void)
|
|
||||||
{
|
|
||||||
int dieselrc;
|
|
||||||
char tmp1[]="@(CLEAR)",*tmp2;
|
|
||||||
tmp2=calloc(10,sizeof(char));
|
|
||||||
dieselrc=diesel(tmp1,tmp2);
|
|
||||||
free(tmp2);
|
|
||||||
}
|
|
||||||
|
|
||||||
char *ParseMacro( const char *line, int *dieselrc)
|
|
||||||
{
|
|
||||||
static char res[256];
|
|
||||||
char *tmp1,*tmp2,*tmp3;
|
|
||||||
char *i;
|
|
||||||
int j;
|
|
||||||
int l;
|
|
||||||
char code;
|
|
||||||
|
|
||||||
res[0]='\0';
|
|
||||||
*dieselrc=0;
|
|
||||||
|
|
||||||
if ( *line == '#' )
|
|
||||||
return res;
|
|
||||||
|
|
||||||
tmp1 = calloc(256,sizeof(char));
|
|
||||||
tmp2 = calloc(256,sizeof(char));
|
|
||||||
tmp3 = calloc(256,sizeof(char));
|
|
||||||
|
|
||||||
tmp1[0]='\0';
|
|
||||||
|
|
||||||
for ( i=line ; i[0] != '\0'; i++){
|
|
||||||
if ( (i[0] == '@') && isalpha(i[1]) ){
|
|
||||||
l=2;
|
|
||||||
i++;
|
|
||||||
if (i[0] != '@') {
|
|
||||||
if ((code = i[0]) != '\0' )
|
|
||||||
i++;
|
|
||||||
while (( i[0] == '_') || ( i[0] == '>') || ( i[0] == '<') ){
|
|
||||||
l++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
i--;
|
|
||||||
sprintf(tmp2,"@(GETVAR,%c)",code);
|
|
||||||
if (!diesel(tmp2,tmp3)==0){
|
|
||||||
sprintf(tmp3,"%c%c",'@',code);
|
|
||||||
}
|
|
||||||
if (l>2){
|
|
||||||
if ( *i != '>')
|
|
||||||
l=-l;
|
|
||||||
sprintf(&tmp1[strlen(tmp1)],"%*.*s",l,l, tmp3);
|
|
||||||
}else{
|
|
||||||
sprintf(&tmp1[strlen(tmp1)],"%s",tmp3);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
tmp1[(j=strlen(tmp1))]='@';
|
|
||||||
tmp1[j+1]='\0';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
tmp1[(j=strlen(tmp1))]=i[0];
|
|
||||||
tmp1[j+1]='\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i = tmp1;
|
|
||||||
sprintf(tmp2,"%s",tmp1);
|
|
||||||
|
|
||||||
if ((tmp1[0]=='@') && (tmp1[1]=='{')){
|
|
||||||
i++;
|
|
||||||
i++;
|
|
||||||
for (j=2; ((tmp1[j]!='}') && (tmp1[j]!='\0'));j++){
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if ( (tmp1[j]=='}') ){
|
|
||||||
i++;
|
|
||||||
res[0]='\0';
|
|
||||||
if (j>2)
|
|
||||||
sprintf(res,"%.*s",j-2,&tmp1[2]);
|
|
||||||
if ((diesel(res,tmp3)!=0) || (atoi(tmp3)==0))
|
|
||||||
sprintf(tmp2,"@!%s",i);
|
|
||||||
else
|
|
||||||
sprintf(tmp2,"%s",i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*dieselrc=diesel(tmp2, res);
|
|
||||||
|
|
||||||
free(tmp1);
|
|
||||||
free(tmp2);
|
|
||||||
free(tmp3);
|
|
||||||
while (isspace(res[strlen(res) - 1])) {
|
|
||||||
res[strlen(res) - 1] = EOS;
|
|
||||||
}
|
|
||||||
sprintf(&res[strlen(res)],"\r\n");
|
|
||||||
if ((res[0] == '@') && (res[1] =='!' ))
|
|
||||||
res[0]='\0';
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TESTPROG
|
#ifdef TESTPROG
|
||||||
|
|
||||||
|
@ -39,15 +39,15 @@ int tracing = TRUE; /* Trace macro evalution */
|
|||||||
#define FUZZEQ(a, b) ((((a) < (b)) ? ((b) - (a)) : ((a) - (b))) < 1E-10)
|
#define FUZZEQ(a, b) ((((a) < (b)) ? ((b) - (a)) : ((a) - (b))) < 1E-10)
|
||||||
|
|
||||||
|
|
||||||
int diesel(const char *, char *);
|
int diesel(char *, char *);
|
||||||
char *ParseMacro( const char *, int * );
|
|
||||||
void MacroVars( const char *, const char *, ... );
|
|
||||||
void MacroClear(void);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MBSE BBS specific functions
|
* MBSE BBS specific functions
|
||||||
*/
|
*/
|
||||||
|
char *ParseMacro( const char *, int * );
|
||||||
|
void MacroVars( const char *, const char *, ... );
|
||||||
|
void MacroClear(void);
|
||||||
FILE *OpenMacro(const char *, int);
|
FILE *OpenMacro(const char *, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
149
lib/mbdiesel.c
149
lib/mbdiesel.c
@ -36,6 +36,155 @@
|
|||||||
#include "diesel.h"
|
#include "diesel.h"
|
||||||
|
|
||||||
|
|
||||||
|
void MacroVars( const char *codes, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
char *tmp1, *tmp2;
|
||||||
|
va_list ap;
|
||||||
|
int j;
|
||||||
|
int dieselrc;
|
||||||
|
char *vs;
|
||||||
|
int vd;
|
||||||
|
char vc;
|
||||||
|
double vf;
|
||||||
|
|
||||||
|
tmp1=calloc(256,sizeof(char));
|
||||||
|
tmp2=calloc(256,sizeof(char));
|
||||||
|
|
||||||
|
va_start(ap,fmt);
|
||||||
|
for ( j=0; (codes[j] != '\0') && (fmt[j] != '\0') ; j++ ){
|
||||||
|
tmp1[0]='\0';
|
||||||
|
switch(fmt[j]) {
|
||||||
|
case 's': /* string */
|
||||||
|
vs = va_arg(ap, char *);
|
||||||
|
sprintf(tmp1,"@(setvar,%c,\"%s\")",codes[j],vs);
|
||||||
|
break;
|
||||||
|
case 'd': /* int */
|
||||||
|
vd = va_arg(ap, int);
|
||||||
|
sprintf(tmp1,"@(setvar,%c,%d)",codes[j],vd);
|
||||||
|
break;
|
||||||
|
case 'c': /* char */
|
||||||
|
vc = va_arg(ap, char);
|
||||||
|
sprintf(tmp1,"@(setvar,%c,%c)",codes[j],vc);
|
||||||
|
break;
|
||||||
|
case 'f': /* char */
|
||||||
|
vf = va_arg(ap, double);
|
||||||
|
sprintf(tmp1,"@(setvar,%c,%f)",codes[j],vf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dieselrc=diesel(tmp1,tmp2);
|
||||||
|
if (dieselrc) {
|
||||||
|
Syslog('!', "MacroVars error %d argument %d", dieselrc, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
free(tmp1);
|
||||||
|
free(tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MacroClear(void)
|
||||||
|
{
|
||||||
|
int dieselrc;
|
||||||
|
char tmp1[] = "@(CLEAR)", *tmp2;
|
||||||
|
|
||||||
|
tmp2 = calloc(10,sizeof(char));
|
||||||
|
dieselrc = diesel(tmp1, tmp2);
|
||||||
|
if (dieselrc)
|
||||||
|
Syslog('!', "MacroClear error %d", dieselrc);
|
||||||
|
free(tmp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *ParseMacro( const char *line, int *dieselrc)
|
||||||
|
{
|
||||||
|
static char res[256];
|
||||||
|
char *tmp1, *tmp2, *tmp3, *i;
|
||||||
|
int j, l;
|
||||||
|
char code;
|
||||||
|
|
||||||
|
res[0]='\0';
|
||||||
|
*dieselrc=0;
|
||||||
|
|
||||||
|
if ( *line == '#' )
|
||||||
|
return res;
|
||||||
|
|
||||||
|
tmp1 = calloc(256,sizeof(char));
|
||||||
|
tmp2 = calloc(256,sizeof(char));
|
||||||
|
tmp3 = calloc(256,sizeof(char));
|
||||||
|
|
||||||
|
tmp1[0]='\0';
|
||||||
|
|
||||||
|
for ( i=line ; i[0] != '\0'; i++){
|
||||||
|
if ( (i[0] == '@') && isalpha(i[1]) ){
|
||||||
|
l=2;
|
||||||
|
i++;
|
||||||
|
if (i[0] != '@') {
|
||||||
|
if ((code = i[0]) != '\0' )
|
||||||
|
i++;
|
||||||
|
while (( i[0] == '_') || ( i[0] == '>') || ( i[0] == '<') ){
|
||||||
|
l++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i--;
|
||||||
|
sprintf(tmp2,"@(GETVAR,%c)",code);
|
||||||
|
if (!diesel(tmp2,tmp3)==0){
|
||||||
|
sprintf(tmp3,"%c%c",'@',code);
|
||||||
|
}
|
||||||
|
if (l>2){
|
||||||
|
if ( *i != '>')
|
||||||
|
l=-l;
|
||||||
|
sprintf(&tmp1[strlen(tmp1)],"%*.*s",l,l, tmp3);
|
||||||
|
}else{
|
||||||
|
sprintf(&tmp1[strlen(tmp1)],"%s",tmp3);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
tmp1[(j=strlen(tmp1))]='@';
|
||||||
|
tmp1[j+1]='\0';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
tmp1[(j=strlen(tmp1))]=i[0];
|
||||||
|
tmp1[j+1]='\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i = tmp1;
|
||||||
|
sprintf(tmp2,"%s",tmp1);
|
||||||
|
|
||||||
|
if ((tmp1[0]=='@') && (tmp1[1]=='{')){
|
||||||
|
i++;
|
||||||
|
i++;
|
||||||
|
for (j=2; ((tmp1[j]!='}') && (tmp1[j]!='\0'));j++){
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if ( (tmp1[j]=='}') ){
|
||||||
|
i++;
|
||||||
|
res[0]='\0';
|
||||||
|
if (j>2)
|
||||||
|
sprintf(res,"%.*s",j-2,&tmp1[2]);
|
||||||
|
if ((diesel(res,tmp3)!=0) || (atoi(tmp3)==0))
|
||||||
|
sprintf(tmp2,"@!%s",i);
|
||||||
|
else
|
||||||
|
sprintf(tmp2,"%s",i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*dieselrc=diesel(tmp2, res);
|
||||||
|
|
||||||
|
free(tmp1);
|
||||||
|
free(tmp2);
|
||||||
|
free(tmp3);
|
||||||
|
while (isspace(res[strlen(res) - 1])) {
|
||||||
|
res[strlen(res) - 1] = EOS;
|
||||||
|
}
|
||||||
|
// sprintf(&res[strlen(res)],"\r\n");
|
||||||
|
if ((res[0] == '@') && (res[1] =='!' ))
|
||||||
|
res[0]='\0';
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FILE *OpenMacro(const char *filename, int Language)
|
FILE *OpenMacro(const char *filename, int Language)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,8 @@ MBMSG_OBJS = post.o mbmsg.o
|
|||||||
MBFIDO_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
|
MBFIDO_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
|
||||||
../lib/libdbase.a ../lib/libdiesel.a ../lib/libmbinet.a
|
../lib/libdbase.a ../lib/libdiesel.a ../lib/libmbinet.a
|
||||||
MBSEQ_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
MBSEQ_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
||||||
MBAFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a ../lib/libdbase.a
|
MBAFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
|
||||||
|
../lib/libdbase.a ../lib/libdiesel.a
|
||||||
MBINDEX_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
MBINDEX_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
||||||
MBDIFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
MBDIFF_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
||||||
MBFILE_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
MBFILE_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libdbase.a
|
||||||
@ -163,12 +164,12 @@ post.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/co
|
|||||||
rnews.o: ../lib/libs.h ../lib/structs.h ../lib/users.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
|
rnews.o: ../lib/libs.h ../lib/structs.h ../lib/users.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
|
||||||
storenet.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h rollover.h storenet.h
|
storenet.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h rollover.h storenet.h
|
||||||
utic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h tic.h utic.h
|
utic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h tic.h mover.h tic.h utic.h
|
||||||
announce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h grlist.h msgutil.h announce.h
|
announce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h grlist.h msgutil.h announce.h
|
||||||
fflist.o: ../lib/libs.h ../lib/clcomm.h ../lib/msg.h fflist.h
|
fflist.o: ../lib/libs.h ../lib/clcomm.h ../lib/msg.h fflist.h
|
||||||
ftn2rfc.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h ftn2rfc.h
|
ftn2rfc.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/dbftn.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/common.h ../lib/clcomm.h rollover.h aliasdb.h postemail.h backalias.h ftn2rfc.h
|
||||||
makestat.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h makestat.h
|
makestat.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h makestat.h
|
||||||
mbindex.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbftn.h mbindex.h
|
mbindex.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/dbftn.h mbindex.h
|
||||||
msgutil.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h msgutil.h
|
msgutil.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h msgutil.h
|
||||||
postecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h
|
postecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ftn2rfc.h postecho.h storeecho.h addpkt.h rollover.h
|
||||||
rollover.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
|
rollover.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
|
||||||
tic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbftn.h ../lib/clcomm.h ulock.h ptic.h fsort.h pack.h tic.h
|
tic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbftn.h ../lib/clcomm.h ulock.h ptic.h fsort.h pack.h tic.h
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "../lib/msgtext.h"
|
#include "../lib/msgtext.h"
|
||||||
|
#include "../lib/diesel.h"
|
||||||
#include "grlist.h"
|
#include "grlist.h"
|
||||||
#include "msgutil.h"
|
#include "msgutil.h"
|
||||||
#include "announce.h"
|
#include "announce.h"
|
||||||
@ -73,8 +74,7 @@ int Add_ToBeRep()
|
|||||||
|
|
||||||
fseek(tbr, 0, SEEK_SET);
|
fseek(tbr, 0, SEEK_SET);
|
||||||
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
||||||
if ((strcmp(Temp.Name, T_File.Name) == 0) &&
|
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate = T_File.Fdate))
|
||||||
(Temp.Fdate = T_File.Fdate))
|
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,15 +197,15 @@ void Uploads()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int StartMsg(void);
|
long StartMsg(void);
|
||||||
int StartMsg(void)
|
long StartMsg(void)
|
||||||
{
|
{
|
||||||
if (!Msg_Open(newfiles.Area))
|
if (!Msg_Open(newfiles.Area))
|
||||||
return FALSE;
|
return -1;
|
||||||
|
|
||||||
if (!Msg_Lock(30L)) {
|
if (!Msg_Lock(30L)) {
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
return FALSE;
|
return -1;
|
||||||
}
|
}
|
||||||
Msg_New();
|
Msg_New();
|
||||||
|
|
||||||
@ -229,34 +229,40 @@ int StartMsg(void)
|
|||||||
*/
|
*/
|
||||||
Msg_Id(newfiles.UseAka);
|
Msg_Id(newfiles.UseAka);
|
||||||
Msg_Pid();
|
Msg_Pid();
|
||||||
Msg_Top();
|
return Msg_Top(newfiles.Template, newfiles.Language, newfiles.UseAka);
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FinishMsg(int);
|
void FinishMsg(int, long);
|
||||||
void FinishMsg(int Final)
|
void FinishMsg(int Final, long filepos)
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp;
|
||||||
FILE *fp;
|
FILE *fp, *fi;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
if (Final) {
|
if (Final) {
|
||||||
|
if ((fi = OpenMacro(newfiles.Template, newfiles.Language)) != NULL) {
|
||||||
|
MacroVars("CD", "dd", TotalFiles, TotalSize);
|
||||||
|
fseek(fi, filepos, SEEK_SET);
|
||||||
|
Msg_Macro(fi);
|
||||||
|
fclose(fi);
|
||||||
|
MacroClear();
|
||||||
|
} else {
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
sprintf(temp, "This is a total of %d files, %lu Kbytes", TotalFiles, TotalSize);
|
sprintf(temp, "This is a total of %d files, %lu Kbytes", TotalFiles, TotalSize);
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
} else {
|
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
MsgText_Add2((char *)"to be continued...");
|
sprintf(temp, "With regards, %s", CFG.sysop_name);
|
||||||
MsgCount++;
|
MsgText_Add2(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(newfiles.Origin))
|
if (strlen(newfiles.Origin))
|
||||||
Msg_Bot(newfiles.UseAka, newfiles.Origin);
|
Msg_Bot(newfiles.UseAka, newfiles.Origin, newfiles.Template);
|
||||||
else
|
else
|
||||||
Msg_Bot(newfiles.UseAka, CFG.origin);
|
Msg_Bot(newfiles.UseAka, CFG.origin, newfiles.Template);
|
||||||
|
|
||||||
Msg_AddMsg();
|
Msg_AddMsg();
|
||||||
Msg_UnLock();
|
Msg_UnLock();
|
||||||
@ -274,46 +280,72 @@ void FinishMsg(int Final)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Report(gr_list *);
|
long Report(gr_list *, long);
|
||||||
void Report(gr_list *ta)
|
long Report(gr_list *ta, long filepos)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp, *fi;
|
||||||
char *temp;
|
char *temp, *line;
|
||||||
int i, Total = 0;
|
int i, Total = 0;
|
||||||
unsigned long Size = 0;
|
unsigned long Size = 0;
|
||||||
|
long filepos1 = 0, filepos2, filepos3 = 0, finalpos = 0;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
|
||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
||||||
if ((!strcmp(T_File.Echo, ta->echo)) &&
|
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group)))
|
||||||
(!strcmp(T_File.Group, ta->group)))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((fi = OpenMacro(newfiles.Template, newfiles.Language)) != NULL) {
|
||||||
|
MacroVars("GHZ", "ssd", T_File.Echo, T_File.Comment, 0);
|
||||||
|
fseek(fi, filepos, SEEK_SET);
|
||||||
|
Msg_Macro(fi);
|
||||||
|
filepos1 = ftell(fi);
|
||||||
|
} else {
|
||||||
sprintf(temp, "Area %s - %s", T_File.Echo, T_File.Comment);
|
sprintf(temp, "Area %s - %s", T_File.Echo, T_File.Comment);
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
|
MsgText_Add2((char *)"------------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
MsgText_Add2((char *)"------------------------------------------------------------------------");
|
|
||||||
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
while (fread(&T_File, sizeof(T_File), 1, fp) == 1) {
|
||||||
if ((!strcmp(T_File.Echo, ta->echo)) &&
|
if ((!strcmp(T_File.Echo, ta->echo)) && (!strcmp(T_File.Group, ta->group))) {
|
||||||
(!strcmp(T_File.Group, ta->group))) {
|
|
||||||
|
|
||||||
if (CFG.slow_util && do_quiet)
|
if (CFG.slow_util && do_quiet)
|
||||||
usleep(1);
|
usleep(1);
|
||||||
|
|
||||||
sprintf(temp, "%-12s %5lu Kb. %s", tu(T_File.Name), T_File.SizeKb, To_Low(T_File.LDesc[0],newfiles.HiAscii));
|
if (fi != NULL) {
|
||||||
|
fseek(fi, filepos1, SEEK_SET);
|
||||||
|
MacroVars("slbkdt", "ssddss", T_File.Name, T_File.LName, T_File.Size, T_File.SizeKb, " ",
|
||||||
|
To_Low(T_File.LDesc[0],newfiles.HiAscii));
|
||||||
|
Msg_Macro(fi);
|
||||||
|
filepos2 = ftell(fi);
|
||||||
|
for (i = 1; i < 24; i++) {
|
||||||
|
MacroVars("t", "s", To_Low(T_File.LDesc[i],newfiles.HiAscii));
|
||||||
|
fseek(fi, filepos2, SEEK_SET);
|
||||||
|
if (strlen(T_File.LDesc[i])) {
|
||||||
|
Msg_Macro(fi);
|
||||||
|
} else {
|
||||||
|
line = calloc(255, sizeof(char));
|
||||||
|
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {}
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
filepos3 = ftell(fi);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sprintf(temp, "%-12s %5lu Kb. %s", T_File.Name, T_File.SizeKb, To_Low(T_File.LDesc[0],newfiles.HiAscii));
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
if (T_File.TotLdesc > 0)
|
if (T_File.TotLdesc > 0)
|
||||||
for (i = 1; i < T_File.TotLdesc; i++) {
|
for (i = 1; i < T_File.TotLdesc; i++) {
|
||||||
sprintf(temp, " %s", To_Low(T_File.LDesc[i],newfiles.HiAscii));
|
sprintf(temp, " %s", To_Low(T_File.LDesc[i],newfiles.HiAscii));
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Total++;
|
Total++;
|
||||||
Size += T_File.SizeKb;
|
Size += T_File.SizeKb;
|
||||||
|
|
||||||
@ -321,17 +353,31 @@ void Report(gr_list *ta)
|
|||||||
* Split message the hard way.
|
* Split message the hard way.
|
||||||
*/
|
*/
|
||||||
if (Msg.Size > (CFG.new_force * 1024)) {
|
if (Msg.Size > (CFG.new_force * 1024)) {
|
||||||
FinishMsg(FALSE);
|
MacroVars("Z", "d", 1);
|
||||||
|
MsgText_Add2((char *)"");
|
||||||
|
MsgText_Add2((char *)"to be continued...");
|
||||||
|
MsgCount++;
|
||||||
|
FinishMsg(FALSE, finalpos);
|
||||||
StartMsg();
|
StartMsg();
|
||||||
}
|
}
|
||||||
|
if ((Msg.Size > (CFG.new_split * 1024)) && (fi != NULL)) {
|
||||||
|
MacroVars("Z", "d", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (fi != NULL) {
|
||||||
|
MacroVars("AB", "dd", Total, Size);
|
||||||
|
fseek(fi, filepos3, SEEK_SET);
|
||||||
|
Msg_Macro(fi);
|
||||||
|
finalpos = ftell(fi);
|
||||||
|
} else {
|
||||||
MsgText_Add2((char *)"------------------------------------------------------------------------");
|
MsgText_Add2((char *)"------------------------------------------------------------------------");
|
||||||
|
|
||||||
sprintf(temp, "%d files, %lu Kb", Total, Size);
|
sprintf(temp, "%d files, %lu Kb", Total, Size);
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(temp);
|
free(temp);
|
||||||
|
|
||||||
@ -339,12 +385,20 @@ void Report(gr_list *ta)
|
|||||||
* Split messages the gently way.
|
* Split messages the gently way.
|
||||||
*/
|
*/
|
||||||
if (Msg.Size > (CFG.new_split * 1024)) {
|
if (Msg.Size > (CFG.new_split * 1024)) {
|
||||||
FinishMsg(FALSE);
|
MsgText_Add2((char *)"");
|
||||||
|
MsgText_Add2((char *)"to be continued...");
|
||||||
|
MsgCount++;
|
||||||
|
FinishMsg(FALSE, finalpos);
|
||||||
StartMsg();
|
StartMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalFiles += Total;
|
TotalFiles += Total;
|
||||||
TotalSize += Size;
|
TotalSize += Size;
|
||||||
|
|
||||||
|
if (fi != NULL) {
|
||||||
|
fclose(fi);
|
||||||
|
}
|
||||||
|
return finalpos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,7 +409,7 @@ int Announce()
|
|||||||
char *temp;
|
char *temp;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int Count = 0, rc = FALSE;
|
int Count = 0, rc = FALSE;
|
||||||
long filepos;
|
long filepos, filepos1, filepos2;
|
||||||
char group[13];
|
char group[13];
|
||||||
int i, groups, any;
|
int i, groups, any;
|
||||||
|
|
||||||
@ -365,7 +419,6 @@ int Announce()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Uploads();
|
Uploads();
|
||||||
|
|
||||||
IsDoing("Announce files");
|
IsDoing("Announce files");
|
||||||
|
|
||||||
temp = calloc(128, sizeof(char));
|
temp = calloc(128, sizeof(char));
|
||||||
@ -423,9 +476,8 @@ int Announce()
|
|||||||
while (fread(&newfiles, newfileshdr.recsize, 1, fp) == 1) {
|
while (fread(&newfiles, newfileshdr.recsize, 1, fp) == 1) {
|
||||||
if (newfiles.Active) {
|
if (newfiles.Active) {
|
||||||
filepos = ftell(fp);
|
filepos = ftell(fp);
|
||||||
if (!do_quiet) {
|
if (!do_quiet)
|
||||||
printf(" %s\n", newfiles.Comment);
|
printf(" %s\n", newfiles.Comment);
|
||||||
}
|
|
||||||
any = FALSE;
|
any = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < groups; i++) {
|
for (i = 0; i < groups; i++) {
|
||||||
@ -439,15 +491,16 @@ int Announce()
|
|||||||
rc = TRUE;
|
rc = TRUE;
|
||||||
Syslog('+', "Create report: %s", newfiles.Comment);
|
Syslog('+', "Create report: %s", newfiles.Comment);
|
||||||
MsgCount = 1;
|
MsgCount = 1;
|
||||||
if (StartMsg()) {
|
if ((filepos1 = StartMsg()) != -1) {
|
||||||
|
filepos2 = 0;
|
||||||
while (fread(&group, 13, 1, fp) == 1) {
|
while (fread(&group, 13, 1, fp) == 1) {
|
||||||
for (tmp = fgr; tmp; tmp = tmp->next)
|
for (tmp = fgr; tmp; tmp = tmp->next)
|
||||||
if (!strcmp(tmp->group, group)) {
|
if (!strcmp(tmp->group, group)) {
|
||||||
Report(tmp);
|
filepos2 = Report(tmp, filepos1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FinishMsg(TRUE, filepos2);
|
||||||
}
|
}
|
||||||
FinishMsg(TRUE);
|
|
||||||
} else {
|
} else {
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf(" No matching groups\n");
|
printf(" No matching groups\n");
|
||||||
@ -459,7 +512,6 @@ int Announce()
|
|||||||
fseek(fp, newfileshdr.grpsize, SEEK_CUR);
|
fseek(fp, newfileshdr.grpsize, SEEK_CUR);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
tidy_grlist(&fgr);
|
tidy_grlist(&fgr);
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
@ -83,8 +83,7 @@ void A_Help(faddr *, char *);
|
|||||||
void A_Help(faddr *t, char *replyid)
|
void A_Help(faddr *t, char *replyid)
|
||||||
{
|
{
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
char *line,*subject;
|
char *subject;
|
||||||
int res;
|
|
||||||
|
|
||||||
Syslog('+', "AreaMgr: Help");
|
Syslog('+', "AreaMgr: Help");
|
||||||
|
|
||||||
@ -95,12 +94,8 @@ void A_Help(faddr *t, char *replyid)
|
|||||||
|
|
||||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject , replyid)) != NULL) {
|
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject , replyid)) != NULL) {
|
||||||
if ((fi = OpenMacro("areamgr.help", nodes.Language)) != NULL ){
|
if ((fi = OpenMacro("areamgr.help", nodes.Language)) != NULL ){
|
||||||
line = calloc(255, sizeof(char));
|
MacroRead(fi, fp);
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
free(line);
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Areamgr");
|
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Areamgr");
|
||||||
@ -160,8 +155,8 @@ void A_Query(faddr *t, char *replyid)
|
|||||||
void A_List(faddr *t, char *replyid, int Notify)
|
void A_List(faddr *t, char *replyid, int Notify)
|
||||||
{
|
{
|
||||||
FILE *qp, *gp, *mp, *fi;
|
FILE *qp, *gp, *mp, *fi;
|
||||||
char *temp, *Group, *line, *subject;
|
char *temp, *Group, *subject;
|
||||||
int i, First = TRUE, SubTot, Total = 0, Cons, res;
|
int i, First = TRUE, SubTot, Total = 0, Cons;
|
||||||
char Stat[5];
|
char Stat[5];
|
||||||
faddr *f, *g;
|
faddr *f, *g;
|
||||||
sysconnect System;
|
sysconnect System;
|
||||||
@ -221,11 +216,8 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
fi=OpenMacro("areamgr.query", nodes.Language);
|
fi=OpenMacro("areamgr.query", nodes.Language);
|
||||||
if (Notify>=LIST_UNLINK)
|
if (Notify>=LIST_UNLINK)
|
||||||
fi=OpenMacro("areamgr.unlink", nodes.Language);
|
fi=OpenMacro("areamgr.unlink", nodes.Language);
|
||||||
line=calloc(256,sizeof(char));
|
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr);
|
fgetpos(fi,&fileptr);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "The following is a list of message areas\r\r");
|
fprintf(qp, "The following is a list of message areas\r\r");
|
||||||
@ -235,7 +227,6 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
if ((mp = fopen(temp, "r")) == NULL) {
|
if ((mp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
MacroClear();
|
MacroClear();
|
||||||
return;
|
return;
|
||||||
@ -247,7 +238,6 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
if ((gp = fopen(temp, "r")) == NULL) {
|
if ((gp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
MacroClear();
|
MacroClear();
|
||||||
fclose(mp);
|
fclose(mp);
|
||||||
@ -272,9 +262,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("GHI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
MacroVars("GHI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
||||||
fsetpos(fi,&fileptr);
|
fsetpos(fi,&fileptr);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr1);
|
fgetpos(fi,&fileptr1);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "Group %s - %s (%s)\r\r", mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka));
|
fprintf(qp, "Group %s - %s (%s)\r\r", mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka));
|
||||||
@ -318,9 +306,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
(Stat[3] == 'C')
|
(Stat[3] == 'C')
|
||||||
);
|
);
|
||||||
fsetpos(fi,&fileptr1);
|
fsetpos(fi,&fileptr1);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr2);
|
fgetpos(fi,&fileptr2);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "%s %-25s %s\r", Stat, msgs.Tag, msgs.Name);
|
fprintf(qp, "%s %-25s %s\r", Stat, msgs.Tag, msgs.Name);
|
||||||
@ -334,7 +320,6 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("ZA", "dd", (int) 0 , SubTot );
|
MacroVars("ZA", "dd", (int) 0 , SubTot );
|
||||||
fsetpos(fi,&fileptr2);
|
fsetpos(fi,&fileptr2);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
|
||||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||||
MacroVars("Z","d",1);
|
MacroVars("Z","d",1);
|
||||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||||
@ -342,8 +327,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
||||||
msgptr = ftell(qp);
|
msgptr = ftell(qp);
|
||||||
}
|
}
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
MacroRead(fi, qp);
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "----------------------------------------------------------------------------\r");
|
fprintf(qp, "----------------------------------------------------------------------------\r");
|
||||||
fprintf(qp, "%d area(s)\r\r\r", SubTot);
|
fprintf(qp, "%d area(s)\r\r\r", SubTot);
|
||||||
@ -361,9 +345,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
}
|
}
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("B", "d", Total );
|
MacroVars("B", "d", Total );
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
@ -378,7 +360,6 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
}
|
}
|
||||||
fclose(mp);
|
fclose(mp);
|
||||||
fclose(gp);
|
fclose(gp);
|
||||||
free(line);
|
|
||||||
fprintf(qp, "%s\r", TearLine());
|
fprintf(qp, "%s\r", TearLine());
|
||||||
CloseMail(qp, t);
|
CloseMail(qp, t);
|
||||||
} else
|
} else
|
||||||
@ -392,8 +373,8 @@ void A_List(faddr *t, char *replyid, int Notify)
|
|||||||
void A_Flow(faddr *t, char *replyid, int Notify)
|
void A_Flow(faddr *t, char *replyid, int Notify)
|
||||||
{
|
{
|
||||||
FILE *qp, *gp, *mp, *fi;
|
FILE *qp, *gp, *mp, *fi;
|
||||||
char *temp, *Group, *line, *subject;
|
char *temp, *Group, *subject;
|
||||||
int i, First = TRUE, Cons, res;
|
int i, First = TRUE, Cons;
|
||||||
char Stat[2];
|
char Stat[2];
|
||||||
faddr *f, *g;
|
faddr *f, *g;
|
||||||
sysconnect System;
|
sysconnect System;
|
||||||
@ -446,12 +427,10 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
msgptr = ftell(qp);
|
msgptr = ftell(qp);
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
line = calloc(256, sizeof(char));
|
|
||||||
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||||
if ((mp = fopen(temp, "r")) == NULL) {
|
if ((mp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -462,7 +441,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
if ((gp = fopen(temp, "r")) == NULL) {
|
if ((gp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
fclose(mp);
|
fclose(mp);
|
||||||
return;
|
return;
|
||||||
@ -470,9 +448,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
||||||
free(temp);
|
free(temp);
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr);
|
fgetpos(fi,&fileptr);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "The following is a flow report of all message areas\r\r");
|
fprintf(qp, "The following is a flow report of all message areas\r\r");
|
||||||
@ -494,9 +470,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("GHI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
MacroVars("GHI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
||||||
fsetpos(fi,&fileptr);
|
fsetpos(fi,&fileptr);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr1);
|
fgetpos(fi,&fileptr1);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "Group %s - %s\r\r", mgroup.Name, mgroup.Comment);
|
fprintf(qp, "Group %s - %s\r\r", mgroup.Name, mgroup.Comment);
|
||||||
@ -534,9 +508,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
(Stat[0] == 'C')
|
(Stat[0] == 'C')
|
||||||
);
|
);
|
||||||
fsetpos(fi,&fileptr1);
|
fsetpos(fi,&fileptr1);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr2);
|
fgetpos(fi,&fileptr2);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "%s %s %9lu %10lu\r", Stat, padleft(msgs.Tag, 50, ' '),
|
fprintf(qp, "%s %s %9lu %10lu\r", Stat, padleft(msgs.Tag, 50, ' '),
|
||||||
@ -554,7 +526,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("ZBCDbcd", "ddddddd", (int) 0 , rlw, rlm, rlt, plw, plm, plt);
|
MacroVars("ZBCDbcd", "ddddddd", (int) 0 , rlw, rlm, rlt, plw, plm, plt);
|
||||||
fsetpos(fi,&fileptr2);
|
fsetpos(fi,&fileptr2);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
|
||||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||||
MacroVars("Z","d",1);
|
MacroVars("Z","d",1);
|
||||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||||
@ -562,8 +533,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
||||||
msgptr = ftell(qp);
|
msgptr = ftell(qp);
|
||||||
}
|
}
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
MacroRead(fi, qp);
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "---------------------------------------------------------------------------\r");
|
fprintf(qp, "---------------------------------------------------------------------------\r");
|
||||||
fprintf(qp, "Total %58lu %10lu\r\r\r", rlw, rlm);
|
fprintf(qp, "Total %58lu %10lu\r\r\r", rlw, rlm);
|
||||||
@ -580,9 +550,7 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
@ -595,7 +563,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
|||||||
|
|
||||||
fclose(mp);
|
fclose(mp);
|
||||||
fclose(gp);
|
fclose(gp);
|
||||||
free(line);
|
|
||||||
} else
|
} else
|
||||||
WriteError("Can't create netmail");
|
WriteError("Can't create netmail");
|
||||||
free(subject);
|
free(subject);
|
||||||
@ -607,8 +574,8 @@ void A_Status(faddr *, char *);
|
|||||||
void A_Status(faddr *t, char *replyid)
|
void A_Status(faddr *t, char *replyid)
|
||||||
{
|
{
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
int i,res;
|
int i;
|
||||||
char *line, *subject;
|
char *subject;
|
||||||
|
|
||||||
subject = calloc(255, sizeof(char));
|
subject = calloc(255, sizeof(char));
|
||||||
sprintf(subject,"AreaMgr Status");
|
sprintf(subject,"AreaMgr Status");
|
||||||
@ -641,11 +608,7 @@ void A_Status(faddr *t, char *replyid)
|
|||||||
|
|
||||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
||||||
if ( (fi=OpenMacro("areamgr.status", nodes.Language)) != NULL ){
|
if ( (fi=OpenMacro("areamgr.status", nodes.Language)) != NULL ){
|
||||||
line = calloc(255, sizeof(char));
|
MacroRead(fi, fp);
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
free(line);
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "Here is your (echo)mail status:\r\r");
|
fprintf(fp, "Here is your (echo)mail status:\r\r");
|
||||||
|
@ -198,7 +198,7 @@ int StartReply(ff_list *ffl)
|
|||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
Msg.ReplyCRC = upd_crc32(temp, crc, strlen(temp));
|
Msg.ReplyCRC = upd_crc32(temp, crc, strlen(temp));
|
||||||
Msg_Pid();
|
Msg_Pid();
|
||||||
Msg_Top();
|
Msg_Top(scanmgr.template, scanmgr.Language, scanmgr.Aka);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -224,9 +224,9 @@ void FinishReply(int Reported, int Total)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(scanmgr.Origin))
|
if (strlen(scanmgr.Origin))
|
||||||
Msg_Bot(scanmgr.Aka, scanmgr.Origin);
|
Msg_Bot(scanmgr.Aka, scanmgr.Origin, scanmgr.template);
|
||||||
else
|
else
|
||||||
Msg_Bot(scanmgr.Aka, CFG.origin);
|
Msg_Bot(scanmgr.Aka, CFG.origin, scanmgr.template);
|
||||||
Msg_AddMsg();
|
Msg_AddMsg();
|
||||||
Msg_UnLock();
|
Msg_UnLock();
|
||||||
Syslog('+', "Posted message %ld", Msg.Id);
|
Syslog('+', "Posted message %ld", Msg.Id);
|
||||||
|
@ -78,8 +78,7 @@ void F_Help(faddr *, char *);
|
|||||||
void F_Help(faddr *t, char *replyid)
|
void F_Help(faddr *t, char *replyid)
|
||||||
{
|
{
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
char *line,*subject;
|
char *subject;
|
||||||
int res;
|
|
||||||
|
|
||||||
Syslog('+', "FileMgr: Help");
|
Syslog('+', "FileMgr: Help");
|
||||||
subject=calloc(255,sizeof(char));
|
subject=calloc(255,sizeof(char));
|
||||||
@ -89,13 +88,9 @@ void F_Help(faddr *t, char *replyid)
|
|||||||
|
|
||||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
||||||
if ( (fi=OpenMacro("filemgr.help", nodes.Language)) != NULL ){
|
if ( (fi=OpenMacro("filemgr.help", nodes.Language)) != NULL ){
|
||||||
line = calloc(255, sizeof(char));
|
|
||||||
MacroVars("SNAP", "ssss", nodes.Sysop, (char *)"Filemgr", ascfnode(bestaka_s(t), 0xf), nodes.Fpasswd );
|
MacroVars("SNAP", "ssss", nodes.Sysop, (char *)"Filemgr", ascfnode(bestaka_s(t), 0xf), nodes.Fpasswd );
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, fp);
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
free(line);
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Filemgr");
|
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Filemgr");
|
||||||
@ -155,8 +150,8 @@ void F_Query(faddr *t, char *replyid)
|
|||||||
void F_List(faddr *t, char *replyid, int Notify)
|
void F_List(faddr *t, char *replyid, int Notify)
|
||||||
{
|
{
|
||||||
FILE *qp, *gp, *fp, *fi;
|
FILE *qp, *gp, *fp, *fi;
|
||||||
char *temp, *Group, *line, *subject;
|
char *temp, *Group, *subject;
|
||||||
int i, First = TRUE, SubTot, Total = 0, Cons, res;
|
int i, First = TRUE, SubTot, Total = 0, Cons;
|
||||||
char Stat[4];
|
char Stat[4];
|
||||||
faddr *f, *g;
|
faddr *f, *g;
|
||||||
sysconnect System;
|
sysconnect System;
|
||||||
@ -215,11 +210,8 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
fi=OpenMacro("filemgr.query", nodes.Language);
|
fi=OpenMacro("filemgr.query", nodes.Language);
|
||||||
if (Notify>=LIST_UNLINK)
|
if (Notify>=LIST_UNLINK)
|
||||||
fi=OpenMacro("filemgr.unlink", nodes.Language);
|
fi=OpenMacro("filemgr.unlink", nodes.Language);
|
||||||
line=calloc(256,sizeof(char));
|
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr);
|
fgetpos(fi,&fileptr);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "The following is a list of file areas\r\r");
|
fprintf(qp, "The following is a list of file areas\r\r");
|
||||||
@ -229,7 +221,6 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
if ((fp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
MacroClear();
|
MacroClear();
|
||||||
return;
|
return;
|
||||||
@ -241,7 +232,6 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
if ((gp = fopen(temp, "r")) == NULL) {
|
if ((gp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
free(subject);
|
free(subject);
|
||||||
MacroClear();
|
MacroClear();
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -266,9 +256,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("GHI", "sss",fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka) );
|
MacroVars("GHI", "sss",fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka) );
|
||||||
fsetpos(fi,&fileptr);
|
fsetpos(fi,&fileptr);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr1);
|
fgetpos(fi,&fileptr1);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "Group %s - %s (%s)\r\r", fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka));
|
fprintf(qp, "Group %s - %s (%s)\r\r", fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka));
|
||||||
@ -309,9 +297,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
(Stat[2] == 'P')
|
(Stat[2] == 'P')
|
||||||
);
|
);
|
||||||
fsetpos(fi,&fileptr1);
|
fsetpos(fi,&fileptr1);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr2);
|
fgetpos(fi,&fileptr2);
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "%s %-20s %s\r", Stat, tic.Name, tic.Comment);
|
fprintf(qp, "%s %-20s %s\r", Stat, tic.Name, tic.Comment);
|
||||||
@ -325,7 +311,6 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("ZA", "dd", (int) 0 , SubTot );
|
MacroVars("ZA", "dd", (int) 0 , SubTot );
|
||||||
fsetpos(fi,&fileptr2);
|
fsetpos(fi,&fileptr2);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
|
||||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||||
MacroVars("Z","d",1);
|
MacroVars("Z","d",1);
|
||||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||||
@ -333,8 +318,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid);
|
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid);
|
||||||
msgptr = ftell(qp);
|
msgptr = ftell(qp);
|
||||||
}
|
}
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
MacroRead(fi, qp);
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(qp, "------------------------------------------------------------------------\r");
|
fprintf(qp, "------------------------------------------------------------------------\r");
|
||||||
fprintf(qp, "%d available area(s)\r\r\r", SubTot);
|
fprintf(qp, "%d available area(s)\r\r\r", SubTot);
|
||||||
@ -353,9 +337,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
|
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("B", "d", Total );
|
MacroVars("B", "d", Total );
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, qp);
|
||||||
fprintf( qp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
@ -369,7 +351,6 @@ void F_List(faddr *t, char *replyid, int Notify)
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fclose(gp);
|
fclose(gp);
|
||||||
free(line);
|
|
||||||
fprintf(qp, "%s\r", TearLine());
|
fprintf(qp, "%s\r", TearLine());
|
||||||
CloseMail(qp, t);
|
CloseMail(qp, t);
|
||||||
} else
|
} else
|
||||||
@ -384,8 +365,8 @@ void F_Status(faddr *, char *);
|
|||||||
void F_Status(faddr *t, char *replyid)
|
void F_Status(faddr *t, char *replyid)
|
||||||
{
|
{
|
||||||
FILE *fp, *fi;
|
FILE *fp, *fi;
|
||||||
int i,res;
|
int i;
|
||||||
char *line,*subject;
|
char *subject;
|
||||||
|
|
||||||
subject = calloc(255, sizeof(char));
|
subject = calloc(255, sizeof(char));
|
||||||
sprintf(subject,"FileMgr Status");
|
sprintf(subject,"FileMgr Status");
|
||||||
@ -424,12 +405,8 @@ void F_Status(faddr *t, char *replyid)
|
|||||||
|
|
||||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
||||||
if ( (fi=OpenMacro("filemgr.status", nodes.Language)) != NULL ){
|
if ( (fi=OpenMacro("filemgr.status", nodes.Language)) != NULL ){
|
||||||
line = calloc(255, sizeof(char));
|
MacroRead(fi, fp);
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
MacroClear();
|
MacroClear();
|
||||||
free(line);
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "Here is your fileecho status:\r\r");
|
fprintf(fp, "Here is your fileecho status:\r\r");
|
||||||
|
106
mbfido/mgrutil.c
106
mbfido/mgrutil.c
@ -45,36 +45,67 @@
|
|||||||
extern int net_out;
|
extern int net_out;
|
||||||
|
|
||||||
|
|
||||||
|
void MacroRead(FILE *fi, FILE *fp)
|
||||||
|
{
|
||||||
|
char *line, *temp;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
line = calloc(256, sizeof(char));
|
||||||
|
temp = calloc(256, sizeof(char));
|
||||||
|
|
||||||
|
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {
|
||||||
|
/*
|
||||||
|
* Skip comment lines
|
||||||
|
*/
|
||||||
|
if (line[0] != '#') {
|
||||||
|
Striplf(line);
|
||||||
|
if (strlen(line) == 0) {
|
||||||
|
/*
|
||||||
|
* Empty lines are just written
|
||||||
|
*/
|
||||||
|
fprintf(fp, "\r");
|
||||||
|
} else {
|
||||||
|
strncpy(temp, ParseMacro(line,&res), 254);
|
||||||
|
if (res)
|
||||||
|
Syslog('!', "Macro error line: \"%s\"", line);
|
||||||
|
/*
|
||||||
|
* Only output if something was evaluated
|
||||||
|
*/
|
||||||
|
if (strlen(temp))
|
||||||
|
fprintf(fp, "%s\r", temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(line);
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write Echomail groups list to tempfile
|
* Write Echomail groups list to tempfile
|
||||||
*/
|
*/
|
||||||
void WriteMailGroups(FILE *fp, faddr *f)
|
void WriteMailGroups(FILE *fp, faddr *f)
|
||||||
{
|
{
|
||||||
int Count = 0, First = TRUE, res;
|
int Count = 0, First = TRUE;
|
||||||
char *Group, *temp, *line;
|
char *Group, *temp;
|
||||||
FILE *gp,*fi;
|
FILE *gp,*fi;
|
||||||
faddr *g;
|
faddr *g;
|
||||||
fpos_t fileptr;
|
fpos_t fileptr;
|
||||||
|
|
||||||
temp = calloc(128, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
line = calloc(256, sizeof(char));
|
|
||||||
sprintf(temp, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||||
fi=NULL;
|
|
||||||
fi=OpenMacro("areamgr.group", nodes.Language);
|
if ((fi = OpenMacro("areamgr.group", nodes.Language)) != NULL){
|
||||||
if (fi != NULL){
|
MacroRead(fi, fp);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr);
|
fgetpos(fi,&fileptr);
|
||||||
}else{
|
} else {
|
||||||
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
||||||
fprintf(fp, "The following is a list of mail groups at %s\r\r", ascfnode(f, 0x1f));
|
fprintf(fp, "The following is a list of mail groups at %s\r\r", ascfnode(f, 0x1f));
|
||||||
}
|
}
|
||||||
if ((gp = fopen(temp, "r")) == NULL) {
|
if ((gp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
||||||
@ -96,11 +127,9 @@ void WriteMailGroups(FILE *fp, faddr *f)
|
|||||||
(g->zone == f->zone) && (g->net == f->net) &&
|
(g->zone == f->zone) && (g->net == f->net) &&
|
||||||
(g->node == f->node) && (g->point == f->point)) {
|
(g->node == f->node) && (g->point == f->point)) {
|
||||||
if (fi !=NULL){
|
if (fi !=NULL){
|
||||||
MacroVars("gh", "ss", mgroup.Name, mgroup.Comment );
|
MacroVars("gh", "ss", mgroup.Name, mgroup.Comment);
|
||||||
fsetpos(fi,&fileptr);
|
fsetpos(fi, &fileptr);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, fp);
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "%-12s %s\r", mgroup.Name, mgroup.Comment);
|
fprintf(fp, "%-12s %s\r", mgroup.Name, mgroup.Comment);
|
||||||
}
|
}
|
||||||
@ -111,16 +140,13 @@ void WriteMailGroups(FILE *fp, faddr *f)
|
|||||||
}
|
}
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("b", "d", Count );
|
MacroVars("b", "d", Count );
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, fp);
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||||
fprintf(fp, "%d group(s)\r\r\r", Count);
|
fprintf(fp, "%d group(s)\r\r\r", Count);
|
||||||
}
|
}
|
||||||
fclose(gp);
|
fclose(gp);
|
||||||
free(line);
|
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,21 +157,17 @@ void WriteMailGroups(FILE *fp, faddr *f)
|
|||||||
*/
|
*/
|
||||||
void WriteFileGroups(FILE *fp, faddr *f)
|
void WriteFileGroups(FILE *fp, faddr *f)
|
||||||
{
|
{
|
||||||
int Count = 0, First = TRUE, res;
|
int Count = 0, First = TRUE;
|
||||||
char *Group, *temp, *line;
|
char *Group, *temp;
|
||||||
FILE *gp, *fi;
|
FILE *gp, *fi;
|
||||||
faddr *g;
|
faddr *g;
|
||||||
fpos_t fileptr;
|
fpos_t fileptr;
|
||||||
|
|
||||||
temp = calloc(128, sizeof(char));
|
temp = calloc(128, sizeof(char));
|
||||||
line = calloc(256, sizeof(char));
|
|
||||||
sprintf(temp, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
|
||||||
fi=NULL;
|
|
||||||
fi=OpenMacro("filemgr.group", nodes.Language);
|
if ((fi = OpenMacro("filemgr.group", nodes.Language)) != NULL){
|
||||||
if (fi != NULL){
|
MacroRead(fi, fp);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fgetpos(fi,&fileptr);
|
fgetpos(fi,&fileptr);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
||||||
@ -154,7 +176,6 @@ void WriteFileGroups(FILE *fp, faddr *f)
|
|||||||
if ((gp = fopen(temp, "r")) == NULL) {
|
if ((gp = fopen(temp, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
free(line);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fread(&fgrouphdr, sizeof(fgrouphdr), 1, gp);
|
fread(&fgrouphdr, sizeof(fgrouphdr), 1, gp);
|
||||||
@ -178,9 +199,7 @@ void WriteFileGroups(FILE *fp, faddr *f)
|
|||||||
if (fi !=NULL){
|
if (fi !=NULL){
|
||||||
MacroVars("gh", "ss", fgroup.Name, fgroup.Comment );
|
MacroVars("gh", "ss", fgroup.Name, fgroup.Comment );
|
||||||
fsetpos(fi,&fileptr);
|
fsetpos(fi,&fileptr);
|
||||||
while ( (fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))){
|
MacroRead(fi, fp);
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "%-12s %s\r", fgroup.Name, fgroup.Comment);
|
fprintf(fp, "%-12s %s\r", fgroup.Name, fgroup.Comment);
|
||||||
}
|
}
|
||||||
@ -191,16 +210,13 @@ void WriteFileGroups(FILE *fp, faddr *f)
|
|||||||
}
|
}
|
||||||
if (fi != NULL){
|
if (fi != NULL){
|
||||||
MacroVars("b", "d", Count );
|
MacroVars("b", "d", Count );
|
||||||
while ( fgets(line, 254, fi) != NULL ){
|
MacroRead(fi, fp);
|
||||||
fprintf( fp, "%s", ParseMacro(line,&res));
|
|
||||||
}
|
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}else{
|
}else{
|
||||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||||
fprintf(fp, "%d group(s)\r\r\r", Count);
|
fprintf(fp, "%d group(s)\r\r\r", Count);
|
||||||
}
|
}
|
||||||
fclose(gp);
|
fclose(gp);
|
||||||
free(line);
|
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,33 +445,41 @@ int UplinkRequest(faddr *t, int FileMgr, char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GetRpSubject(const char *report, char* subject)
|
void GetRpSubject(const char *report, char* subject)
|
||||||
{
|
{
|
||||||
FILE *fi;
|
FILE *fi;
|
||||||
char *temp;
|
char *temp;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
temp = calloc(256,sizeof(char));
|
temp = calloc(256,sizeof(char));
|
||||||
if ((fi=OpenMacro(report, nodes.Language))!=NULL){
|
if ((fi=OpenMacro(report, nodes.Language))!=NULL){
|
||||||
while ( fgets(temp, 254, fi) != NULL )
|
while ( fgets(temp, 254, fi) != NULL )
|
||||||
|
if (temp[0] != '#')
|
||||||
ParseMacro(temp,&res);
|
ParseMacro(temp,&res);
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
}
|
}
|
||||||
res=diesel("@(getvar,subject)",temp);
|
|
||||||
Syslog('d', "diesel: %d %s", res, temp);
|
res=diesel((char *)"@(getvar,subject)",temp);
|
||||||
|
|
||||||
if(res==0)
|
if(res==0)
|
||||||
sprintf(subject,"%s",temp);
|
sprintf(subject,"%s",temp);
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MsgResult(const char * report, FILE *fo)
|
int MsgResult(const char * report, FILE *fo)
|
||||||
{
|
{
|
||||||
FILE *fi;
|
FILE *fi;
|
||||||
char *temp;
|
char *temp;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
temp = calloc(256,sizeof(char));
|
temp = calloc(256,sizeof(char));
|
||||||
if ((fi=OpenMacro(report, nodes.Language))!=NULL){
|
if ((fi=OpenMacro(report, nodes.Language))!=NULL){
|
||||||
while ( fgets(temp, 254, fi) != NULL ){
|
while ( fgets(temp, 254, fi) != NULL ){
|
||||||
fprintf(fo,"%s",ParseMacro(temp,&res));
|
if (temp[0] != '#')
|
||||||
|
fprintf(fo,"%s\r",ParseMacro(temp,&res));
|
||||||
}
|
}
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
res=1;
|
res=1;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define _MGRUTIL_H
|
#define _MGRUTIL_H
|
||||||
|
|
||||||
|
|
||||||
|
void MacroRead(FILE *, FILE *);
|
||||||
int MsgResult(const char *, FILE * );
|
int MsgResult(const char *, FILE * );
|
||||||
void GetRpSubject(const char *, char*);
|
void GetRpSubject(const char *, char*);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/dbcfg.h"
|
#include "../lib/dbcfg.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "../lib/msgtext.h"
|
#include "../lib/msgtext.h"
|
||||||
|
#include "../lib/diesel.h"
|
||||||
#include "msgutil.h"
|
#include "msgutil.h"
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +45,8 @@ extern int do_quiet; /* Supress screen output */
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translation table from Hi-USA-ANSI to Lo-ASCII
|
* Translation table from Hi-USA-ANSI to Lo-ASCII,
|
||||||
|
* currently only ANSI graphics are translated.
|
||||||
*/
|
*/
|
||||||
char lotab[] = {
|
char lotab[] = {
|
||||||
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"
|
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"
|
||||||
@ -58,9 +60,9 @@ char lotab[] = {
|
|||||||
"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217"
|
"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217"
|
||||||
"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237"
|
"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237"
|
||||||
"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257"
|
"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257"
|
||||||
"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277"
|
"\260\261\262\174\053\053\053\053\053\043\174\043\043\053\053\053"
|
||||||
"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317"
|
"\053\053\053\053\053\053\053\053\043\043\043\043\043\075\043\053"
|
||||||
"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337"
|
"\053\053\053\053\053\053\053\053\053\053\053\333\334\335\336\337"
|
||||||
"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357"
|
"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357"
|
||||||
"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"
|
"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377"
|
||||||
};
|
};
|
||||||
@ -99,12 +101,77 @@ void Msg_Pid(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Msg_Top(void)
|
void Msg_Macro(FILE *fi)
|
||||||
|
{
|
||||||
|
char *temp, *line;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
temp = calloc(256, sizeof(char));
|
||||||
|
line = calloc(256, sizeof(char));
|
||||||
|
|
||||||
|
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {
|
||||||
|
/*
|
||||||
|
* Skip comment lines
|
||||||
|
*/
|
||||||
|
if (line[0] != '#') {
|
||||||
|
Striplf(line);
|
||||||
|
if (strlen(line) == 0) {
|
||||||
|
/*
|
||||||
|
* Empty lines are just written
|
||||||
|
*/
|
||||||
|
MsgText_Add2((char *)"");
|
||||||
|
Syslog('-', " ");
|
||||||
|
} else {
|
||||||
|
strncpy(temp, ParseMacro(line,&res), 254);
|
||||||
|
if (res)
|
||||||
|
Syslog('!', "Macro error line: \"%s\"", line);
|
||||||
|
/*
|
||||||
|
* Only output if something was evaluated
|
||||||
|
*/
|
||||||
|
if (strlen(temp)) {
|
||||||
|
MsgText_Add2(temp);
|
||||||
|
Syslog('-', "%s", temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(line);
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
long Msg_Top(char *template, int language, fidoaddr aka)
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp;
|
||||||
FILE *fp;
|
FILE *fp, *fi;
|
||||||
|
long fileptr, fileptr1 = 0L;
|
||||||
|
|
||||||
|
MacroVars("YSNLTUMH", "ssssssss", aka2str(aka), CFG.sysop_name, CFG.bbs_name, CFG.location,
|
||||||
|
CFG.comment, CFG.sysop, CFG.sysdomain, CFG.www_url);
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
|
if ((fi = OpenMacro(template, language))) {
|
||||||
|
Msg_Macro(fi);
|
||||||
|
fileptr = ftell(fi);
|
||||||
|
|
||||||
|
sprintf(temp, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
|
||||||
|
if ((fp = fopen(temp, "r")) != NULL) {
|
||||||
|
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp);
|
||||||
|
|
||||||
|
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) {
|
||||||
|
if (((ttyinfo.type == POTS) || (ttyinfo.type == ISDN)) && ttyinfo.available && strlen(ttyinfo.phone)) {
|
||||||
|
MacroVars("pqrf", "dsss", ttyinfo.type, ttyinfo.phone, ttyinfo.speed, ttyinfo.flags);
|
||||||
|
fseek(fi, fileptr, SEEK_SET);
|
||||||
|
Msg_Macro(fi);
|
||||||
|
fileptr1 = ftell(fi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
fclose(fi);
|
||||||
|
} else {
|
||||||
sprintf(temp, "System name %s", CFG.bbs_name);
|
sprintf(temp, "System name %s", CFG.bbs_name);
|
||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
sprintf(temp, "Sysop %s", CFG.sysop_name);
|
sprintf(temp, "Sysop %s", CFG.sysop_name);
|
||||||
@ -134,27 +201,26 @@ void Msg_Top(void)
|
|||||||
MsgText_Add2(temp);
|
MsgText_Add2(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
|
}
|
||||||
|
|
||||||
free(temp);
|
free(temp);
|
||||||
|
return fileptr1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Msg_Bot(fidoaddr UseAka, char *Org)
|
void Msg_Bot(fidoaddr UseAka, char *Org, char *template)
|
||||||
{
|
{
|
||||||
char *temp, *aka;
|
char *temp, *aka;
|
||||||
|
|
||||||
temp = calloc(81, sizeof(char));
|
temp = calloc(81, sizeof(char));
|
||||||
aka = calloc(40, sizeof(char));
|
aka = calloc(40, sizeof(char));
|
||||||
|
|
||||||
MsgText_Add2((char *)"");
|
|
||||||
sprintf(temp, "With regards, %s", CFG.sysop_name);
|
|
||||||
MsgText_Add2(temp);
|
|
||||||
MsgText_Add2((char *)"");
|
MsgText_Add2((char *)"");
|
||||||
MsgText_Add2(TearLine());
|
MsgText_Add2(TearLine());
|
||||||
|
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
#ifndef _MSGUTIL_H
|
#ifndef _MSGUTIL_H
|
||||||
#define _MSGUTIL_H
|
#define _MSGUTIL_H
|
||||||
|
|
||||||
|
|
||||||
void Msg_Id(fidoaddr);
|
void Msg_Id(fidoaddr);
|
||||||
void Msg_Pid(void);
|
void Msg_Pid(void);
|
||||||
void Msg_Top(void);
|
void Msg_Macro(FILE *);
|
||||||
void Msg_Bot(fidoaddr, char *);
|
long Msg_Top(char *, int, fidoaddr);
|
||||||
|
void Msg_Bot(fidoaddr, char *, char *);
|
||||||
void CountPosted(char *);
|
void CountPosted(char *);
|
||||||
char *To_Low(char *, int);
|
char *To_Low(char *, int);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user